微信小程序——简易动画案例
wxml:
我在做动画
js:
//js
Page({
data: {
},
onReady: function () {
// 页面渲染完成
//实例化一个动画
this.animation = wx.createAnimation({
// 动画持续时间,单位ms,默认值 400
duration: 400,
timingFunction: 'ease',
// 延迟多长时间开始
delay: 100,
transformOrigin: 'left top 0',
success: function (res) {
console.log(res)
}
})
},
translate: function () {
//x轴位移100px
this.animation.translate(100, 0).step()
this.setData({
//输出动画
animation: this.animation.export()
})
}
})
如有疑问请留言或者到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!



