今天做点击事件的动画,发现第二次动画点击无效果
原来是如果动画和上次一样 就不会重新渲染,所以需要重新把animationData置为空对象

<image :animation="animationData" @click.stop="konck" class="stick" src="/static/images/index/stick.png">
		</image>
export default {
		data() {
			return {
				auto: !1,
				count: 0,
				audio: !0,
				opengo: !0,
				gridid: '',
				animationData: {},
				agd1: {},
				agd2: {},
				agd3: {},
				agd4: {},
				agd5: {},
				agd6: {},
				agd7: {},
				agd8: {},
				agd9: {},
				agd0: {},
				aniamtion: {}
			}
		},
		onLoad() {
			this.aniamtion = wx.createAnimation({
				duration: 50,
				transformOrigin: "right top",
				timingFunction: "ease-in-out"
			});
		},
		methods: {
			konck: function() {
				this.aniamtion.rotate(0).step().rotate(40).step()
				this.animationData = this.aniamtion.export()
				setTimeout(()=>{
						  this.animationData={}
				        }, 10);
			},
		}
		}
		
Logo

分享最新的 NVIDIA AI Software 资源以及活动/会议信息,精选收录AI相关技术内容,欢迎大家加入社区并参与讨论。

更多推荐