Package com.airbnb.lottie.compose

Types

LottieAnimatable
Link copied to clipboard
@Stable()
interface LottieAnimatable : LottieAnimationState
LottieAnimatable is an extension of LottieAnimationState that contains imperative suspend functions to control animation playback.
LottieAnimationState
Link copied to clipboard
@Stable()
interface LottieAnimationState : State<Float>
LottieAnimationState is a value holder that contains information about the current Lottie animation.
LottieCancellationBehavior
Link copied to clipboard
enum LottieCancellationBehavior : Enum<LottieCancellationBehavior>
Determines how the animation should behave if the calling CoroutineScope is cancelled.
LottieClipSpec
Link copied to clipboard
sealed class LottieClipSpec
Use subclasses of LottieClipSpec to set min/max bounds on the animation playback.
LottieCompositionResult
Link copied to clipboard
@Stable()
interface LottieCompositionResult : State<LottieComposition?>
LottieCompositionSpec
Link copied to clipboard
interface LottieCompositionSpec
Specification for a com.airbnb.lottie.LottieComposition.
LottieConstants
Link copied to clipboard
object LottieConstants
LottieDynamicProperties
Link copied to clipboard
class LottieDynamicProperties
LottieDynamicProperty
Link copied to clipboard
class LottieDynamicProperty<T>
LottieRetrySignal
Link copied to clipboard
@Stable()
class LottieRetrySignal
Helper to retry compositions that fail to load.

Functions

animateLottieCompositionAsState
Link copied to clipboard
@Composable()
fun animateLottieCompositionAsState(composition: LottieComposition?, isPlaying: Boolean = true, restartOnPlay: Boolean = true, clipSpec: LottieClipSpec? = null, speed: Float = 1f, iterations: Int = 1, cancellationBehavior: LottieCancellationBehavior = LottieCancellationBehavior.Immediately): LottieAnimationState
Returns a LottieAnimationState representing the progress of an animation.
awaitOrNull
Link copied to clipboard
suspend fun LottieCompositionResult.awaitOrNull(): LottieComposition?
Like LottieCompositionResult.await but returns null instead of throwing an exception if the animation fails to load.
LottieAnimatable
Link copied to clipboard
fun LottieAnimatable(): LottieAnimatable
Use this to create a LottieAnimatable outside of a composable such as a hoisted state class.
LottieAnimation
Link copied to clipboard
@Composable()
fun LottieAnimation(composition: LottieComposition?, @FloatRange(from = 0.0.toDouble(), to = 1.0.toDouble()progress: Float, modifier: Modifier = Modifier, outlineMasksAndMattes: Boolean = false, applyOpacityToLayers: Boolean = false, enableMergePaths: Boolean = false, dynamicProperties: LottieDynamicProperties? = null, alignment: Alignment = Alignment.Center, contentScale: ContentScale = ContentScale.Fit)
This is the base LottieAnimation composable.
@Composable()
fun LottieAnimation(composition: LottieComposition?, modifier: Modifier = Modifier, isPlaying: Boolean = true, restartOnPlay: Boolean = true, clipSpec: LottieClipSpec? = null, speed: Float = 1f, iterations: Int = 1, outlineMasksAndMattes: Boolean = false, applyOpacityToLayers: Boolean = false, enableMergePaths: Boolean = false, dynamicProperties: LottieDynamicProperties? = null, alignment: Alignment = Alignment.Center, contentScale: ContentScale = ContentScale.Fit)
This is like LottieAnimation except that it handles driving the animation via animateLottieCompositionAsState instead of taking a raw progress parameter.
rememberLottieAnimatable
Link copied to clipboard
@Composable()
fun rememberLottieAnimatable(): LottieAnimatable
Use this to create a LottieAnimatable in a composable.
rememberLottieComposition
Link copied to clipboard
@Composable()
fun rememberLottieComposition(spec: LottieCompositionSpec, imageAssetsFolder: String? = null, fontAssetsFolder: String = "fonts/", fontFileExtension: String = ".ttf", cacheKey: String? = DefaultCacheKey, onRetry: suspend (failCount: Int, previousException: Throwable) -> Boolean = { _, _ -> false }): LottieCompositionResult
Takes a LottieCompositionSpec, attempts to load and parse the animation, and returns a LottieCompositionResult.
rememberLottieDynamicProperties
Link copied to clipboard
@Composable()
fun rememberLottieDynamicProperties(vararg properties: LottieDynamicProperty<*>): LottieDynamicProperties
Use this function when you want to apply one or more dynamic properties to an animation.
rememberLottieDynamicProperty
Link copied to clipboard
@Composable()
fun <T> rememberLottieDynamicProperty(property: T, value: T, vararg keyPath: String): LottieDynamicProperty<T>
Use this to create a single dynamic property for an animation.
@Composable()
fun <T> rememberLottieDynamicProperty(property: T, vararg keyPath: String, callback: (frameInfo: LottieFrameInfo<T>) -> T): LottieDynamicProperty<T>
Use this to create a single dynamic property for an animation.
rememberLottieRetrySignal
Link copied to clipboard
@Composable()
fun rememberLottieRetrySignal(): LottieRetrySignal
resetToBeginning
Link copied to clipboard
suspend fun LottieAnimatable.resetToBeginning()
Reset the animation back to the minimum progress and first iteration.