ProcessingでGenerative art #95
noise()を分岐条件として使ってみました。これはおもしろい。
Code
void setup() {
size(800, 800);
pixelDensity(2);
colorMode(HSB, 360, 100, 100, 100);
noLoop();
}
void draw() {
background(0);
for (int i=0; i< 100; i++) {
teardrop(random(width), random(height), random(5, 80));
}
grid();
}
void teardrop(float x, float y, float size) {
noStroke();
pushMatrix();
translate(x, y);
rotate(random(TWO_PI));
int colHue = (int)random(360);
float shift = 0;
float shiftStep = random(1, 2.5);
float angle = 0;
float angleStep = radians(random(-0.02, 0.02));
for (float i = size; i > 0; i--) {
rotate(angle);
fill(colHue, map(i, size, 0, 100, 0), 100);
circle(0, 0+shift, i);
shift += shiftStep;
angle += angleStep;
}
popMatrix();
}
void grid() {
int count = 100;
float w = width/count;
stroke(330);
noFill();
for (int j = 0; j < count; j++) {
for (int i = 0; i < count; i++) {
if (noise(i*0.05, j*0.05) >= 0.5) {
drawLine(i*w, j*w, w);
}
}
}
}
void drawLine(float x, float y, float s) {
float hs = s/2;
bezier(x, y+hs, random(x, x+s), random(y, y+s), random(x, x+s), random(y, y+s), x+s, y+hs);
bezier(x+hs, y, random(x, x+s), random(y, y+s), random(x, x+s), random(y, y+s), x+hs, y+s);
}
void mousePressed() {
noiseSeed((int)random(10000));
redraw();
}
void keyPressed() {
if (key == 's')saveFrame("####.png");
}
Happy coding!
応援してくださる方!いつでもサポート受け付けてます!