Skip to content

Instantly share code, notes, and snippets.

@gerred
Created February 5, 2012 04:18
Show Gist options
  • Save gerred/1742637 to your computer and use it in GitHub Desktop.
Save gerred/1742637 to your computer and use it in GitHub Desktop.
My window.requestAnimationFrame shim
if (!window.requestAnimationFrame) {
window.requestAnimationFrame = (window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function (callback) {
return window.setTimeout(callback, 1000/60);
});
}
if (!window.cancelRequestAnimationFrame) {
window.cancelRequestAnimationFrame = (window.cancelAnimationFrame ||
window.webkitCancelRequestAnimationFrame ||
window.mozCancelRequestAnimationFrame ||
window.oCancelRequestAnimationFrame ||
window.msCancelRequestAnimationFrame ||
window.clearTimeout);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment