I have a Lottie animation that I want to start then when it gets to a certain frame I want to loop from frame X to frame Y.
The issue I am running up against is that I cant seem to figure out how to update the clipSpec at runtime with LottieCompose as clipSpec cannot be reassigned.
I was able to do this no problem with normal XML layout based Lottie like this
loading_animation.addAnimatorUpdateListener {
if(initialLoad && loading_animation.frame == 15){
initialLoad = false
startTime = System.currentTimeMillis()
loading_animation.setMinAndMaxFrame(15,28)
}
if(!initialLoad && authenticated && System.currentTimeMillis() >= (startTime+1000)){
loading_animation.pauseAnimation()
startActivity()
}
}
here is my LottieCompose code I have so far
val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.sun_icon))
val animatable = rememberLottieAnimatable()
val progress by animateLottieCompositionAsState(composition, iterations = LottieConstants.IterateForever)
LottieAnimation(composition = composition, progress = progress, modifier = Modifier.wrapContentSize())