fiorina
Junior Member
Offline
Posts: 51
infinite concentric circles
Apr 15th , 2009, 7:27pm
hi there, this is driving me insane... i want to create inifinite concentric circles that follow the mouse... I can do it the longk, dumb-way round... like this: int grow = +1; int d = 1; int x = 100; int y = 100; void setup() { size(100, 100); smooth(); noFill(); strokeWeight(20); frameRate(100); } void draw() { background(50); d = (d + grow); if (d > 40){ d = 1; } stroke(100); ellipse(mouseX, mouseY, d, d); stroke(200); ellipse(mouseX, mouseY, d+20, d+20); stroke(100); ellipse(mouseX, mouseY, d+40, d+40); stroke(200); ellipse(mouseX, mouseY, d+60, d+60); stroke(100); ellipse(mouseX, mouseY, d+80, d+80); stroke(200); ellipse(mouseX, mouseY, d+100, d+100); stroke(100); ellipse(mouseX, mouseY, d+120, d+120); stroke(200); ellipse(mouseX, mouseY, d+140, d+140); stroke(100); ellipse(mouseX, mouseY, d+160, d+160); stroke(200); ellipse(mouseX, mouseY, d+180, d+180); stroke(100); ellipse(mouseX, mouseY, d+200, d+200); stroke(200); ellipse(mouseX, mouseY, d+220, d+220); stroke(100); ellipse(mouseX, mouseY, d+240, d+240); stroke(200); ellipse(mouseX, mouseY, d+260, d+260); stroke(100); ellipse(mouseX, mouseY, d+280, d+280); stroke(200); ellipse(mouseX, mouseY, d+300, d+300); stroke(100); ellipse(mouseX, mouseY, d+320, d+320); stroke(200); ellipse(mouseX, mouseY, d+340, d+340); stroke(100); ellipse(mouseX, mouseY, d+360, d+360); stroke(200); ellipse(mouseX, mouseY, d+380, d+380); stroke(100); ellipse(mouseX, mouseY, d+400, d+400); } But I want to be able to do it more succinctly, like this: int grow = +1; int d = 1; void setup() { size(200, 200); smooth(); frameRate(100); } void draw() { background(50); d = (d + grow); if (d > 300){ d = 1; } noFill(); stroke(200); ellipse(100, 100, d, d); } But I can't for the life of me figure out how to tell heaps of circles to grow. What do I do, create a function? Can anyone help? thx