Generative Art #199
Code
int[] colors = {#2364aa,#3da5d9,#73bfb8,#fec601,#ea7317};
//int[] colors = {#008cc5,#33cccc,#f7fff7,#ff6b6b,#ffe66d};
void setup() {
size(800, 800);
pixelDensity(2);
noLoop();
rectMode(CENTER);
}
void draw() {
background(getCol());
tile();
noiseSeed(int(random(1000)));
}
void tile() {
int c = 25;
float w = width/c;
for (int j=0; j<=c; j++) {
for (int i=0; i<=c; i++) {
float x = i*w+w/2;
float y = j*w+w/2;
float nScl = 0.003;
float d = int(noise(x*nScl, y*nScl)*6)*w*0.6;
color col = getCol();
if (random(1) < 0.6) {
noStroke();
fill(col, 10);
grdCircle(x, y, d);
fill(getCol(), 180);
dotCircle(x, y, d);
}
noFill();
stroke(getCol());
circle(x, y, 2);
}
}
}
void grdCircle(float x, float y, float d) {
int c = 100;
push();
translate(x, y);
rotate(int(random(8))*QUARTER_PI);
for (int i=0; i<c; i++) {
float a = map(i, 0, c-1, 0, PI);
arc(0, 0, d, d, -a, a, CHORD);
}
pop();
}
void dotCircle(float x_, float y_, float d) {
float r = d/2;
int count = int(d*100);
for (int i = 0; i < count; i ++) {
float angle = random(TWO_PI);
float rnd = (random(random(random(2))))+1;
float x = x_ + rnd * r * cos(angle);
float y = y_ + rnd * r * sin(angle);
square(x, y, 0.5);
}
}
void mousePressed() {
redraw();
}
void keyPressed() {
if (key == 's')saveFrame("####.png");
}
int getCol() {
return colors[(int)random(colors.length)];
}
グラデーションと点描の円。
ランダムで描く描かないの選択、パーリンノイズ で大きさの決定。
Happy coding!!
応援してくださる方!いつでもサポート受け付けてます!