airbnb / lottie-android

Render After Effects animations natively on Android and iOS, Web, and React Native

Home Page:http://airbnb.io/lottie/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

isComplete flag is true during animation

theapache64 opened this issue · comments

 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 },
  )

image

Let me know if you need more details

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 },
)