xxxxxxxxxx
//int numCircs = 10;
float circX;
float circY;
float circD;
color circColor;
void setup() {
size(500, 800);
// sets up x and y location of 1 circle at a random location
circX = random(width);
circY = random(height);
// gives the circle a random size
circD = random(10, 200);
// gives the circle a random color, random r, g and B value
circColor = color( random(255), random(255), random(255));
}
void draw() {
background(#09366C);
// Draws circles at a random location and gives it a random color value using color()
if (dist(mouseX, mouseY, circX, circY) < circD*.5) { // checking if the mouse is in every new circle
fill(circColor); // changes color to a random one
} else {
fill(255); // or else it's white
}
ellipse(circX, circY, circD, circD); // drawing the circle
}
// on pressing R resets and draws a new circle
void keyPressed() {
if (key == 'r') {
circX = random(width);
circY = random(height);
circD = random(300);
circColor = color( random(255), random(255), random(255));
}
}