isComplete flag is true during animation
theapache64 opened this issue · comments
theapache64 commented
val composition = rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.lottielogo))
val progress by animateLottieCompositionAsState(composition.value)
println(":SplashScreen: progress: $progress")
println(":SplashScreen: composition: $composition")
println(":SplashScreen: composition: isFinished ${composition.isComplete}")
LottieAnimation(
composition = composition.value,
progress = { progress },
)
Let me know if you need more details
Gabriel Peal commented
Composition.isComplete indicates that the composition has finished parsing and has very few uses.
You want:
val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.lottielogo))
val animationState = animateLottieCompositionAsState(composition)
println(animationState.isAtEnd) // or animationState.isPlaying
LottieAnimation(
composition,
progress = { animationState.progress },
)