Skip to content

Instantly share code, notes, and snippets.

@gregorynicholas
Created January 14, 2012 20:16
Show Gist options
  • Save gregorynicholas/1612735 to your computer and use it in GitHub Desktop.
Save gregorynicholas/1612735 to your computer and use it in GitHub Desktop.
window.requestAnimFrame - detect framerate from browser objects, with fallback to timer
window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(/* function */ callback, /* DOMElement */ element){
window.setTimeout(callback, 1000 / 60);
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment