Wednesday, September 06, 2006

for loop with variables

This code creates a cloud
Try changing the number of circles, the diameter, the color or transparancy


float xpos, ypos, diameter;

size(400,400);
smooth();
noStroke();

for(int counter=0; counter<2000; counter++) {
xpos = random(width);
ypos = random(height);
diameter = 20;

fill(255, random(50,100));
ellipse(xpos,ypos, diameter, diameter);
}

0 Comments:

Post a Comment

<< Home