LottieScreen

class LottieScreen(val context: Context, id: String? = null) : ImageScreenObject

Renders a Lottie animation as an image in an offscreen video composition.

Load an animation with setAnimation or setAnimationFromJson, add this object to a screen, and call playAnimation. Animations repeat indefinitely by default.

Parameters

id

The screen object identifier, or null to generate one.

Constructors

Link copied to clipboard
constructor(context: Context, id: String? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
var asyncUpdates: AsyncUpdates

The update mode forwarded to the Lottie drawable.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Reads the drawable's text clipping setting.

Link copied to clipboard

Whether rendering is clipped to the composition bounds.

Link copied to clipboard

The Android context used to load animation resources.

Link copied to clipboard
Link copied to clipboard
open override var elements: Map<String, String>
Link copied to clipboard

Whether merge paths are enabled in the Lottie drawable.

Link copied to clipboard
open var frame: Rect
Link copied to clipboard
Link copied to clipboard
val id: String
Link copied to clipboard

The asset folder used by the drawable to resolve animation images.

Link copied to clipboard

Whether the underlying Lottie drawable is currently animating.

Link copied to clipboard

Whether opacity is applied to layers by the Lottie drawable.

Link copied to clipboard
open var isVisible: Boolean
Link copied to clipboard
Link copied to clipboard

Whether the drawable preserves the original bounds of image assets.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The repeat count forwarded to the drawable; defaults to LottieDrawable.INFINITE.

Link copied to clipboard
open override var shouldInvalidateLayout: Boolean
Link copied to clipboard

The playback speed multiplier forwarded to the Lottie drawable.

Link copied to clipboard
val target: Int
Link copied to clipboard
open var textureId: Int
Link copied to clipboard
open override val type: String
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Cancels animation playback through the Lottie drawable.

Link copied to clipboard
open fun draw(renderer: Renderer)
Link copied to clipboard
open fun findById(id: String): ScreenObject?
Link copied to clipboard
Link copied to clipboard
open fun invalidateLayout()
Link copied to clipboard
open override fun layout(renderer: Renderer)
Link copied to clipboard

Pauses animation playback through the Lottie drawable.

Link copied to clipboard

Starts the Lottie animation and invalidates the screen layout.

Link copied to clipboard
fun setAnimation(@RawRes rawRes: Int)

Loads an animation from an Android raw resource.

fun setAnimation(assetName: String)

Loads an animation from the application assets using the supplied asset name.

fun setAnimation(stream: InputStream?, cacheKey: String? = null)

Loads a JSON animation from an input stream.

fun setAnimation(stream: ZipInputStream?, cacheKey: String? = null)

Loads an animation and its assets from a ZIP stream.

Link copied to clipboard
fun setAnimationFromJson(jsonString: String, cacheKey: String? = null)

Loads an animation from a JSON string.

Link copied to clipboard
fun setAnimationFromUrl(url: String?, cacheKey: String? = null)

Loads an animation from a URL using the Lottie composition loader.

Link copied to clipboard
fun setFontMap(fontMap: Map<String, Typeface>)

Sets the font-name-to-typeface mapping used by the Lottie drawable.

Link copied to clipboard
fun setImageAssetDelegate(assetDelegate: ImageAssetDelegate)

Sets the delegate used by the Lottie drawable to resolve image assets.

Link copied to clipboard
fun setSafeMode(safeMode: Boolean)

Sets the underlying Lottie drawable's safe mode flag.