Zetaverse

Concentric Circles 2

colorful concentric circles on a square grid

It is amazing how sometimes a bit of simple logic can give rise to something quite intricate.

I used Processing to make this. If you look at the source code, you will be surprised to see how terse the code is. The doubly nested for loop does all the heavy lifting here.

As always, happy to hear how I can improve this further.

void setup() {
  size(1080, 1080);
  background(0);
  noLoop();
  rectMode(CENTER);
}

void draw() {
  for (int y = 18; y < height; y += 40) {
    for (int x = 18; x < width; x += 40) {
      for (int d = 46; d > 0; d -= 4) {
        smooth();
        stroke(0);
        fill(random(255), random(255), 50);
        ellipse(x, y, d, d);
      } 
    }
  }
 saveFrame("concentric.jpg");
}

Exit mobile version