收藏
回答

wx.createAnimation不同步的问题?

问题描述:在执行了onShow里面的程序后,再执行go方法,旋转和下移动作是同步的。但是把onShow注释掉后,单独执行go方法,旋转和下移动作不同步,模拟器上会先执行下移动作,下移执行完成再执行rotate。请问怎么回事?? 谢谢


wxml文件

<view class="anbindtap="goanimation="{{ anmaitonData }}"></view>

wxss文件

.an{

    width: 50rpx;

    height: 50rpx;

    position: absolute;

    background: sandybrown;

}

js文件

Page({


    /**

     * 页面的初始数据

     */

    data: {

        anmaitonData:{}

    },


    go:function () {

        var animation=wx.createAnimation({

         duration:2000

        })

        

        animation.rotate(90).top(10).step()


        this.setData({

            anmaitonData:animation.export()

        })


    },

/**

     * 生命周期函数--监听页面显示

     */

    onShow: function () {

        var animation = wx.createAnimation({

            duration: 2000,

            timingFunction: 'ease',

          })

      

         animation.scale(2,2).rotate(45).step()

      

          this.setData({

            anmaitonData:animation.export()

          })

}

)}

最后一次编辑于  2022-04-27
回答关注问题邀请回答
收藏

1 个回答

  • Demons
    Demons
    2022-04-27

    请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

    2022-04-27
    有用
    回复 1
登录 后发表内容