var animation = wx.createAnimation({
duration: 20000,
timingFunction: ‘linear’,
})
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.animation = animation
animation.rotate(360).step()
that.setData({
animationData: animation.export()
})
},1000)
},
这是 代码,但是动画只会播放一次,不知道如何去循环播放,请教一下大神
试试这样的
audioPlay: function (e) {
// 在标签页添加 data-*** 可以通过e.currentTarget.dataset.*** 取值
this.audioCtx.play()
this.setData({
courseImg: '../../images/pause.png', temp1: true, temp2: false
})
var that = this
setInterval(function(){
that.playCD()
},2000)
},
playCD:function(){
var that = this;
console.info('开始调用了')
var timer=setInterval(function () {
that.animation = animation
animation.rotate(360).step()
that.setData({
animationData: animation.export()
})
}, 1000)
setTimeout(function(){
clearInterval(timer);
},1000)
},
}, loopValue)
},playCD:function(){
var animation = wx.createAnimation({
duration: 20000,
timingFunction: ‘linear’,
})
var that = this
console.info(‘开始调用了’)
var timer = setInterval(function () {
this.animation = animation
animation.rotate(360).step()
that.setData({
animationData: animation.export()
})
}, 1000)
setTimeout(function (){
clearInterval(timer)
},1000)
},
已经放到了playCD里,还是不行
套了一个,不知道为什么没效果,
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)
},playCD:function(){
var that = this
console.info(‘开始调用了’)
setInterval(function () {
that.animation = animation
animation.rotate(360).step()
that.setData({
animationData: animation.export()
})
}, 1000)
},