記録

勉強したことに関するのノート。見返して分かるようにしてます。

4色

void setup() {
  size(500, 500);
  colorMode(HSB, 360, 100, 100);
  background(0, 0, 100);
}

void draw() {
  pushMatrix();
  stroke(0, 0, 100);
  translate(width/2, height/2);
  rotate(PI/4);
  fill(0, 100, 100);
  beginShape();
  for (int i=0; i<100; i=i+1) {
    vertex(random(width), random(height));
  }
  endShape();

  rotate(PI);
  fill(180, 100, 100);
  beginShape();
  for (int i=0; i<100; i=i+1) {
    vertex(random(width), random(height));
  }
  endShape();

  rotate(PI/2);
  fill(90, 100, 100);
  beginShape();
  for (int i=0; i<100; i=i+1) {
    vertex(random(width), random(height));
  }
  endShape();

  rotate(PI);
  fill(180+90, 100, 100);
  beginShape();
  for (int i=0; i<100; i=i+1) {
    vertex(random(width), random(height));
  }
  endShape();
  popMatrix();
}

もじゃもじゃカラフル。rotateのしくみを完全に理解してないせいで苦戦した