Week 3: Con­d­i­t­i­o­n­a­l­s and Loops

by Gawshika Aumkaran
  • Show Sketch
/** @peep sketchcode */
size(400, 400); 
 
int r = random(60, 200);
int g = random(60, 200);
int b = random(60, 200);
 
//Set Background to random
background(r, g, b);
 
for (int y = 20; y <= height - 20; y += 10) {
  for (int x = 20; x <= width - 20; x += 10) {
    if ((x % 30) == 0 || (y % 50) == 0) {
      strokeWeight(1);
      line(x, y, x+6, y-6);
    } else {
      strokeWeight(3);
      line(x, y, x+6, y+6);
    }
  } 
}

Comments

Nobody has said anything yet.