summaryrefslogtreecommitdiff
path: root/js/RequestAnimationFrame.js
diff options
context:
space:
mode:
authoryo mama <pepper@scannerjammer.com>2015-02-12 18:29:27 -0800
committeryo mama <pepper@scannerjammer.com>2015-02-12 18:29:27 -0800
commitae0e6d987781d2fbf225611e2f8df37380a2bbcd (patch)
tree0c19a2a320588c7852bc8cdbff5da40624475b71 /js/RequestAnimationFrame.js
first
Diffstat (limited to 'js/RequestAnimationFrame.js')
-rw-r--r--js/RequestAnimationFrame.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/js/RequestAnimationFrame.js b/js/RequestAnimationFrame.js
new file mode 100644
index 0000000..77f85c5
--- /dev/null
+++ b/js/RequestAnimationFrame.js
@@ -0,0 +1,22 @@
+/**
+ * Provides requestAnimationFrame in a cross browser way.
+ * http://paulirish.com/2011/requestanimationframe-for-smart-animating/
+ */
+
+if ( !window.requestAnimationFrame ) {
+
+ window.requestAnimationFrame = ( function() {
+
+ return window.webkitRequestAnimationFrame ||
+ window.mozRequestAnimationFrame ||
+ window.oRequestAnimationFrame ||
+ window.msRequestAnimationFrame ||
+ function( /* function FrameRequestCallback */ callback, /* DOMElement Element */ element ) {
+
+ window.setTimeout( callback, 1000 / 60 );
+
+ };
+
+ } )();
+
+}