DevJoy.Scene.Asset (DevJoy v2.0.0)
View SourceProvides a way to work with assets, such as images, sounds and other files. It also specifies how the asset should be used in the scene, such as displaying an image as a background or playing a sound repeatedly. You can also choose to store the asset content in the structure or retrieve it at runtime, depending on your use case.
Usage
The asset always requires its type and path.
You can also optionally specify additional data and content.
defmodule MyApp.SceneName do
use DevJoy.Scene
part :asset do
asset :background, "/path/to/background.jpg", aspect_ratio: "1:1"
asset :slide, "/path/to/slide.svg", [] do
"…"
end
end
endSummary
Field types
The type representing the assets's content.
The type representing the additional data for the asset.
The type representing the assets's path.
The type representing the assets's type.
Field types
Main
The asset structure contains the following keys:
Returns absolute path for an asset inside a priv directory
for the specified project.
@spec static_path(t(), base_path | endpoint | uri | nil) :: String.t() when base_path: String.t(), endpoint: module(), uri: URI.t()
Returns a static path to the asset.
@type t() :: %DevJoy.Scene.Asset{ content: content() | nil, data: data(), path: path() | nil, type: type() }
The type representing the asset structure.