<button class='cut-btn' animation="{{animationData2}}">喊好友砍一刀</button>
- data = {
- animationData2: {},
- }
- onShow() {
- var animation = wx.createAnimation({
- duration: 500,
- timingFunction: 'ease',
- })
- this.animation = animation
- var next = true
- //连续动画关键步骤
- setInterval(
- function() {
- if (next) {
- this.animation.scale(0.95).step()
- next = !next
- } else {
- this.animation.scale(1).step()
- next = !next
- }
- this.animationData2 = animation.export()
- this.$apply()
- }.bind(this),
- 500
- )
- }