当用户点击view时,触发动画,只能执行一次动画而已么?再点无效
methods = {
onRobot () {
console.log('onRobot')
let bodyAnimation = wx.createAnimation({
duration: 300,
timingFunction: 'ease'
})
bodyAnimation.rotateZ(-35).step()
bodyAnimation.rotateZ(35).step()
bodyAnimation.rotateZ(0).step()
this.bodyAnimation = bodyAnimation.export()
}
}
重新归位下动画就可以了 比如在后面再加上这么一句 setTimeout(() => { bodyAnimation.rotateZ(0).step() this.bodyAnimation = bodyAnimation.export() }, 1000);
let that = this
setTimeout(() => {
that.eyeAnimation = eyeAnimation.export()
that.bodyAnimation = bodyAnimation.export()
that.$apply()
}, duration + delay + 1);
我这里本来就是需要两个动画的。哈哈
没啥用啊,都没归位