欧美日韩国产一区,亚洲一区视频,色综合久久久久,私密按摩师舌头伸进去了,99re6这里只有精品,夜夜性日日交xxx性hd

動(dòng)畫API

本文編輯: Flyinthesky Flyinthesky瀏覽 7608 版權(quán)所有,嚴(yán)禁轉(zhuǎn)載

接口說(shuō)明:

動(dòng)畫類接口

接口 說(shuō)明
wx.createAnimation(OBJECT) 創(chuàng)建一個(gè)動(dòng)畫實(shí)例animation。調(diào)用實(shí)例的方法來(lái)描述動(dòng)畫。最后通過(guò)動(dòng)畫實(shí)例的export方法導(dǎo)出動(dòng)畫數(shù)據(jù)傳遞給組件的animation屬性。

注意: export 方法每次調(diào)用后會(huì)清掉之前的動(dòng)畫操作

接口用法:


【代碼】

wxml

<view class="container">
  <template is="header" data="{{title: 'createAnimation'}}"/>

  <view class="page-body">
    <view class="page-body-wrapper">
      <view class="animation-element-wrapper">
        <view class="animation-element" animation="{{animation}}"></view>
      </view>
      <view class="animation-buttons" scroll-y="true">
        <button class="animation-button" bindtap="rotate">旋轉(zhuǎn)</button>
        <button class="animation-button" bindtap="scale"> 縮放</button>
        <button class="animation-button" bindtap="translate">移動(dòng)</button>
        <button class="animation-button" bindtap="skew">傾斜</button>
        <button class="animation-button" bindtap="rotateAndScale">旋轉(zhuǎn)并縮放</button>
        <button class="animation-button" bindtap="rotateThenScale">旋轉(zhuǎn)后縮放</button>
        <button class="animation-button" bindtap="all">同時(shí)展示全部</button>
        <button class="animation-button" bindtap="allInQueue">順序展示全部</button>
        <button class="animation-button-reset" bindtap="reset">還原</button>
      </view>
    </view>
  </view>

  <template is="footer" />
</view>

js

Page({
  onReady: function () {
    this.animation = wx.createAnimation()

  },
  rotate: function () {
    this.animation.rotate(Math.random() * 720 - 360).step()
    this.setData({ animation: this.animation.export() })
  },
  scale: function () {
    this.animation.scale(Math.random() * 2).step()
    this.setData({ animation: this.animation.export() })
  },
  translate: function () {
    this.animation.translate(Math.random() * 100 - 50, Math.random() * 100 - 50).step()
    this.setData({ animation: this.animation.export() })
  },
  skew: function () {
    this.animation.skew(Math.random() * 90, Math.random() * 90).step()
    this.setData({ animation: this.animation.export() })
  },
  rotateAndScale: function () {
    this.animation.rotate(Math.random() * 720 - 360)
        .scale(Math.random() * 2)
        .step()
    this.setData({ animation: this.animation.export() })
  },
  rotateThenScale: function () {
    this.animation.rotate(Math.random() * 720 - 360).step()
        .scale(Math.random() * 2).step()
    this.setData({ animation: this.animation.export() })
  },
  all: function () {
    this.animation.rotate(Math.random() * 720 - 360)
        .scale(Math.random() * 2)
        .translate(Math.random() * 100 - 50, Math.random() * 100 - 50)
        .skew(Math.random() * 90, Math.random() * 90)
        .step()
    this.setData({ animation: this.animation.export() })
  },
  allInQueue: function () {
    this.animation.rotate(Math.random() * 720 - 360).step()
        .scale(Math.random() * 2).step()
        .translate(Math.random() * 100 - 50, Math.random() * 100 - 50).step()
        .skew(Math.random() * 90, Math.random() * 90).step()
    this.setData({ animation: this.animation.export() })
  },
  reset: function () {
    this.animation.rotate(0, 0)
                  .scale(1)
                  .translate(0, 0)
                  .skew(0, 0)
                  .step({ duration: 0 })
    this.setData({ animation: this.animation.export() })
  }
})

wxss

.page-body-wrapper {
  flex-grow: 1;
}
.animation-element-wrapper {
  display: block;
  margin-bottom: 100rpx;
}
.animation-element {
  width: 200rpx;
  height: 200rpx;
  background-color: #1AAD19;
}
.animation-buttons {
  padding: 50rpx 50rpx 10rpx;
  border-top: 1px solid #ccc;
  display: flex;
  flex-grow: 1;
  overflow-y: scroll;
  flex-direction: row;
  flex-wrap: wrap;
  width: 100%;
  height: 400rpx;
  box-sizing: border-box;
}
.animation-button {
  width: 290rpx;
  margin: 20rpx auto; 
}
.animation-button-reset {
  width: 610rpx;
  margin: 20rpx auto; 
}

主要方法:

wx.createAnimation(OBJECT):創(chuàng)建一個(gè)動(dòng)畫實(shí)例

OBJECT參數(shù)說(shuō)明:

參數(shù) 類型 必填 說(shuō)明
duration Integer 動(dòng)畫持續(xù)時(shí)間,單位ms,默認(rèn)值 400
timingFunction String 定義動(dòng)畫的效果,默認(rèn)值”linear”,有效值:”linear”,”ease”,”ease-in”,”ease-in-out”,”ease-out”,”step-start”,”step-end”
delay Integer 動(dòng)畫延遲時(shí)間,單位 ms,默認(rèn)值 0
transformOrigin String 設(shè)置transform-origin,默認(rèn)為”50% 50% 0”

示例代碼:

var animation = wx.createAnimation({
  transformOrigin: "50% 50%",
  duration: 1000,
  timingFunction: "ease",
  delay: 0
})

animation
動(dòng)畫實(shí)例可以調(diào)用以下方法來(lái)描述動(dòng)畫,調(diào)用結(jié)束后會(huì)返回自身,支持鏈?zhǔn)秸{(diào)用的寫法。

樣式:

方法 參數(shù) 說(shuō)明
opacity value 透明度,參數(shù)范圍 0~1
backgroundColor color 顏色值
width length 長(zhǎng)度值,如果傳入 Number 則默認(rèn)使用 px,可傳入其他自定義單位的長(zhǎng)度值
height length 長(zhǎng)度值,如果傳入 Number 則默認(rèn)使用 px,可傳入其他自定義單位的長(zhǎng)度值
top length 長(zhǎng)度值,如果傳入 Number 則默認(rèn)使用 px,可傳入其他自定義單位的長(zhǎng)度值
left length 長(zhǎng)度值,如果傳入 Number 則默認(rèn)使用 px,可傳入其他自定義單位的長(zhǎng)度值
bottom length 長(zhǎng)度值,如果傳入 Number 則默認(rèn)使用 px,可傳入其他自定義單位的長(zhǎng)度值
right length 長(zhǎng)度值,如果傳入 Number 則默認(rèn)使用 px,可傳入其他自定義單位的長(zhǎng)度值

旋轉(zhuǎn):

方法 參數(shù) 說(shuō)明
rotate deg deg的范圍-180~180,從原點(diǎn)順時(shí)針旋轉(zhuǎn)一個(gè)deg角度
rotateX deg deg的范圍-180~180,在X軸旋轉(zhuǎn)一個(gè)deg角度
rotateY deg deg的范圍-180~180,在Y軸旋轉(zhuǎn)一個(gè)deg角度
rotateZ deg deg的范圍-180~180,在Z軸旋轉(zhuǎn)一個(gè)deg角度
rotate3d (x,y,z,deg) 同transform-function rotate3d

縮放:

方法 參數(shù) 說(shuō)明
scale sx,[sy] 一個(gè)參數(shù)時(shí),表示在X軸、Y軸同時(shí)縮放sx倍數(shù);兩個(gè)參數(shù)時(shí)表示在X軸縮放sx倍數(shù),在Y軸縮放sy倍數(shù)
scaleX sx 在X軸縮放sx倍數(shù)
scaleY sy 在Y軸縮放sy倍數(shù)
scaleZ sz 在Z軸縮放sy倍數(shù)
scale3d (sx,sy,sz) 在X軸縮放sx倍數(shù),在Y軸縮放sy倍數(shù),在Z軸縮放sz倍數(shù)

偏移:

方法 參數(shù) 說(shuō)明
translate tx,[ty] 一個(gè)參數(shù)時(shí),表示在X軸偏移tx,單位px;兩個(gè)參數(shù)時(shí),表示在X軸偏移tx,在Y軸偏移ty,單位px。
translateX tx 在X軸偏移tx,單位px
translateY ty 在Y軸偏移tx,單位px
translateZ tz 在Z軸偏移tx,單位px
translate3d (tx,ty,tz) 在X軸偏移tx,在Y軸偏移ty,在Z軸偏移tz,單位px

傾斜:

方法 參數(shù) 說(shuō)明
skew ax,[ay] 參數(shù)范圍-180~180;一個(gè)參數(shù)時(shí),Y軸坐標(biāo)不變,X軸坐標(biāo)延順時(shí)針傾斜ax度;兩個(gè)參數(shù)時(shí),分別在X軸傾斜ax度,在Y軸傾斜ay度
skewX ax 參數(shù)范圍-180~180;Y軸坐標(biāo)不變,X軸坐標(biāo)延順時(shí)針傾斜ax度
skewY ay 參數(shù)范圍-180~180;X軸坐標(biāo)不變,Y軸坐標(biāo)延順時(shí)針傾斜ay度

矩陣變形:

方法 參數(shù) 說(shuō)明
matrix (a,b,c,d,tx,ty) 同transform-function matrix
matrix3d 同transform-function matrix3d

動(dòng)畫隊(duì)列
調(diào)用動(dòng)畫操作方法后要調(diào)用 step() 來(lái)表示一組動(dòng)畫完成,可以在一組動(dòng)畫中調(diào)用任意多個(gè)動(dòng)畫方法,一組動(dòng)畫中的所有動(dòng)畫會(huì)同時(shí)開(kāi)始,一組動(dòng)畫完成后才會(huì)進(jìn)行下一組動(dòng)畫。step 可以傳入一個(gè)跟 wx.createAnimation()一樣的配置參數(shù)用于指定當(dāng)前組動(dòng)畫的配置。
示例代碼:
wxml

<view animation="{{animationData}}" style="background:red;height:100rpx;width:100rpx"></view>

js

Page({
  data: {
    animationData: {}
  },
  onShow: function(){
    var animation = wx.createAnimation({
      duration: 1000,
        timingFunction: 'ease',
    })

    this.animation = animation

    animation.scale(2,2).rotate(45).step()

    this.setData({
      animationData:animation.export()
    })

    setTimeout(function() {
      animation.translate(30).step()
      this.setData({
        animationData:animation.export()
      })
    }.bind(this), 1000)
  },
  rotateAndScale: function () {
    // 旋轉(zhuǎn)同時(shí)放大
    this.animation.rotate(45).scale(2, 2).step()
    this.setData({
      animationData: this.animation.export()
    })
  },
  rotateThenScale: function () {
    // 先旋轉(zhuǎn)后放大
    this.animation.rotate(45).step()
    this.animation.scale(2, 2).step()
    this.setData({
      animationData: this.animation.export()
    })
  },
  rotateAndScaleThenTranslate: function () {
    // 先旋轉(zhuǎn)同時(shí)放大,然后平移
    this.animation.rotate(45).scale(2, 2).step()
    this.animation.translate(100, 100).step({ duration: 1000 })
    this.setData({
      animationData: this.animation.export()
    })
  }
})

bug & tip
1、bug: iOS/Android 6.3.30 通過(guò) step() 分隔動(dòng)畫,只有第一步動(dòng)畫能生效。

如有技術(shù)問(wèn)題或?qū)Ρ疚挠蟹答仯?qǐng)加入QQ群:
微信小程序?qū)崙?zhàn)5營(yíng): 微信小程序Club實(shí)戰(zhàn)5營(yíng)