Permalink
Browse files

Animation Frame JS File Added

  • Loading branch information...
1 parent 8dbd279 commit 8b4583fe287d15d3790010244bd3a675b2a1197d @donatj committed Mar 16, 2012
Showing with 37 additions and 0 deletions.
  1. +37 −0 animationFrame.js
View
@@ -0,0 +1,37 @@
+if ( !window.requestAnimationFrame ) {
+
+ window.requestAnimationFrame = ( function() {
+
+ return window.webkitRequestAnimationFrame ||
+ window.mozRequestAnimationFrame || // comment out if FF4 is slow (it caps framerate at ~30fps: https://bugzilla.mozilla.org/show_bug.cgi?id=630127)
+ window.oRequestAnimationFrame ||
+ window.msRequestAnimationFrame ||
+ function(
+ /* function FrameRequestCallback */ callback,
+ /* DOMElement Element */ element ) {
+ window.setTimeout( callback, 1000 / 60 );
+
+ };
+
+ } )();
+
+}
+
+if ( !window.cancelRequestAnimationFrame ) {
+
+ window.cancelRequestAnimationFrame = ( function() {
+
+ return window.webkitRequestAnimationFrame ||
+ window.mozRequestAnimationFrame || // comment out if FF4 is slow (it caps framerate at ~30fps: https://bugzilla.mozilla.org/show_bug.cgi?id=630127)
+ window.oRequestAnimationFrame ||
+ window.msRequestAnimationFrame ||
+ function(
+ /* function FrameRequestCallback */ callback,
+ /* DOMElement Element */ element ) {
+ window.setTimeout( callback, 1000 / 60 );
+
+ };
+
+ } )();
+
+}

0 comments on commit 8b4583f

Please sign in to comment.