
js
let animationShowHeight = 300;
Page({
/**
* 页面的初始数据
*/
data: {
animation: ''
},
// 下来
btnClick: function () {
var animation = wx.createAnimation({
transformOrigin: "50% 50%",
duration: 1000,
timingFunction: "ease",
delay: 0
})
this.animation = animation
animation.translateY(animationShowHeight).step()
this.setData({
animation: animation.export(),
})
},
// 上去
btnClickTo: function () {
var animation = wx.createAnimation({
transformOrigin: "50% 50%",
duration: 1000,
timingFunction: "ease",
delay: 0
})
this.animation = animation
animation.translateY(0).step()
this.setData({
animation: animation.export(),
})
}
})
wxml
<button type="primary" bindtap="btnClick"> 点我下去 </button>
<button type="primary" bindtap="btnClickTo"> 点我回去 </button>
<view class="body-view" animation="{{animation}}">
<view>我一会就出来吓死你</view>
<view>我一会就出来吓死你</view>
<view>我一会就出来吓死你</view>
</view>
clj2nw
大佬 默认隐藏,展开显示的呢?就和jq slidedoen slideup效果一样的
加个overflow:hidden就可以了吧
大佬开始搞小程序了啊,赞!
低调低调~ 生活所迫