I think the title of the question says it all,
I though of adding an animation Listener but couldn't get the result i want.
//lottie_toggle is the view id
lottie_toggle.addAnimatorUpdateListener {valueAnimator->
val progress = (valueAnimator.animatedValue as Float * 100).toInt()
if (progress==100 ){
lottie_toggle.cancelAnimation()
lottie_toggle.progress=0f
}
if (progress==50 ){
lottie_toggle.cancelAnimation()
lottie_toggle.progress=0.5f
}
}
it appears that setting the min/max frame is a suitable way,
//if the animation has 60 frames
lottie_toggle.setMinAndMaxFrame(0,30) //to play the first half
lottie_toggle.setMinAndMaxFrame(30,60) //to play the second half
It sets the maximum progress that the animation will end at when playing or looping.
lottie_toggle.setMaxFrame(maxFrame);
It sets the minimum frame that the animation will start from when playing or looping.
lottie_toggle.setMinFrame(minFrame);
It sets the minimum and maximum frames that the animation will start and end when playing or looping.
lottie_toggle.setMinAndMaxFrame(minFrame, maxFrame);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.