UNPKG

873 BJavaScriptView Raw
1// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
2// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
3// https://gist.github.com/1579671
4
5// requestAnimationFrame polyfill by Erik Möller
6// fixes from Paul Irish and Tino Zijdel
7(function(){var b=0;var c=["ms","moz","webkit","o"];for(var a=0;a<c.length&&!window.requestAnimationFrame;++a){window.requestAnimationFrame=window[c[a]+"RequestAnimationFrame"];
8window.cancelAnimationFrame=window[c[a]+"CancelAnimationFrame"]||window[c[a]+"CancelRequestAnimationFrame"];}if(!window.requestAnimationFrame){window.requestAnimationFrame=function(h,e){var d=new Date().getTime();
9var f=Math.max(0,16-(d-b));var g=window.setTimeout(function(){h(d+f);},f);b=d+f;return g;};}if(!window.cancelAnimationFrame){window.cancelAnimationFrame=function(d){clearTimeout(d);
10};}}());
\No newline at end of file