微信小程序 实现视屏录制REC闪烁效果动画

在自定义组件中

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动画闪烁效果

微信官方文档—动画

在页面中的使用都是类似的

猜你喜欢

转载自blog.csdn.net/fangqi20170515/article/details/128142775
今日推荐