diff --git a/examples/Animated/AnimatedStar.html b/examples/Animated/AnimatedStar.html index b42a79fd..264f6c37 100644 --- a/examples/Animated/AnimatedStar.html +++ b/examples/Animated/AnimatedStar.html @@ -52,5 +52,5 @@ - + \ No newline at end of file diff --git a/examples/Animated/Extruded.html b/examples/Animated/Extruded.html index d681d62c..456fe092 100644 --- a/examples/Animated/Extruded.html +++ b/examples/Animated/Extruded.html @@ -70,5 +70,5 @@ - + \ No newline at end of file diff --git a/examples/Animated/Flock.html b/examples/Animated/Flock.html index 5bb9471c..d61a230c 100644 --- a/examples/Animated/Flock.html +++ b/examples/Animated/Flock.html @@ -300,5 +300,5 @@ - + \ No newline at end of file diff --git a/examples/Animated/Lines.html b/examples/Animated/Lines.html index 52c83f9b..a2f43068 100644 --- a/examples/Animated/Lines.html +++ b/examples/Animated/Lines.html @@ -47,5 +47,5 @@ - + \ No newline at end of file diff --git a/examples/Animated/RadialRainbows.html b/examples/Animated/RadialRainbows.html index 03618d92..c3e0feca 100644 --- a/examples/Animated/RadialRainbows.html +++ b/examples/Animated/RadialRainbows.html @@ -78,5 +78,5 @@ - + \ No newline at end of file diff --git a/examples/Animated/Raster.html b/examples/Animated/Raster.html index cd114dff..a300c713 100644 --- a/examples/Animated/Raster.html +++ b/examples/Animated/Raster.html @@ -24,6 +24,6 @@ - - + + \ No newline at end of file diff --git a/examples/Animated/RoundedRectangles.html b/examples/Animated/RoundedRectangles.html index b96e8991..a1de6313 100644 --- a/examples/Animated/RoundedRectangles.html +++ b/examples/Animated/RoundedRectangles.html @@ -44,5 +44,5 @@ - + \ No newline at end of file diff --git a/examples/Animated/Smoothing.html b/examples/Animated/Smoothing.html index 51d5fcb7..efdd130b 100644 --- a/examples/Animated/Smoothing.html +++ b/examples/Animated/Smoothing.html @@ -71,5 +71,5 @@ - + \ No newline at end of file diff --git a/examples/Scripts/Arcs.html b/examples/Scripts/Arcs.html index eb99f5f7..aa5d1da4 100644 --- a/examples/Scripts/Arcs.html +++ b/examples/Scripts/Arcs.html @@ -27,5 +27,5 @@ - + \ No newline at end of file diff --git a/examples/Scripts/BouncingBalls.html b/examples/Scripts/BouncingBalls.html index 1ce74ab8..e19637e1 100644 --- a/examples/Scripts/BouncingBalls.html +++ b/examples/Scripts/BouncingBalls.html @@ -82,5 +82,5 @@

Click to add circles:

- + \ No newline at end of file diff --git a/examples/Scripts/Chain.html b/examples/Scripts/Chain.html index 32c783e3..c73b1a33 100644 --- a/examples/Scripts/Chain.html +++ b/examples/Scripts/Chain.html @@ -42,5 +42,5 @@ - + \ No newline at end of file diff --git a/examples/Scripts/Circle.html b/examples/Scripts/Circle.html index 21505384..99005d3d 100644 --- a/examples/Scripts/Circle.html +++ b/examples/Scripts/Circle.html @@ -15,5 +15,5 @@ - + \ No newline at end of file diff --git a/examples/Scripts/CurveTimeParametrization.html b/examples/Scripts/CurveTimeParametrization.html index c5680c45..230f5239 100644 --- a/examples/Scripts/CurveTimeParametrization.html +++ b/examples/Scripts/CurveTimeParametrization.html @@ -43,5 +43,5 @@ - + \ No newline at end of file diff --git a/examples/Scripts/Letter.html b/examples/Scripts/Letter.html index 5b9364b6..bdb7ab6a 100644 --- a/examples/Scripts/Letter.html +++ b/examples/Scripts/Letter.html @@ -29,5 +29,5 @@ - + \ No newline at end of file diff --git a/examples/Scripts/RotationRaster.html b/examples/Scripts/RotationRaster.html index fca7ff49..596fe7b2 100644 --- a/examples/Scripts/RotationRaster.html +++ b/examples/Scripts/RotationRaster.html @@ -39,6 +39,6 @@ - - + + \ No newline at end of file diff --git a/examples/Scripts/RoundRectangle.html b/examples/Scripts/RoundRectangle.html index 52f3900b..6acfecee 100644 --- a/examples/Scripts/RoundRectangle.html +++ b/examples/Scripts/RoundRectangle.html @@ -23,5 +23,5 @@ - + \ No newline at end of file diff --git a/examples/Scripts/StrokeBounds.html b/examples/Scripts/StrokeBounds.html index 508e5a0a..3a11a1e0 100644 --- a/examples/Scripts/StrokeBounds.html +++ b/examples/Scripts/StrokeBounds.html @@ -92,5 +92,5 @@ - + \ No newline at end of file diff --git a/examples/Tools/BezierTool.html b/examples/Tools/BezierTool.html index 056a763a..5a9ea4bd 100644 --- a/examples/Tools/BezierTool.html +++ b/examples/Tools/BezierTool.html @@ -81,5 +81,5 @@ Drag segment handles and points to manipulate them. Close the path to start a new one.

- + \ No newline at end of file diff --git a/examples/Tools/Circles.html b/examples/Tools/Circles.html index 787cc4b7..464e83a8 100644 --- a/examples/Tools/Circles.html +++ b/examples/Tools/Circles.html @@ -26,5 +26,5 @@ - + \ No newline at end of file diff --git a/examples/Tools/Clouds.html b/examples/Tools/Clouds.html index 875fce6f..37657ba3 100644 --- a/examples/Tools/Clouds.html +++ b/examples/Tools/Clouds.html @@ -31,5 +31,5 @@ - + \ No newline at end of file diff --git a/examples/Tools/Dripping Brush.html b/examples/Tools/Dripping Brush.html index 0f8ea024..b516d05b 100644 --- a/examples/Tools/Dripping Brush.html +++ b/examples/Tools/Dripping Brush.html @@ -68,5 +68,5 @@ - + \ No newline at end of file diff --git a/examples/Tools/Fancy Brush.html b/examples/Tools/Fancy Brush.html index e5c3ef9d..ce83f65c 100644 --- a/examples/Tools/Fancy Brush.html +++ b/examples/Tools/Fancy Brush.html @@ -78,5 +78,5 @@ - + \ No newline at end of file diff --git a/examples/Tools/Grid.html b/examples/Tools/Grid.html index 4ce68810..336487e4 100644 --- a/examples/Tools/Grid.html +++ b/examples/Tools/Grid.html @@ -40,5 +40,5 @@ - + \ No newline at end of file diff --git a/examples/Tools/MetaBalls.html b/examples/Tools/MetaBalls.html index e76ddc07..327e17f9 100644 --- a/examples/Tools/MetaBalls.html +++ b/examples/Tools/MetaBalls.html @@ -113,5 +113,5 @@ - + \ No newline at end of file diff --git a/examples/Tools/MultiLines.html b/examples/Tools/MultiLines.html index 16bfc36c..b567de88 100644 --- a/examples/Tools/MultiLines.html +++ b/examples/Tools/MultiLines.html @@ -40,5 +40,5 @@ - + \ No newline at end of file diff --git a/examples/Tools/SquareRounded.html b/examples/Tools/SquareRounded.html index 7dde6478..0e08b232 100644 --- a/examples/Tools/SquareRounded.html +++ b/examples/Tools/SquareRounded.html @@ -78,5 +78,5 @@ - + \ No newline at end of file diff --git a/examples/Tools/Stars.html b/examples/Tools/Stars.html index 27ba8971..d36ce283 100644 --- a/examples/Tools/Stars.html +++ b/examples/Tools/Stars.html @@ -26,5 +26,5 @@ - + \ No newline at end of file diff --git a/examples/Tools/Wave.html b/examples/Tools/Wave.html index 252741a1..74aeb49b 100644 --- a/examples/Tools/Wave.html +++ b/examples/Tools/Wave.html @@ -44,5 +44,5 @@ - + \ No newline at end of file diff --git a/examples/Tools/Worm Farm.html b/examples/Tools/Worm Farm.html index 2413dc9e..15d3b307 100644 --- a/examples/Tools/Worm Farm.html +++ b/examples/Tools/Worm Farm.html @@ -84,5 +84,5 @@ - + \ No newline at end of file diff --git a/src/browser/DomEvent.js b/src/browser/DomEvent.js index b5ef6557..da3bdcbe 100644 --- a/src/browser/DomEvent.js +++ b/src/browser/DomEvent.js @@ -99,52 +99,42 @@ DomEvent.requestAnimationFrame = new function() { // So we need to fake it. Define helper functions first: var callbacks = [], - fastRate = 1000 / 60, - slowRate = 1000, focused = true, timer; - // Installs interval timer that checks all callbacks. This results in much - // faster animations than repeatedly installing timout timers. - function setTimer(timeout) { - window.clearInterval(timer); - timer = window.setInterval(function() { - // Checks all installed callbacks for element visibility and execute - // if needed. - if (!focused) - return; - for (var i = callbacks.length - 1; i >= 0; i--) { - var entry = callbacks[i], - func = entry[0], - element = entry[1]; - if (!element || DomElement.isVisible(element)) { - // Handle callback and remove it from callbacks list. - callbacks.splice(i, 1); - func(+new Date); - } - } - }, timeout); - } - - if (!paper.debug) { - DomEvent.add(window, { - focus: function() { - focused = true; - // Switch to falst checkCallback calls while window is focused. - timer && setTimer(fastRate); - }, - blur: function() { - focused = false; - // Switch to slow checkCallback calls while window is blured. - timer && setTimer(slowRate); - } - }); - } + DomEvent.add(window, { + focus: function() { + focused = true; + }, + blur: function() { + focused = false; + } + }); return function(callback, element) { + // See if we can handle natively first if (request) return request(callback, element); + // If not, do the callback handling ourself: callbacks.push([callback, element]); - !timer && setTimer(fastRate); + if (!timer) { + // Installs interval timer that checks all callbacks. This results + // in faster animations than repeatedly installing timout timers. + timer = window.setInterval(function() { + // Checks all installed callbacks for element visibility and + // execute if needed. + for (var i = callbacks.length - 1; i >= 0; i--) { + var entry = callbacks[i], + func = entry[0], + element = entry[1]; + if (!element || element.getAttribute('keepalive') == 'true' + || focused && DomElement.isVisible(element)) { + // Handle callback and remove it from callbacks list. + callbacks.splice(i, 1); + func(+new Date); + } + } + }, 1000 / 60); + } }; }; diff --git a/src/load.js b/src/load.js index 23c1793d..4105050e 100644 --- a/src/load.js +++ b/src/load.js @@ -108,12 +108,5 @@ if (window.tests) { for (var i = 0; i < sources.length; i++) { document.write(''); - if (sources[i] === 'src/paper.js') { - // Activate paper.debug for code loaded through load.js, as we're in - // development mode. - document.write(''); - } }