效果图
wxml
<image src="https://img-blog.csdnimg.cn/20200820180305411.png"
animation="{{ animationData }}">
</image>
<button bindtap="go" style="">动起来</button>
js
Page({
data: {
animationData: {}
},
go: function() {
var animation = wx.createAnimation({
duration: 500,
timingFunction: 'ease',
})
this.animation = animation
var next = true;
setInterval(function(){
if(next){
this.animation.scale(0.8).step()
next = !next;
}
else
{
this.animation.scale(1).step()
next = !next;
}
this.setData({
animationData: animation.export()
})
}.bind(this),500)
}
})