見出し画像

Generative Art #189

画像1

画像2

画像3

画像4

Code

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

void draw(){
 background(30);
 bg();
 noiseField();
 noiseSeed(int(random(100000)));
}

void bg(){
 noStroke();
 for(int i=0; i<80000; i++){
   float x = random(width);
   float y = random(height);
   float s = random(2);
   fill(230, 50);
   ellipse(x, y, s, s);
 }
}

void noiseField(){
 int c = 400;
 float w = width/c;
 int offset = 100;
 float nScl = 0.004;
 float nStr = 40;
 
 noStroke();
 for(int i=0; i < c; i++){
   fill(getCol());
   for(float j=0; j < c; j+=0.5){
     float x = i*w+(w/2);
     float y = j*w+(w/2);
     float angle = noise(x*nScl, y*nScl*0.1)*nStr;
     float size = noise(x, y)*4;
     push();
     translate(x, y);
     rotate(angle);
     ellipse(offset, 0, size, size);
     pop();
   }
 }
}

void mousePressed(){
 redraw();
}

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

int[] colors = {#ffbe0b,#fb5607,#ff006e,#8338ec,#3a86ff};
int getCol(){
 return colors[(int)random(colors.length)];
}

年内に#200までいっておきたいなと思い立ったので、久々のProcessing!

グリット状に並べたドットの角度にnoise()を使って力場っぽい模様を作りました。
xとyに違う強度(?)の引数を渡すことで縦方向の線がくねくねするような表現にしました。

Happy coding!!

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