小程序——添加动画,让图标原地旋转

在这里插入图片描述
让更新资料旁边的图标在原地进行旋转

WXML文件

<view class="update" bindtap="upDate">
							更新资料
   <image class=" " animation='{{animationData}}' style="width:23rpx;height:23rpx; margin-left:5rpx;  margin-top:2rpx;"  src="http://dodui.oss-cn-shenzhen.aliyuncs.com/20201106RegDoduiDoshop_xcx/updata.png">
   </image>
 </view>

JS文件

//更新资料
  upDate: function () { 
    // 顺时针旋转实例
    var animation = wx.createAnimation({
      duration: 1000,
      timingFunction: 'ease'
    })
    // 逆时针旋转实例
    var animation1 = wx.createAnimation({
      duration: 10,
      timingFunction: 'ease'
    })

    animation.rotate(450).step()
    this.setData({
      animationData: animation.export()
    })
    setTimeout(function () {
      animation1.rotate(0).step()
      this.setData({
        animationData: animation1.export()
      })
    }.bind(this), 1300);

    getUserInfo().then(res => {
      console.log("个人资料: ", res)
      this.setData({
        userInfo: res.data,
      });
      wx.showToast({
        title: '更新成功',
        icon: 'success',
        duration: 1000,
        mask: true
      })
    });
  }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值