To play Lottie animation takes time which causing blank screen appears for a couple of frames.
naginder14 opened this issue · comments
Hi Team,
Lottie animation takes time to play, which causing blank screen appear for a couple of frames.
Below are the trial snippet:
val composition by rememberLottieComposition(
LottieCompositionSpec.RawRes(
R.raw.ic_splash_anim_second // json file
)
)
val progress by animateLottieCompositionAsState(
composition,
iterations = 1,
)
LottieAnimation(
composition,
{ progress }
)
Compositions have to be loaded and parsed from disk which can take time depending on the speed of the device and the size of the animation. That's why rememberLottieComposition
returns nullable.
If you want to preload an animation, call LottieCompositionFactory.fromRawRes(R.raw.ic_slash_anim_second)
somewhere before it is needed and it'll load from the cache next time.