From ac310ecc04c35b9007a5035a7197612c1bc14e34 Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Mon, 20 Jun 2011 23:20:39 +0200 Subject: [PATCH] Fix RadialRainbows example. --- examples/Animated/RadialRainbows.html | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/Animated/RadialRainbows.html b/examples/Animated/RadialRainbows.html index 5073efef..3de1a46f 100644 --- a/examples/Animated/RadialRainbows.html +++ b/examples/Animated/RadialRainbows.html @@ -22,19 +22,16 @@ var gradientColor = new GradientColor(gradient, point, point + [radius, 0]); path.fillColor = gradientColor; - tool.eventInterval = 30; - - var mouseDown = false; + var mouseDown = false, + mousePoint = view.center; function onMouseDown(event) { - point = point + vector; mouseDown = true; + mousePoint = event.point; } function onMouseDrag(event) { - point = point + (event.point - point) / 10; - gradientColor.hilite = point; - iterate(); + mousePoint = event.point; } function onMouseUp(event) { @@ -43,8 +40,7 @@ } function onFrame() { - if (!mouseDown) - iterate(); + iterate(); } var grow = false; @@ -58,8 +54,12 @@ } else if (!grow && vector.length < 75) { grow = true; } - vector.length += (grow ? 1 : -1); - vector.angle += 5; + if (mouseDown) { + point = point + (mousePoint - point) / 10; + } else { + vector.length += (grow ? 1 : -1); + vector.angle += 5; + } gradientColor.hilite = mouseDown ? point : point + vector; }