首页 > 代码库 > requestAnimationFrame

requestAnimationFrame

requestAnimationFrame是实现如“最优帧速率”、“选择绘制下一帧的最佳时机”的功能,它的兼容性写法:

var rAF = window.requestAnimationFrame    ||
    window.webkitRequestAnimationFrame    ||
    window.mozRequestAnimationFrame        ||
    window.oRequestAnimationFrame        ||
    window.msRequestAnimationFrame        ||
    function (callback) { window.setTimeout(callback, 1000 / 60); };

 

requestAnimationFrame