zoukankan      html  css  js  c++  java
  • 微信小程序连续动画

    <view animation="{{animationData}}" style="background:red;height:100rpx;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)
      },
    
    })
    

      如果想喝数据加载联系起来的话,这里的n应当设置成page里面data的一个数值

  • 相关阅读:
    POJ
    HDU
    POJ
    HDU
    HDU
    HDU
    POJ
    ZOJ
    ZOJ
    Kattis
  • 原文地址:https://www.cnblogs.com/mmykdbc/p/9067405.html
Copyright © 2011-2022 走看看