From d2de9c29d7bda9c384189ca2f2d9730e09282eed Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Sat, 7 May 2011 13:58:22 +0100 Subject: [PATCH] RadialRainbows.html example: use onFrame instead of setInterval and fix a bug in the window resizing code. --- examples/Animated/RadialRainbows.html | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/examples/Animated/RadialRainbows.html b/examples/Animated/RadialRainbows.html index 9678a2fd..32ac3066 100644 --- a/examples/Animated/RadialRainbows.html +++ b/examples/Animated/RadialRainbows.html @@ -42,16 +42,14 @@ vector.length = 10; mouseDown = false; } + + function onFrame() { + if (!mouseDown) + iterate(); + } var grow = false; var vector = new Point(150, 0); - setInterval(draw, 30); - function draw() { - if (!mouseDown) { - iterate(); - document.redraw(); - } - } function iterate() { for (var i = 0, l = gradient.stops.length; i < l; i++) @@ -73,7 +71,8 @@ var radius = Math.max(document.size.height, document.size.width) * 0.75; var gradientColor = path.fillColor; gradientColor.origin = point; - gradientColor.origin = point + radius; + var radius = Math.max(document.size.height, document.size.width) * 0.75; + gradientColor.destination = point + [radius, 0]; } });