微信小程序中创建动画

创建动画实例

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万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章