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

小程序?qū)崿F(xiàn)抽獎動畫

 更新時間:2020年04月16日 15:28:30   作者:qiphon3650  
這篇文章主要為大家詳細(xì)介紹了小程序?qū)崿F(xiàn)抽獎動畫,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了小程序?qū)崿F(xiàn)抽獎動畫展示的具體代碼,供大家參考,具體內(nèi)容如下

所有的抽獎都是由后臺計算后得到的,前臺只做動畫展示

<view class='top-banner center'> <!-- 輪播展示中獎信息區(qū)域 -->
 <swiper autoplay="{{true}}" interval="{{1500}}" circular="{{true}}" vertical='{{true}}'>
  <block wx:for="{{prizeInfo}}" wx:key="index">
   <swiper-item>
    <view>{{item.name}}{{item.prize}}</view>
   </swiper-item>
  </block>
 </swiper>
</view>
<!-- 輪播結(jié)束 抽獎轉(zhuǎn)盤 -->
<view class='turntable' bindtap='doLottery'>
 <image class='turntable-bj' style="transition:all {{time?time:'3s ease-in'}}; transform:rotate({{transformDeg + 'deg'}}) " src='../../../img/turntable.png'></image>
 <image class='arrow' src='../../../img/arrow.png'>
 </image>
</view>

js:

const app = getApp();

var index = {
 data:{ 
  prizeInfo:[
   {
    name:'qiphon',
    prize:'5元'
   },
   {
    name:'qiphon23423',
    prize:'53元'
   },
   {
    name:'qipsdfhon',
    prize:'35元'
   }
  ],
  transformDeg:0, // 旋轉(zhuǎn)角度
  transition:'all 3s cubic-bezier(0.005, 1.340, 1.000, 0.865)',
  time:'999s'
 },
 onLoad(opt){
  console.log(opt)

 },
 onReady(){
  this.animation = wx.createAnimation({
   timingFunction:'esse-in-out',
   duration:2000
  });
  this.animationDeg = 360;
 },
 loadCoupons(){ // 加載獲獎信息
  
 },
 doLottery(){ // 抽獎
  var _this = this;
  if(this.aniRotate)return;
  this.aniRotate = true;
  this.setData({
   transformDeg:this.data.transformDeg + 360*900,
   time:'100s ease'
  })
  setTimeout(function(){
   console.log('請求完成'+_this.data.transformDeg) // setTimeout 模擬ajax請求
   _this.setData({
    transformDeg:-360*4,
    time:'3s ease'
   })
   setTimeout(function(){
    console.log('返回結(jié)果'+_this.data.transformDeg)
    _this.setData({
     transformDeg:360*2 + 0,
     time:'6s cubic-bezier(0.000, 0.765, 0.000, 0.955)'
    })
    setTimeout(function(){
     _this.aniRotate = false;
     wx.showModal({
      title:'中獎信息',
      content:'恭喜獲得獎品'
     })
    },6000)
   },2000)
  },3000)
 },
}
Page(index);

css:

.top-banner{
 background: #fff;
 padding:20rpx;
}
.top-banner swiper{
 height: 50rpx;
 line-height: 50rpx;
}
/* 轉(zhuǎn)盤 */
.turntable{
 position: relative;
 width: 100%;
 height: 530rpx;
}
.turntable-bj{
 display: block;
 margin:0 auto;
 width:600rpx;
 height: 530rpx;
}
.turntable .arrow{
 position: absolute;
 top:0;
 right:0;
 left:0;
 bottom:110rpx;
 margin:auto;
 width:93.5rpx;
 height: 212rpx;
}

想要學(xué)習(xí)更多關(guān)于抽獎功能的實現(xiàn),請參考此專題:抽獎功能

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

相關(guān)文章

最新評論

肇东市| 洪湖市| 林周县| 竹山县| 临清市| 忻城县| 共和县| 中阳县| 奉新县| 四川省| 屏山县| 克拉玛依市| 玛纳斯县| 鄂伦春自治旗| 盐山县| 惠安县| 开化县| 东至县| 鄱阳县| 宜城市| 抚州市| 疏附县| 峨眉山市| 施秉县| 雷州市| 樟树市| 曲松县| 平武县| 虞城县| 新巴尔虎右旗| 青阳县| 东莞市| 杭州市| 中卫市| 阿拉善盟| 敦煌市| 新乡市| 娄烦县| 康定县| 温州市| 淄博市|