小程序环形动画效果
点击的时候按照设定的角度进行旋转。
具体代码如下:

<view class='time' bindtap='leftStart'>
  <view class='big-circle red first'></view>
  <view class='big-circle green right first'  animation='{{leftAnimationData}}'></view>
  <view class='circle yellow first'></view>
</view>
/**index.wxss**/
.time{
  height: 180px;
  margin-top: 20px;
}
.big-circle{
  width: 150px;
  height: 150px;
  position: absolute;
  border-radius: 50%;
}
.red{
  background: red;
}
.green{
  background: green;
}
.yellow{
  background: yellow;
}
.circle{
  position: absolute;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  margin: 10px 0 0 10px;
}
.first{
  left: 50rpx;
}
.right{
  clip: rect(0,auto,auto,75px);
}
//index.js
Page({
  leftMove:0,
  data: {
    leftAnimationData:{}
  },
  leftStart:function(){
    var animation=wx.createAnimation({
      duration:1000,
      timingFunction:"linear",
      delay:0
    })
    // this.animation = animation;
    animation.rotate(this.leftMove +=100).step();
    this.setData({ leftAnimationData: animation.export()});
  }
})

欢迎大家指导交流~

相关文章: