html52.com
我爱小程序-开发者交流社区

animation

问题模块 框架类型 API/组件名称 终端类型 操作系统 微信版本 基础库版本
API和组件 小程序 animation 6 1.99

微信小程序,一个view上只能加一个animation,这就导致了很难做人工可干预的多段动画。比如:点击第一次放大,点击第二次缩小。这种效果实现起来很麻烦,最近我找到一个方法,就是叠加,代码如下:


showCard: function() {

var that = this;

let animationDuring = 200;

let animation = wx.createAnimation({

duration: animationDuring,

timingFunction: 'linear'

})

animation.width(100).height(100).step()

this.setData({

showAnimation: animation.export()

})

},


hideCard: function() {

let animationDuring = 200;

let animation = wx.createAnimation({

duration: animationDuring,

timingFunction: 'linear'

})

animation.width(100).height(100).width(0).height(0).step()

console.log(animation)

this.setData({

showAnimation: animation.export()

})

}


但这种方法感觉很不爽,跟iOS的动画代码比起来,差太多,大家有更好的方式么?请教。


另外,animationend事件为啥不执行?


评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付