创建动画实例
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>