animateLottieCompositionAsState

@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.

This is the declarative version of rememberLottieAnimatable and LottieAnimation.

Parameters

composition

The composition to render. This should be retrieved with rememberLottieComposition.

isPlaying

Whether or not the animation is currently playing. Note that the internal animation may end due to reaching the target iterations count. If that happens, the animation may stop even if this is still true. You can observe the returned LottieAnimationState.isPlaying to determine whether the underlying animation is still playing.

restartOnPlay

If isPlaying switches from false to true, restartOnPlay determines whether the progress and iteration gets reset.

clipSpec

A LottieClipSpec that specifies the bound the animation playback should be clipped to.

speed

The speed the animation should play at. Numbers larger than one will speed it up. Numbers between 0 and 1 will slow it down. Numbers less than 0 will play it backwards.

iterations

The number of times the animation should repeat before stopping. It must be a positive number. LottieConstants.IterateForever can be used to repeat forever.

cancellationBehavior

The behavior that this animation should have when cancelled. In most cases, you will want it to cancel immediately. However, if you have a state based transition and you want an animation to finish playing before moving on to the next one then you may want to set this to LottieCancellationBehavior.OnIterationFinish.