国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

微信小程序實現彈出菜單動畫

2019-11-19 11:17:48
字體:
來源:轉載
供稿:網友

微信小程序動畫之彈出菜單,供大家參考,具體內容如下

效果圖

js:

Page({ data: {  isPopping: false,  animPlus: {},  animCollect: {},  animTranspond: {},  animInput: {},  animCloud:{},  aninWrite:{}, }, //點擊彈出 plus: function () {  if (this.data.isPopping) {   //縮回動畫   this.popp();   this.setData({    isPopping: false   })  } else if (!this.data.isPopping) {   //彈出動畫   this.takeback();   this.setData({    isPopping: true   })  } }, input: function () {  console.log("input") }, transpond: function () {  console.log("transpond") }, collect: function () {  console.log("collect") }, cloud:function(){  console.log("cloud") }, write: function () {  console.log("cloud") }, //彈出動畫 popp: function () {  //plus順時針旋轉  var animationPlus = wx.createAnimation({   duration: 400,   timingFunction: 'ease-out'  })  var animationcollect = wx.createAnimation({   duration: 400,   timingFunction: 'ease-out'  })  var animationTranspond = wx.createAnimation({   duration: 400,   timingFunction: 'ease-out'  })  var animationInput = wx.createAnimation({   duration: 400,   timingFunction: 'ease-out'  })  var animationCloud = wx.createAnimation({   duration: 400,   timingFunction: 'ease-out'  })  var animationWrite = wx.createAnimation({   duration: 400,   timingFunction: 'ease-out'  })  animationPlus.rotateZ(180).step();  animationcollect.translate(-90, -100).rotateZ(180).opacity(1).step();  animationTranspond.translate(-140, 0).rotateZ(180).opacity(1).step();  animationInput.translate(-90, 100).rotateZ(180).opacity(1).step();  animationCloud.translate(0, 135).rotateZ(180).opacity(1).step();  animationWrite.translate(0, -135).rotateZ(180).opacity(1).step();  this.setData({   animPlus: animationPlus.export(),   animCollect: animationcollect.export(),   animTranspond: animationTranspond.export(),   animInput: animationInput.export(),   animCloud: animationCloud.export(),   animWrite: animationWrite.export(),  }) }, //收回動畫 takeback: function () {  //plus逆時針旋轉  var animationPlus = wx.createAnimation({   duration: 400,   timingFunction: 'ease-out'  })  var animationcollect = wx.createAnimation({   duration: 400,   timingFunction: 'ease-out'  })  var animationTranspond = wx.createAnimation({   duration: 400,   timingFunction: 'ease-out'  })  var animationInput = wx.createAnimation({   duration: 400,   timingFunction: 'ease-out'  })  var animationCloud = wx.createAnimation({   duration: 400,   timingFunction: 'ease-out'  })  var animationWrite = wx.createAnimation({   duration: 400,   timingFunction: 'ease-out'  })  animationPlus.rotateZ(0).step();  animationcollect.translate(0, 0).rotateZ(0).opacity(0).step();  animationTranspond.translate(0, 0).rotateZ(0).opacity(0).step();  animationInput.translate(0, 0).rotateZ(0).opacity(0).step();  animationCloud.translate(0, 0).rotateZ(0).opacity(0).step();  animationWrite.translate(0, 0).rotateZ(0).opacity(0).step();  this.setData({   animPlus: animationPlus.export(),   animCollect: animationcollect.export(),   animTranspond: animationTranspond.export(),   animInput: animationInput.export(),   animCloud: animationCloud.export(),   animWrite: animationWrite.export(),  }) }, onLoad: function (options) {  // 生命周期函數--監聽頁面加載 }, onReady: function () {  // 生命周期函數--監聽頁面初次渲染完成 }, onShow: function () {  // 生命周期函數--監聽頁面顯示 }, onHide: function () {  // 生命周期函數--監聽頁面隱藏 }, onUnload: function () {  // 生命周期函數--監聽頁面卸載 }, onPullDownRefresh: function () {  // 頁面相關事件處理函數--監聽用戶下拉動作 }, onReachBottom: function () {  // 頁面上拉觸底事件的處理函數 }, onShareAppMessage: function () {  // 用戶點擊右上角分享  return {   title: 'title', // 分享標題   desc: 'desc', // 分享描述   path: 'path' // 分享路徑  } }})

wxml:

<view> <image src="../../image/1.png" class="img-style" animation="{{animWrite}}" bindtap="write"></image> <image src="../../image/4.png" class="img-style" animation="{{animCollect}}" bindtap="collect"></image> <image src="../../image/2.png" class="img-style" animation="{{animTranspond}}" bindtap="transpond"></image> <image src="../../image/3.png" class="img-style" animation="{{animInput}}" bindtap="input"></image> <image src="../../image/5.png" class="img-style" animation="{{animCloud}}" bindtap="cloud"></image> <image src="../../image/6.png" class="img-switch-style" animation="{{animPlus}}" bindtap="plus"></image></view>

wxss:

.img-switch-style { height: 120rpx; width: 120rpx; position: absolute; bottom: 250rpx; right: 100rpx; z-index: 100;} .img-style { height: 120rpx; width: 120rpx; position: absolute; bottom: 250rpx; right: 100rpx; opacity: 0;}

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 志丹县| 怀集县| 星子县| 肇庆市| 栾城县| 宣汉县| 奇台县| 宁城县| 腾冲县| 巴林左旗| 克山县| 富平县| 东平县| 岐山县| 台湾省| 大同县| 黄冈市| 公主岭市| 三穗县| 绍兴市| 利川市| 尖扎县| 仁化县| 阿克| 九龙坡区| 西昌市| 安溪县| 读书| 海安县| 甘南县| 灌云县| 东源县| 康定县| 资源县| 南召县| 唐海县| 申扎县| 泽州县| 武平县| 新乡县| 南江县|