动画效果
发布于 6 年前 作者 xiuyinghe 8484 次浏览 来自 问答

在onshow里执行一系列动画,第一次执行完这个动画效果没问题,下一次在进入这个页面,动画效果有的时候只执行一些,有的不执行是什么情况

2 回复

getAnimation:function(){

var animationlf = wx.createAnimation({ //各种动画加载

duration: 800,

timingFunction: ‘ease’,

transformOrigin: ‘100% 0 0’

})

var animationrt = wx.createAnimation({

duration: 800,

timingFunction: ‘ease’,

transformOrigin: ‘0 0 0’

})

var animationlficon = wx.createAnimation({

duration: 500,

timingFunction: ‘ease’

})

var animationrticon = wx.createAnimation({

duration: 500,

timingFunction: ‘ease’

})

var animationdata = wx.createAnimation({

duration: 500,

timingFunction: ‘ease’

})

this.animationlf = animationlf

this.animationrt = animationrt

this.animationlficon = animationlficon

this.animationrticon = animationrticon

this.animationdata = animationdata

this.unBindAnimation();

console.log(“this.data.animationLf”, this.data.animationLf)

console.log(“this.data.animationLficon”, this.data.animationLficon)

setTimeout(function(){

animationlf.opacity(1).scale(1).step()

this.setData({

animationLf: animationlf.export()

})

// console.log(this.data.animationLf)

setTimeout(function () {

animationlficon.opacity(1).step()

animationdata.opacity(1).step()

animationrt.opacity(1).scale(1).step()

this.setData({

animationRt: animationrt.export(),

animationLficon: animationlficon.export(),

animationLfdata: animationdata.export()

})

setTimeout(function () {

animationrticon.opacity(1).step()

this.setData({

animationRticon: animationrticon.export(),

})

}.bind(this), 1000)

}.bind(this), 1000)

}.bind(this),100)

setTimeout(function () {

animationlficon.opacity(1).step()

this.setData({

animationImg: animationlficon.export()

})

}.bind(this), 2300)

},

unBindAnimation: function () {

var animationlf = wx.createAnimation({ //各种动画加载

duration: 10,

timingFunction: ‘ease’,

transformOrigin: ‘100% 0 0’

})

var animationrt = wx.createAnimation({ //各种动画加载

duration: 10,

timingFunction: ‘ease’,

transformOrigin: ‘0 0 0’

})

var animationlficon = wx.createAnimation({

duration: 10,

timingFunction: ‘ease’

})

var animationrticon = wx.createAnimation({

duration: 10,

timingFunction: ‘ease’

})

var animationdata = wx.createAnimation({

duration: 10,

timingFunction: ‘ease’

})

var animationimg = wx.createAnimation({

duration: 10,

timingFunction: ‘ease’

})

this.animationlf = animationlf

this.animationrt = animationrt

this.animationlficon = animationlficon

this.animationrticon = animationrticon

this.animationdata = animationdata

this.animationimg = animationimg

animationlf.opacity(0).scale(0).step()

animationrt.opacity(0).scale(0).step()

animationlficon.opacity(0).step()

animationrticon.opacity(0).step()

animationdata.opacity(0).step()

animationimg.opacity(0).step()

this.setData({

animationLf: animationlf.export(),

animationRt: animationrt.export(),

animationLficon: animationlficon.export(),

animationRticon: animationrticon.export(),

animationLfdata: animationdata.export(),

animationImg: animationimg.export()

})

},

是我写的太复杂了么

你好,请提供一下能复现问题的简单代码示例。

回到顶部