William Su – Project 05 – Wallpaper

I made a grid of circles with randomly sized and colored circles sprinkled in.

sketch

// William Su
// Section E
// wsu1@andrew.cmu.edu
// Project 05

function setup() { 
  createCanvas(400, 400);
  noLoop();
  count = 1;
} 

function draw() { 
  background(0);

    
  for (var M = 0; M <= width; M += 20){
    for (var N = 0; N <= height; N += 20) {

      if (count == 8) { 
        r = random(3, 12);
        fill(random(0, 255), random(0, 255), random(0, 255)); // Random color
        stroke(150);
        line(M - 10, N - 10, M + 10, N + 10);
        ellipse(M,N,r,r); // Random size
        count = 1;// Count resets after every 6 dots.

      } else { // Draw regular dots and lines
        fill(100);
        stroke(20);
        line(M + 10, N + 10, M - 10, N - 10);
        ellipse(M,N,8,8); 
        count += 1;
      }

    }
  }
}

Leave a Reply