xxxxxxxxxx
int circX, circY, sizeofgrid;
color circColor;
void setup() {
size(500, 500);
// where does the grid originate from. The invisible center
circX = width/2;
circY = height/2;
// how big is the grid
sizeofgrid = 220;
circColor = color( random(255), random(255), random(255));
}
void draw() {
background(0);
noStroke();
fill(circColor);
// drawing the grid
for (float x = -sizeofgrid; x<=sizeofgrid; x= x+20) {
for (float y = -sizeofgrid; y<=sizeofgrid; y=y+20) {
float diameter = dist(circX, circY, x+circX, y+circY) / 20; // changes the soze of circle based on how far away they are from circX and circY
// float diameter = 5; // basic version, all circles same size.
ellipse(circX + x, circY + y, diameter, diameter);
}
}
}
void keyPressed () {
if (key == 'r') {
circColor = color (random (255), random (255), random(255) );
}
}