兼容封装requestAnimFrame

2019-11-16 张宇童 学习日志

没有啥好解释的直接复制用就可以了

window.requestAnimFrame = (function(){
    return window.requestAnimationFrame ||
        window.webkitRequestAnimationFrame ||
        window.mozRequestAnimationFrame ||
        window.oRequestAnimationFrame ||
        window.msRequestAnimationFrame ||
        function( callback ){
            window.setTimeout(callback, 1000 / 60);//定义每秒执行60次动画
        };
})();

标签: javascript ES6

发表评论:

Powered by emlog