Skip to content

Instantly share code, notes, and snippets.

@ahliang85
ahliang85 / rAF-2.js
Last active December 19, 2015 13:48 — forked from paulirish/rAF.js
Javascript - requestAnimationFrame
// shim layer with setTimeout fallback
window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function( callback ){
window.setTimeout(callback, 1000 / 60);
};
})();