ProcessingでGenerative art #72
Code
float t;
float hueCol;
int arcSize = 150;
void setup() {
size(800, 800);
pixelDensity(2);
colorMode(HSB, 360, 100, 100, 100);
noLoop();
noStroke();
t = random(10);
}
void draw() {
background(360);
for (int y = - arcSize/2; y <= height + arcSize; y += arcSize * 0.4) {
for (int x = 0; x <= width + arcSize; x +=arcSize * 0.8) {
hueCol = random(360);
drawArc(x, y, arcSize, PI * 0.7, TWO_PI + PI * 0.7);
}
}
}
void drawArc(int posX, int posY, float diameter, float start, float stop) {
for (float d = diameter; d > 0; d -= 1.5) {
beginShape();
vertex(posX, posY);
for (float theta = start; theta <= stop; theta += radians(1)) {
float radius = map(noise(t, theta*2), 0, 1, d / 2 - d / 4, d/2 + d / 4);
float x = posX + radius * cos(theta);
float y = posY + radius * sin(theta);
vertex(x, y);
}
vertex(posX, posY);
fill(hueCol, map(d, diameter, 0, 100, 0), 100);
endShape(CLOSE);
t += 0.01;
}
}
void mousePressed() {
redraw();
}
void keyPressed() {
if (key == 's')saveFrame("####.png");
}
Happy coding!
応援してくださる方!いつでもサポート受け付けてます!