let animation = wx.createAnimation({});
animation() {
var that = this;
// 控制向上还是向下移动
let m = true
setInterval(function () {
if (m) {
animation.translate(190, 0).step({
duration: 3000
})
m = !m;
} else {
animation.translate(-10, 0).step({
duration: 3000
})
m = !m;
}
that.setData({
animation: animation.export()
})
}.bind(this), 3000)
},
以上是代码
麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)