RadialRainbows.html example: use onFrame instead of setInterval and fix a bug in the window resizing code.

This commit is contained in:
Jonathan Puckey 2011-05-07 13:58:22 +01:00
parent ba6139cd48
commit d2de9c29d7

View file

@ -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];
}
});
</script>