其他分享
首页 > 其他分享> > canvas动画

canvas动画

作者:互联网

    // 兼容性处理
window.requestAnimFrame = (function() {
    return window.requestAnimationFrame ||
        window.webkitRequestAnimationFrame ||
        window.mozRequestAnimationFrame ||
        window.oRequestAnimationFrame ||
        window.msRequestAnimationFrame ||
        function(callback, element) {
            window.setTimeout(callback, 1000 / 60)
        }

}());

    // 保留一段时间的特效
    context.globalCompositeOperation = 'destination-out';
    context.fillStyle = 'rgba(0, 0, 0, 0.5)';
    context.fillRect( 0, 0, cw, ch );
    context.globalCompositeOperation = 'lighter';
View Code

 

标签:function,动画,canvas,globalCompositeOperation,fillStyle,callback,window,context
来源: https://www.cnblogs.com/tujw/p/10507025.html