免费国产欧美国日产_少妇AV一区二区三区无码_蜜桃精品av无码喷奶水小说_jk18禁网站视频_精产国品一二三级产品区别_被夫の上司に犯波多野结衣_78m成人手机免费看_最爽最刺激18禁视频_偷偷色噜狠狠狠狠的777米奇

易優(yōu)GEO 重磅上線 ~ 一站式GEO優(yōu)化工具,讓豆包、文心一言、DeepSeek 在回答中主動(dòng)推薦你的品牌,搶占AI流量入口!  點(diǎn)擊查看

小程序模板網(wǎng)

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

發(fā)布時(shí)間:2017-12-28 15:24 所屬欄目:小程序開(kāi)發(fā)教程

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

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

wxml文件中:

?
1
2
3
4
5
6
7
8
9
10
11
12
<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文件中:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// 頁(yè)面渲染完成
 onReady: function () {
  var circleCount = 0;
  // 心跳的外框動(dòng)畫(huà)
  this.animationMiddleHeaderItem = wx.createAnimation({
  duration:1000, // 以毫秒為單位
  /**
  * http://cubic-bezier.com/#0,0,.58,1
  * linear 動(dòng)畫(huà)一直較為均勻
  * ease 從勻速到加速在到勻速
  * ease-in 緩慢到勻速
  * ease-in-out 從緩慢到勻速再到緩慢
  *
  * step-start 動(dòng)畫(huà)一開(kāi)始就跳到 100% 直到動(dòng)畫(huà)持續(xù)時(shí)間結(jié)束 一閃而過(guò)
  * step-end 保持 0% 的樣式直到動(dòng)畫(huà)持續(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文件中:

?
1
2
3
4
5
6
7
<!--倒計(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文件中:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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
 });
 }
})

效果圖:


易優(yōu)小程序(企業(yè)版)+靈活api+前后代碼開(kāi)源 碼云倉(cāng)庫(kù):starfork
本文地址:http://www.szcjxy.com/wxmini/doc/course/18293.html 復(fù)制鏈接 如需定制請(qǐng)聯(lián)系易優(yōu)客服咨詢(xún): 點(diǎn)擊咨詢(xún)
在線客服