欢迎来到258分享网,纯净的网络源码分享基地!

258资源分享网

全部作品
全部作品
网站源码
微信源码
素材特效
源码插件
视频教程
建站学院
热门搜索: 织梦  农业种植  农业  安全设置  官方
258资源分享 > 建站学院 > 微信开发 > 微信小程序连续旋转动画this.animation.rotate

推荐下载

HTML5响应式自适应网咯设计

2020-05-12   浏览:740

高端HTML5响应式企业通用网

2020-05-06   浏览:521

html5响应式外贸网站英文版

2020-05-08   浏览:510

HTML5自适应律师工作室类网

2020-04-04   浏览:505

HTML5影视传媒文化公司类网

2020-05-12   浏览:502

微信小程序连续旋转动画this.animation.rotate

发布时间:2020-12-01  

作者:ForeverGuard,来自原文地址 
本文相关跳坑指南:跳坑《一百三十四》animation动画相关问题说明

 

一、.js中封装旋转动画方法

添加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()

})

},

 

二、在.wxml中需要的控件上添加animation属性

 

<view class="show-iconView">

<image src=http://www.yiyongtong.com/archives/"{{src}}" class="show-iconImage" animation="{{animation}}" mode="scaleToFill"></image>

</view>

 

三、连续动画需要添加定时器

this.interval = setInterval所传参数每次++i就行!

本文标签

: