动画可以重复执行,前提是你this.animation对象里面的各种动画方法传入的参数不能是固定的一个值。
可以
rotateAndScale() {
this.animation.translateY(this.random(10, 15)).step()
}
// return 一个指定范围内的随机数
random(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min)
}
之后确定一个完整的动画周期是多少时间,再使用setInterval就可以重复运行动画了
如何在uni-app 中使用动画-animation如何在uni-app 中使用动画-animation 参考文档:https://uniapp.dcloud.io/api/ui/animation?id=createanim...