微信小程序连续旋转动画 https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-animation.html

<view animation="{{animationData}}" style="background:red;height:100rpx;width:100rpx; bottom:10px;position: absolute;"></view>
Page({
  data: {
    animationData: {}
  },
  onShow: function () {
    var animation = wx.createAnimation({
      duration: 500,
      timingFunction: 'ease',
    })

    this.animation = animation

    // animation.scale(2, 2).rotate(45).step()

    this.setData({
      animationData: animation.export()
    })
    var n = 0;
//连续动画需要添加定时器,所传参数每次+1就行 setInterval(function () {
// animation.translateY(-60).step() n=n+1; console.log(n); this.animation.rotate(180 * (n)).step() this.setData({ animationData: this.animation.export() }) }.bind(this), 1000) }, })

 

相关文章:

  • 2021-08-25
  • 2021-12-26
  • 2021-08-28
  • 2021-05-26
  • 2021-09-28
  • 2022-02-03
  • 2021-08-17
  • 2021-04-30
猜你喜欢
  • 2022-12-23
  • 2021-09-16
  • 2021-08-22
  • 2022-01-14
  • 2021-06-17
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案