見出し画像

Generative Art #193

画像1

画像2

画像3

Code

void setup() {
 size(800, 800);
 pixelDensity(2);
 noLoop();
 rectMode(CENTER);
}

void draw() {
 background(23);
 tile();
}

void tile() {
 int c = 16;
 float w = width/c;

 noFill();
 stroke(#FFF0F0);
 strokeWeight(1);

 for (int j=0; j<c; j++) {
   for (int i=0; i<c; i++) {
     form(i*w+w/2, j*w+w/2, w);
   }
 }
}

void form(float x, float y, float s) {
 float hs = s/2;
 float p = int(random(2));
 push();
 translate(x, y);
 for (int i=0; i<2; i++) {
   rotate(PI);
   if (p == 0) {
     beginShape();
     vertex(hs, 0);
     bezierVertex(s * 0.4, 0, 0, 0, -hs, hs);
     endShape();
     arc(hs, hs, s, s, PI, PI + HALF_PI, OPEN);
     arc(hs, hs, hs, hs, PI, PI + HALF_PI, OPEN);
     arc(hs, hs, hs * 0.6, hs * 0.6, PI, PI + HALF_PI, OPEN);
   } else {
     beginShape();
     vertex(hs, 0);
     bezierVertex(s * 0.4, 0, 0, 0, -hs, -hs);
     endShape();
     arc(hs, -hs, s, s, HALF_PI, PI, OPEN);
     arc(hs, -hs, hs, hs, HALF_PI, PI, OPEN);
     arc(hs, -hs, hs * 0.6, hs * 0.6, HALF_PI, PI, OPEN);
   }
 }
 pop();
}

void mousePressed() {
 redraw();
}

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

Pattern of omeme.

Happy coding!!

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