xref: /aosp_15_r20/external/lottie/lottie-compose/src/main/java/com/airbnb/lottie/compose/LottieAnimationState.kt (revision bb5273fecd5c61b9ace70f9ff4fcd88f0e12e3f7)
1 package com.airbnb.lottie.compose
2 
3 import androidx.compose.animation.core.AnimationConstants
4 import androidx.compose.runtime.Stable
5 import androidx.compose.runtime.State
6 import com.airbnb.lottie.LottieComposition
7 
8 /**
9  * [LottieAnimationState] is a value holder that contains information about the current Lottie animation.
10  *
11  * The primary values are [LottieAnimationState.progress] and [LottieAnimationState.composition]. These
12  * value should be passed into the main [LottieAnimation] composable.
13  *
14  * @see progress
15  * @see composition
16  * @see animateLottieCompositionAsState
17  */
18 @Stable
19 interface LottieAnimationState : State<Float> {
20     val isPlaying: Boolean
21 
22     val progress: Float
23 
24     val iteration: Int
25 
26     val iterations: Int
27 
28     val reverseOnRepeat: Boolean
29 
30     val clipSpec: LottieClipSpec?
31 
32     val speed: Float
33 
34     val useCompositionFrameRate: Boolean
35 
36     val composition: LottieComposition?
37 
38     val lastFrameNanos: Long get() = AnimationConstants.UnspecifiedTime
39 
40     val isAtEnd: Boolean
41 }