添加animation属性
data:{ animation:''" }
改变animation的值(官网提供角度范围是-180~180,但是我发现角度越大会一直旋转)
onShow: function() { console.log('index---------onShow()') this.animation = wx.createAnimation({ duration: 1400, timingFunction: 'linear', // "linear","ease","ease-in","ease-in-out","ease-out","step-start","step-end" delay: 0, transformOrigin: '50% 50% 0', success: function(res) { console.log("res") } }) }, rotateAni: function (n) { console.log("rotate=="+n) this.animation.rotate(180*(n)).step() this.setData({ animation: this.animation.export() }) },
<view class="show-iconView"> <image src="{{src}}" class="show-iconImage" animation="{{animation}}" mode="scaleToFill"></image> </view>
this.interval = setInterval所传参数每次++i就行!
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!