見出し画像

Generative Art #180

画像1

画像2

画像3

画像4

Code

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

void draw() {
 color bgCol = #DEF1FF;
 background(bgCol);
 tile();

 int c = 800;
 for (int i=0; i<c; i++) {
   float x = random(-0.5, 1.5)*width;
   float y = random(-0.5, 1.5)*height;
   float maxw = random(30, 70);
   float l = random(1, 1.5)*maxw;
   color col1 = getCol();
   color col2 = bgCol;

   for (int j=0; j<l; j++) {
     float ns = 0.001;
     float w = sin(map(j, 0, l, 0, PI))*maxw;
     float angle = noise(x*ns, y*ns)*100;
     color col = lerpColor(col1, col2, (j/l)-0.4);

     noStroke();
     fill(col);
     circle(x, y, w);
     y += sin(angle);
     x += cos(angle);
   }
 }
 noiseSeed(int(random(1000)));

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

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

 noFill();
 strokeWeight(0.4);

 for (int j=0; j<c; j++) {
   for (int i=0; i<c; i++) {
     stroke(0, random(100));
     rect(i*w, j*w, w, w);
     circle(i*w+w/2, j*w+w/2, 1);
   }
 }
}

int[] colors = {#177e89, #98ce23, #db3a34, #ffc857, #e23b8e};
int getCol() {
 return colors[(int)random(colors.length)];
}

円の大きさをsinを使って大小させながらパーリンノイズでずらしグミのような形を作りました。
背景色でグラデーションを加えてます。

実は前回のコードとほぼ同じなんです。

Happy coding!!

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