资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

微信小程序实现下拉刷新动画

微信小程序动画之下拉刷新动画的具体代码,供大家参考,具体内容如下

新城网站建设公司创新互联公司,新城网站设计制作,有大型网站制作公司丰富经验。已为新城千余家提供企业网站建设服务。企业网站搭建\外贸营销网站建设要多少钱,请找那个售后服务好的新城做网站的公司定做!

微信小程序实现下拉刷新动画

简易的效果

下面放代码:

js:

var animation = wx.createAnimation({})
var i = 1;
Page({
 data: {
  donghua: true,
  left1: Math.floor(Math.random() * 250 + 1),
  left2: Math.floor(Math.random() * 250 + 1),
  left3: Math.floor(Math.random() * 250 + 1),
  left4: Math.floor(Math.random() * 250 + 1),
  left5: Math.floor(Math.random() * 250 + 1),
  left6: Math.floor(Math.random() * 250 + 1),
  left7: Math.floor(Math.random() * 250 + 1),
  left8: Math.floor(Math.random() * 250 + 1),
 },

 //动画
 donghua: function () {
  var that = this;
  setTimeout(function () {
   animation.translateY(800).step({
    duration: 1600,
    timingFunction: 'ease'
   })
   that.setData({
    ["animationData" + i]: animation.export()
   })
   i++;
  }.bind(that), 200)
  if (i < 9) {
   setTimeout(function () {
    that.donghua()
   }.bind(that), 200)
  } else {
   i = 0;
   animation.translateY(-800).step({
    duration: 10,

   })
   setTimeout(function () {
    for (var y = 0; y < 9; y++) {
     that.setData({
      ["animationData" + y]: animation.export()
     })
     that.setData({
      ["animationData" + y + '.actions[0].animates[0].args[0]']: 0
     })
    }
   }.bind(that), 1500)

  }
 },
 onPullDownRefresh: function () {

  wx.showNavigationBarLoading();


  this.donghua();



  wx.stopPullDownRefresh();
 },

})

wxml:



 
  
  
  
  
  
  
  
    
 

wxss:

image{
 margin-top: -150rpx;
 width: 40rpx;
 height: 40rpx;
 margin-left: 5%;
 position: absolute;
 
}

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持创新互联。


当前题目:微信小程序实现下拉刷新动画
文章位置:http://cdkjz.cn/article/jjgeei.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220