見出し画像

ProcessingでGenerative art#14

動くとこんな感じになります。

iPhoneのメモに式だけ書いてあって、いろいろ試して見たら出来上がりました。過去の自分ありがとう!
やっぱり円とか球っぽいのが好きなんだなって。

Code

float x, y;
float r = 200;
float theta;
float t = 0;
float angle;

void setup() {
  size(700, 540);
  pixelDensity(2);
  smooth();
  colorMode(HSB, 360, 100, 100, 100);
  background(360);
  angle = random(TWO_PI);
}

void draw() {
  fill(214, 2, 95, 50);
  noStroke();
  rect(0, 0, width, height);
  pushMatrix();
  translate(width/2, height/2);
  rotate(angle);
  for (float j=1; j<8; j+=0.6) {
    beginShape();
    for (int i=0; i<=360; i++) {
      theta = radians(i)+j*sin(t/10);
      x = map(i, 0, 360, -r, r );
      y = r * sqrt(1-pow(x/r, 2)) * sin(theta + t);
      noFill();
      stroke(214, 13, 34);
      vertex(x, y);
    }
    endShape();
  }
  popMatrix();
  t += 0.06;
  angle += 0.002;
}

void keyPressed() {
  if (key == ' ') {
    saveFrame("####.png");
  }
}

Happy coding!

応援してくださる方!いつでもサポート受け付けてます!