見出し画像

Generative Art #185

画像1

画像2

画像3

画像4

Code

void setup() {
 size(900, 900);
 pixelDensity(2);
 noLoop();
}

void draw() {
 background(#FFE562);
 int c = int(random(50, 300));
 for (int i=0; i<c; i++) {
   float x = random(width);
   float y = random(height);
   float ns = 0.007;
   float s = map(noise(x*ns, y*ns), 0, 1, 0, 400);
   form(x, y, s);
 }
 noiseSeed(int(random(1000000)));

 //saveFrame("output/####.png");
 //if(frameCount > 100)exit();
}

void form(float x, float y, float s) {
 float r = s/2;
 float cs = s*0.1;
 color col = getCol();

 push();
 translate(x, y);
 for (int j=0; j<3; j++) {
   float css = cs*random(0.1, 1);
   rotate(random(TAU));
   for (int i=0; i<10; i++) {
     float a = random(-1, 1)*(PI/2);
     stroke(0, 100);
     strokeWeight(0.5);
     noFill();
     bezier(0, 0, r/2, 0, r/2, 0, r*cos(a), r*sin(a));

     stroke(0);
     fill(col);
     circle(r*cos(a), r*sin(a), css);
   }
 }
 fill(col);
 circle(0, 0, cs);
 pop();
}

void mousePressed() {
 redraw();
}

int[] colors = {#256eff, #46237a, #3ddc97, #fcfcfc, #ff495c};
int getCol() {
 return colors[(int)random(colors.length)];
}

ごちゃっとしてますがこんな形を作って画面いっぱいに配置しています。

画像5

中心からベジエ曲線を使って円状に10個線を引きます。
それを3回繰り返して一つのform()になっています。

よく知りませんがデータビジュアライゼーションにありそうな形ですね。

Happy coding!

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