requestAnimFrame() shim.
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
// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
// shim layer with setTimeout fallback | |
(function(){ | |
window.requestAnimFrame = (function(){ | |
return window.requestAnimationFrame || | |
window.webkitRequestAnimationFrame || | |
window.mozRequestAnimationFrame || | |
window.oRequestAnimationFrame || | |
window.msRequestAnimationFrame || | |
function(callback, element){ | |
return window.setTimeout(function(){ | |
callback(+new Date); | |
}, 1000 / 60); | |
}; | |
})(); | |
window.cancelRequestAnimFrame = (function() { | |
return window.cancelAnimationFrame || | |
window.webkitCancelRequestAnimationFrame || | |
window.mozCancelRequestAnimationFrame || | |
window.oCancelRequestAnimationFrame || | |
window.msCancelRequestAnimationFrame || | |
clearTimeout | |
})(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment