国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

微信小程式開發(fā)文檔 / 微信小程序API 動(dòng)畫

微信小程序API 動(dòng)畫

wx.createAnimation(OBJECT)


創(chuàng)建一個(gè)動(dòng)畫實(shí)例animation。調(diào)用實(shí)例的方法來描述動(dòng)畫。最后通過動(dòng)畫實(shí)例的export方法導(dǎo)出動(dòng)畫數(shù)據(jù)傳遞給組件的animation屬性。

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

OBJECT參數(shù)說明:

QQ截圖20170208132508.png

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

animation


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

樣式:

QQ截圖20170208132521.png

旋轉(zhuǎn):

QQ截圖20170208132533.png

縮放:

QQ截圖20170208132545.png

偏移:

QQ截圖20170208132556.png

傾斜:

QQ截圖20170208132607.png

矩陣變形:

QQ截圖20170208132621.png

動(dòng)畫隊(duì)列


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

示例:

<view animation="{{animationData}}"></view>
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:animation.export()
    })
  },
  rotateThenScale: function () {
    // 先旋轉(zhuǎn)后放大
    this.animation.rotate(45).step()
    this.animation.scale(2, 2).step()
    this.setData({
      animationData: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:animation.export()
    })
  }
})