創建動畫實例
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>