微信扫码登录

其他登录方式

绑定手机号

注册

我同意用户协议

忘记密码

用户协议

绑定手机号

近期有不法分子打着爱盈利的旗号,制作“爱盈利”名称的App,并伪造爱盈利证件,骗取用户信任,以抖音点赞赚钱或其他方式赚钱为名义,过程中以升级会员获得高佣金为名让用户充值。
爱盈利公司郑重声明:我司没有研发或运营过任何名为“爱盈利”的APP,我司做任务赚钱类产品从没有让任何普通用户充值升级会员。我公司产品均在本网站可查询,请将网站拉至底部,点击“关于我们”可查看爱盈利相关产品与服务。
温馨提示:当遇到此类问题请拨打官方电话或添加官方微信,以免财产损失。爱盈利官网地址:www.aiyingli.com。
  • 推广与合作
X

小程序丨【微信小程序开发教程】animation心跳动画

来源: 2969

1微信小程序开发animation心跳动画

1.wxml文件中:

 2.[html] view plain copy

 3.<view class="bottomViewItem">

 4.<view class="bottomMiddleHeaderView" bindtap="voteClick" data-id="value">

 5.<view class="bottomMiddleHeaderItem" animation="{{animationMiddleHeaderItem}}">

 6.<!-- 心跳 -->

 7.<view class="bottomMiddleHeaderItemSubView">

 8.<image src="/images/detail_vote_heart.png" style="width:32rpx; height:32rpx;" animation="{{animationMiddleHeaderItem}}"></image>

 9.</view>

 10.<!-- 投票文字 -->

 11.<view class="bottomMiddleHeaderItemSubView">投票</view>

 12.</view>

 13.</view>

 14.</view>


js文件中:

1.[javascript] view plain copy

 2.// 页面渲染完成

 3.onReady: function () {

 4.var circleCount = 0;

 5.// 心跳的外框动画

 6.this.animationMiddleHeaderItem = wx.createAnimation({

 7.duration:1000, // 以毫秒为单位

 8./**

 9.* http://cubic-bezier.com/#0,0,.58,1

 10* linear 动画一直较为均匀

 11.* ease 从匀速到加速在到匀速

 12.* ease-in 缓慢到匀速

 13.* ease-in-out 从缓慢到匀速再到缓慢

 14.*

 15.* http://www.tuicool.com/articles/neqMVr

 16.* step-start 动画一开始就跳到 100% 直到动画持续时间结束 一闪而过

 17.* step-end 保持 0% 的样式直到动画持续时间结束 一闪而过

 18.*/

 19.timingFunction: 'linear',

 20.delay: 100,

 21.transformOrigin: '50% 50%',

 22.success: function (res) {

 23.}

 24.});

 25.setInterval(function() {

 26.if (circleCount % 2 == 0) {

 27.this.animationMiddleHeaderItem.scale(1.15).step();

 28.} else {

 29.this.animationMiddleHeaderItem.scale(1.0).step();

 30.}

 31.this.setData({

 32.animationMiddleHeaderItem: this.animationMiddleHeaderItem.export()

 33.});

 34.circleCount++;

 35.if (circleCount == 1000) {

 36.circleCount = 0;

 37.}

 38.}.bind(this), 1000);

 39.},


2、微信显示倒计时

wxml文件中:

1.[html] view plain copy

 2.<!--倒计时 -->

 3.<view class="countDownTimeView countDownAllView" >

 4.<view class="voteText countDownTimeText">{{countDownDay}}</view>

 5.<view class="voteText countDownTimeText">{{countDownHour}}</view>

 6.<view class="voteText countDownTimeText">{{countDownMinute}}</view>

 7.<view class="voteText countDownTimeText">{{countDownSecond}}</view>

 8.</view>


js文件中:

1.[javascript] view plain copy

 2.Page( {

 3.data: {

 4.windowHeight: 654,

 5.maxtime: "",

 6.isHiddenLoading: true,

 7.isHiddenToast: true,

 8.dataList: {},

 9.countDownDay: 0,

 10.countDownHour: 0,

 11.countDownMinute: 0,

 12.countDownSecond: 0,

 13.},

 14.//事件处理函数

 15.bindViewTap: function() {

 16.wx.navigateTo( {

 17.url: '../logs/logs'

 18.})

 19.},

 20.onLoad: function() {

 21.this.setData( {

 22.windowHeight: wx.getStorageSync( 'windowHeight' )

 23.});

 24.},

 25.// 页面渲染完成后 调用

 26.onReady: function () {

 27.var totalSecond = 1505540080 - Date.parse(new Date())/1000;

 28.var interval = setInterval(function () {

 29.// 秒数

 30.var second = totalSecond;

 31.// 天数位

 32.var day = Math.floor(second / 3600 / 24);

 33.var dayStr = day.toString();

 34.if (dayStr.length == 1) dayStr = '0' + dayStr;

 35.// 小时位

 36.var hr = Math.floor((second - day * 3600 * 24) / 3600);

 37.var hrStr = hr.toString();

 38.if (hrStr.length == 1) hrStr = '0' + hrStr;

 39.// 分钟位

 40.var min = Math.floor((second - day * 3600 *24 - hr * 3600) / 60);

 41.var minStr = min.toString();

 42.if (minStr.length == 1) minStr = '0' + minStr;

 43.// 秒位

 44.var sec = second - day * 3600 * 24 - hr * 3600 - min*60;

 45.var secStr = sec.toString();

 46.if (secStr.length == 1) secStr = '0' + secStr;

 47.this.setData({

 48.countDownDay: dayStr,

 49.countDownHour: hrStr,

 50.countDownMinute: minStr,

 51.countDownSecond: secStr,

 52.});

 53.totalSecond--;

 54.if (totalSecond < 0) {

 55.clearInterval(interval);

 56.wx.showToast({

 57.title: '活动已结束',

 58.});

 59.this.setData({

 60.countDownDay: '00',

 61.countDownHour: '00',

 62.countDownMinute: '00',

 63.countDownSecond: '00',

 64.});

 65.}

 66.}.bind(this), 1000);

 67.},

 68.//cell事件处理函数

 69.bindCellViewTap: function (e) {

 70.var id = e.currentTarget.dataset.id;

 71.wx.navigateTo({

 72.url: '../babyDetail/babyDetail?id=' + id

 73.});

 74.}

 75.})


效果图:

【微信小程序开发教程】animation心跳动画

爱盈利(aiyingli.com)移动互联网最具影响力的盈利指导网站。定位于服务移动互联网创业者,移动盈利指导。我们的目标是让盈利目标清晰可见!降低门槛,让缺乏经验、资金有限的个人和团队获得经验和机会,提高热情,激发产品。

评论

相关文章推荐

SELECT dw_posts.ID,dw_posts.post_title,dw_posts.post_content FROM dw_posts INNER JOIN dw_term_relationships ON (dw_posts.ID = dw_term_relationships.object_id) WHERE 1=1 AND(dw_term_relationships.term_taxonomy_id = 3287 ) AND dw_posts.post_type = 'post' AND (dw_posts.post_status = 'publish') GROUP BY dw_posts.ID ORDER BY RAND() LIMIT 0, 6

京ICP备15063977号-2 © 2012-2018 aiyingli.com. All Rights Reserved. 京公网安备 11010102003938号