Generative Art #200
Code
void setup() {
size(800, 800);
pixelDensity(2);
noLoop();
colorMode(HSB, 360, 100, 100, 100);
}
void draw() {
background(255);
tile();
noStroke();
fill(360);
for (int i=0; i<20; i++) {
float x = random(width);
float y = random(height);
float d = random(30, 110);
fill(getCol(1));
circle(x, y, d);
fill(0, 50);
myCircle(x, y, d);
}
noiseSeed(int(random(20192020)));
}
void tile() {
int c = 80;
float w = width/c;
color col = getCol(0.1);
strokeWeight(0.1);
for (int j=0; j<c; j++) {
for (int i=0; i<c; i++) {
if (random(1) < 0.15) {
col = getCol(0.1);
}
fill(col);
stroke(360);
rect(i*w, j*w, w, w);
fill(360);
noStroke();
circle(i*w+w/2, j*w+w/2, 0.5);
}
}
}
void myCircle(float x_, float y_, float d) {
float r = d/2;
int count = int(d*1000);
for (int i = 0; i < count; i ++) {
float angle = random(TWO_PI);
float rnd = 2-(random(random(random(2))));
float x = x_ + rnd * r * cos(angle);
float y = y_ + rnd * r * sin(angle);
square(x, y, 0.3);
}
}
void mousePressed() {
redraw();
}
void keyPressed() {
if (key == 's')saveFrame("####.png");
}
int getCol(float p) {
float hue = random(300, 336);
float sat = random(60);
float bri = random(80, 90);
if (random(1) < 0.4) {
hue = random(130, 50);
}
if (random(1) < p) {
sat = 100;
bri = 100;
}
color col = color(hue, sat, bri);
return col;
}
いつもと違う色の使い方をしてます。
色相、彩度、明度をいい感じにランダムにしています。
Happy coding!!!
応援してくださる方!いつでもサポート受け付けてます!