在自定义组件中
data: {
animationData: {}
},
created() {
let animation = wx.createAnimation({
duration: 500,
// delay: 1000,
timingFunction: 'ease'
});
this.animation = animation;
let next = true;
timer = setInterval(function () {
if (next) {
this.animation.opacity(0.2).step();
next = !next;
} else {
this.animation.opacity(1).step()
next = !next;
}
this.setData({
animationData: animation.export()
})
}.bind(this), 500)
}
<view animation="{{animationData}}">
<view class="rec_radius"></view>
<text class="small">REC</text>
</view>
REC动画闪烁效果
在页面中的使用都是类似的