diff --git a/docs/RequestAnimationFrame.js b/docs/RequestAnimationFrame.js new file mode 100644 index 0000000..77f85c5 --- /dev/null +++ b/docs/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 ); + + }; + + } )(); + +} diff --git a/demo/assets/arrow.png b/docs/assets/arrow.png similarity index 100% rename from demo/assets/arrow.png rename to docs/assets/arrow.png diff --git a/demo/assets/favicon.ai b/docs/assets/favicon.ai similarity index 100% rename from demo/assets/favicon.ai rename to docs/assets/favicon.ai diff --git a/demo/assets/favicon.png b/docs/assets/favicon.png similarity index 100% rename from demo/assets/favicon.png rename to docs/assets/favicon.png diff --git a/demo/assets/itgivesyouthis.jpg b/docs/assets/itgivesyouthis.jpg similarity index 100% rename from demo/assets/itgivesyouthis.jpg rename to docs/assets/itgivesyouthis.jpg diff --git a/demo/assets/profile.png b/docs/assets/profile.png similarity index 100% rename from demo/assets/profile.png rename to docs/assets/profile.png diff --git a/demo/demo.js b/docs/demo.js similarity index 99% rename from demo/demo.js rename to docs/demo.js index 08a59fa..b1b21b0 100644 --- a/demo/demo.js +++ b/docs/demo.js @@ -148,6 +148,9 @@ function FizzyText(message) { this.message = message; var loop = function() { + + requestAnimationFrame(loop); + // Don't render if we don't see it. // Would be cleaner if I dynamically acquired the top of the canvas. if (document.body.scrollTop < height + 20) { @@ -156,7 +159,7 @@ function FizzyText(message) { } // This calls the render function every 30 milliseconds. - setInterval(loop, frameTime); + loop(); // This class is responsible for drawing and moving those little // colored dots. diff --git a/demo/demo.css b/docs/docs.css similarity index 100% rename from demo/demo.css rename to docs/docs.css diff --git a/demo/improvedNoise.js b/docs/improvedNoise.js similarity index 100% rename from demo/improvedNoise.js rename to docs/improvedNoise.js diff --git a/demo/prettify.js b/docs/prettify.js similarity index 100% rename from demo/prettify.js rename to docs/prettify.js diff --git a/index.html b/index.html index e577479..2cd37fd 100644 --- a/index.html +++ b/index.html @@ -4,8 +4,8 @@ dat.gui - - + + @@ -24,9 +24,10 @@ - - - + + + +