微信小程序中創建動畫

創建動畫實例

let animation = wx.createAnimation({

duration: 100,

timingFunction: "ease",

delay: 0,

});

調用animation實例方法來描述動畫

animation.height(this.data.mapHeight - disY).step();

最後通過動畫實例export()方法導出動畫數據傳遞給組件

that.setData({

scrollHeight: moveheight,

mapHeight: this.data.mapHeight - disY,

slideAnimation: animation.export(),

curloacTop,

setCenterTop

});

在頁面上引用該動畫:

<map id="myMap" longitude="{{centerLongitude}}" subkey="BSOBZ-B4A6G-ZETQM-IWSTC-GXMZF-PZFY5" latitude="{{centerLatitude}}" scale="{{scale}}" controls="{{controls}}" markers="{{markers}}" bindcontroltap="controltap" bindregiοnchange="getCenterLocations"bindmarkertap="markertap" show-location style="width: 100%; height:{{mapHeight}}px;" bindupdated="mapload" animation="{{slideAnimation}}">

</map>

發佈了30 篇原創文章 · 獲贊 7 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章