最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

微信小程序開發(fā)animation心跳動(dòng)畫效果

 更新時(shí)間:2021年09月23日 09:33:51   作者:Rolan  
這篇文章主要為大家詳細(xì)介紹了微信小程序開發(fā)animation心跳動(dòng)畫效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了微信小程序開發(fā)animation心跳動(dòng)畫,供大家參考,具體內(nèi)容如下

1、微信小程序開發(fā)animation心跳動(dòng)畫

wxml文件中:

<view class="bottomViewItem"> 
  <view class="bottomMiddleHeaderView" bindtap="voteClick" data-id="value"> 
   <view class="bottomMiddleHeaderItem" animation="{{animationMiddleHeaderItem}}"> 
   <!-- 心跳 --> 
   <view class="bottomMiddleHeaderItemSubView"> 
    <image src="/images/detail_vote_heart.png" style="width:32rpx; height:32rpx;" animation="{{animationMiddleHeaderItem}}"></image> 
   </view> 
   <!-- 投票文字 --> 
   <view class="bottomMiddleHeaderItemSubView">投票</view> 
   </view> 
  </view> 
 </view> 

js文件中:

// 頁(yè)面渲染完成 
 onReady: function () { 
  var circleCount = 0; 
  // 心跳的外框動(dòng)畫 
  this.animationMiddleHeaderItem = wx.createAnimation({ 
  duration:1000, // 以毫秒為單位 
  /** 
  * http://cubic-bezier.com/#0,0,.58,1 
  * linear 動(dòng)畫一直較為均勻 
  * ease 從勻速到加速在到勻速 
  * ease-in 緩慢到勻速 
  * ease-in-out 從緩慢到勻速再到緩慢 
  * 
  * http://www.tuicool.com/articles/neqMVr 
  * step-start 動(dòng)畫一開始就跳到 100% 直到動(dòng)畫持續(xù)時(shí)間結(jié)束 一閃而過(guò) 
  * step-end 保持 0% 的樣式直到動(dòng)畫持續(xù)時(shí)間結(jié)束  一閃而過(guò) 
  */ 
  timingFunction: 'linear', 
  delay: 100, 
  transformOrigin: '50% 50%', 
  success: function (res) { 
  } 
  }); 
  setInterval(function() { 
  if (circleCount % 2 == 0) { 
   this.animationMiddleHeaderItem.scale(1.15).step(); 
  } else { 
   this.animationMiddleHeaderItem.scale(1.0).step(); 
  } 
  this.setData({ 
   animationMiddleHeaderItem: this.animationMiddleHeaderItem.export() 
  }); 
  circleCount++; 
  if (circleCount == 1000) { 
   circleCount = 0; 
  } 
  }.bind(this), 1000); 
 }, 

2、微信顯示倒計(jì)時(shí)

wxml文件中:

<!--倒計(jì)時(shí) --> 
 <view class="countDownTimeView countDownAllView" > 
 <view class="voteText countDownTimeText">{{countDownDay}}天</view> 
 <view class="voteText countDownTimeText">{{countDownHour}}時(shí)</view> 
 <view class="voteText countDownTimeText">{{countDownMinute}}分</view> 
 <view class="voteText countDownTimeText">{{countDownSecond}}秒</view> 
 </view> 

js文件中:

Page( { 
 data: { 
 windowHeight: 654, 
 maxtime: "", 
 isHiddenLoading: true, 
 isHiddenToast: true, 
 dataList: {}, 
 countDownDay: 0, 
 countDownHour: 0, 
 countDownMinute: 0, 
 countDownSecond: 0, 
 }, 
 //事件處理函數(shù) 
 bindViewTap: function() { 
 wx.navigateTo( { 
  url: '../logs/logs' 
 }) 
 }, 
 onLoad: function() { 
 this.setData( { 
  windowHeight: wx.getStorageSync( 'windowHeight' ) 
 }); 
 }, 
 // 頁(yè)面渲染完成后 調(diào)用 
 onReady: function () { 
 var totalSecond = 1505540080 - Date.parse(new Date())/1000; 
 var interval = setInterval(function () { 
  // 秒數(shù) 
  var second = totalSecond; 
  // 天數(shù)位 
  var day = Math.floor(second / 3600 / 24); 
  var dayStr = day.toString(); 
  if (dayStr.length == 1) dayStr = '0' + dayStr; 
  // 小時(shí)位 
  var hr = Math.floor((second - day * 3600 * 24) / 3600); 
  var hrStr = hr.toString(); 
  if (hrStr.length == 1) hrStr = '0' + hrStr; 
  // 分鐘位 
  var min = Math.floor((second - day * 3600 *24 - hr * 3600) / 60); 
  var minStr = min.toString(); 
  if (minStr.length == 1) minStr = '0' + minStr; 
  // 秒位 
  var sec = second - day * 3600 * 24 - hr * 3600 - min*60; 
  var secStr = sec.toString(); 
  if (secStr.length == 1) secStr = '0' + secStr; 
  this.setData({ 
  countDownDay: dayStr, 
  countDownHour: hrStr, 
  countDownMinute: minStr, 
  countDownSecond: secStr, 
  }); 
  totalSecond--; 
  if (totalSecond < 0) { 
  clearInterval(interval); 
  wx.showToast({ 
   title: '活動(dòng)已結(jié)束', 
  }); 
  this.setData({ 
   countDownDay: '00', 
   countDownHour: '00', 
   countDownMinute: '00', 
   countDownSecond: '00', 
  }); 
  } 
 }.bind(this), 1000); 
 }, 
 //cell事件處理函數(shù) 
 bindCellViewTap: function (e) { 
 var id = e.currentTarget.dataset.id; 
 wx.navigateTo({ 
  url: '../babyDetail/babyDetail?id=' + id 
 }); 
 } 
})

效果圖:

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論

广饶县| 巴林右旗| 黄陵县| 丰镇市| 河北省| 龙里县| 菏泽市| 九台市| 昌宁县| 大洼县| 凯里市| 高淳县| 雷山县| 柳河县| 恩平市| 迭部县| 闽侯县| 元谋县| 杭州市| 博野县| 屏南县| 重庆市| 曲水县| 陈巴尔虎旗| 宜宾县| 榆中县| 永仁县| 大英县| 稻城县| 乐清市| 长垣县| 周宁县| 塔河县| 南阳市| 克山县| 鄂托克旗| 石台县| 卫辉市| 临猗县| 壤塘县| 仪征市|