Generative Art #182
Code
void setup() {
size(900, 900);
pixelDensity(2);
//noLoop();
blendMode(ADD);
}
void draw() {
background(0);
for (int i=0; i<5000; i++) {
float x = random(width);
float y = random(height);
float ns = 0.005;
float d = 50*noise(x*ns, y*ns);
grdCircle(x, y, d, d);
}
noiseSeed(int(random(100000)));
//saveFrame("output/####.png");
//if (frameCount > 50)exit();
}
void grdCircle(float x, float y, float d, float c) {
color col = getCol();
push();
translate(x, y);
rotate(random(TAU));
for (int i=0; i<c; i++) {
float a = lerp(0, PI, i/c);
noStroke();
fill(col, 5);
arc(0, 0, d, d, -a, a, CHORD);
}
pop();
}
void mousePressed() {
redraw();
}
void keyPressed() {
if (key == 's')saveFrame("####.png");
}
int[] colors = {#f9c80e, #f86624, #ea3546, #662e9b, #43bccd};
int getCol() {
return colors[(int)random(colors.length)];
}
arc()でグラデーションさせた円をランダムに配置。
円の大きさをnoise()で決定することで、全体として模様が現れる。
Happy coding!!
応援してくださる方!いつでもサポート受け付けてます!