android 动画自动恢复,android

您可以做的是使用LottieAnimationView,线程和标志的进度 ,这将允许您暂停某个进度并在需要再次播放动画时完全恢复

我创建了以下示例:

animationView.playAnimation()

animationView.loop(false)

isAnimating = true // Setup your flag

thread {

while (isAnimating){ // Loop that checks the progress of your animation

if (animationView.progress >= 0.5f){// If animation reaches 50%

runOnUiThread {

animationView.pauseAnimation()// Pause Animation

}

Thread.sleep(5000) // Pause for 5 seconds

runOnUiThread {

animationView.playAnimation(0.5f,1f) // Resume your animation from 50% to 100%

}

isAnimating = false

}

if(animationView.progress >= 1f){ // If animation reaches 100% stop animation

runOnUiThread {

animationView.cancelAnimation()

isAnimating = false

}

}

}

}

希望能帮助到你。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值