tut­o­r­i­a­l­8

by chris Huang
    void setup() {
      size(200, 200);
      background(204);
      translate(width/3, height/3);
      grid();
      translate(width/7, height/5);
      rotate(radians(-50));
      grid();
      translate(width/7, height/7);
      rotate(radians(-75));
      grid();
    }
     
    void grid() {
      stroke(0, 32);
      fill(255, 64);
      rect(0, 0, width, height);
      for (int x = 0; x <= width; x += 10) { line(x, 0, x, height); }
      for (int y = 0; y <= height; y += 10) { line(0, y, width, y); }
      stroke(255, 0, 0, 128);
      line(10, 10, 30, 10);
      line(25, 15, 30, 10);
      line(25, 5, 30, 10);
      stroke(0, 0, 255, 128);
      line(10, 10, 10, 30);
      line(15, 25, 10, 30);
      line( 5, 25, 10, 30);
    }

    Comments