微信小程序的动画如何可以循环播放呢?
小弟请教一下做过微信小程序的大牛,API写的一个周期只能播放一次,但是小弟用了setInterval方法去循环也只播放一次,感觉问题出在 animationData: animation.export()这个代码上,下面是代码
audioPlay: function (e) {
// 在标签页添加 data-*** 可以通过e.currentTarget.dataset.*** 取值
this.audioCtx.play()
this.setData({
courseImg: '../../images/pause.png'
})
this.setData({
temp1: true
})
this.setData({
temp2: false
})
var that = this
setInterval(function(){
that.playCD()
},1000)
// var that = this
// var loopValue = that.data.second / 100
// var temp = that.data.percent
//循环改变进度条的值
// setInterval(function(){
// if(temp < 100){
// console.info(that.data.percent)
// temp = temp + 1
// console.info(temp)
// }
// }, loopValue)
},playCD:function(){
var that = this
console.info('开始调用了')
setInterval(function () {
that.animation = animation
animation.rotate(360).step()
that.setData({
animationData: animation.export()
})
}, 1000)
},