首先上官网

将动画封装到一个函数,在需要的时候调用,也可以在满足一定条件时重复调用.

<view animation="{{animationData}}" ></view>
onLoad: function(){
    this.newInfor();
}



newInfor(){
      var animation = wx.createAnimation({
        duration: 1000,
        timingFunction: 'linear',
      })

      this.animation = animation

      animation.translate(150).step()

      this.setData({
        animationData: animation.export()
      })

      setTimeout(function () {
        animation.translate(-150).step()
        this.setData({
          animationData: animation.export()
        })
      }.bind(this), 2000)
    }

 

相关文章:

  • 2022-12-23
  • 2021-08-29
  • 2021-12-18
  • 2021-06-03
  • 2021-09-16
  • 2022-12-23
  • 2021-12-05
  • 2021-12-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-14
  • 2022-12-23
  • 2021-06-17
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案