[英]android: play segment of Lottie animation
我認為問題的標題說明了一切,
我雖然想添加一個 animation 監聽器,但無法得到我想要的結果。
//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
}
}
似乎設置最小/最大幀是一種合適的方式,
//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
它設置 animation 在播放或循環時將結束的最大進度。
lottie_toggle.setMaxFrame(maxFrame);
它設置 animation 在播放或循環時開始的最小幀。
lottie_toggle.setMinFrame(minFrame);
它設置 animation 在播放或循環時將開始和結束的最小和最大幀。
lottie_toggle.setMinAndMaxFrame(minFrame, maxFrame);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.