This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lastTime = 0; | |
var prefixes = 'webkit moz ms o'.split(' '); //各浏览器前缀 | |
var requestAnimationFrame = window.requestAnimationFrame; | |
var cancelAnimationFrame = window.cancelAnimationFrame; | |
var prefix; | |
//通过遍历各浏览器前缀,来得到requestAnimationFrame和cancelAnimationFrame在当前浏览器的实现形式 | |
for( var i = 0; i < prefixes.length; i++ ) { | |
if ( requestAnimationFrame && cancelAnimationFrame ) { |