ProcessingでGenerative art #67
Code
float lineH;
float lineW = 3;
int actRandomSeed = 0;
int hueCol = 320;
void setup() {
size(800, 800);
pixelDensity(2);
colorMode(HSB, 360, 100, 100, 100);
blendMode(ADD);
strokeWeight(1);
rectMode(CENTER);
}
void draw() {
randomSeed(actRandomSeed);
background(10);
drawLine();
drawShape(340);
drawShape(128);
}
void drawShape(float radius) {
float division = TWO_PI * random(0.2);
float startAngle = 0;
float endAngle = division;
float angleStep = map(radius, 50, width/2, 0.7, 0.2);
pushMatrix();
for (float i = 0; i <= PI * 4; i += division) {
color col = color(hueCol, random(20, 100), random(100), 50);
lineH = random(220);
noStroke();
fill(col);
for (float angle = startAngle; angle <= endAngle; angle += radians(angleStep)) {
pushMatrix();
translate(width * 0.5, height * 0.5);
rotate(angle);
fill(col);
rect(0, radius, lineW, lineH);
popMatrix();
}
division = TWO_PI * random(0.2);
startAngle = endAngle;
endAngle = startAngle + division;
}
popMatrix();
}
void drawLine() {
stroke(hueCol, 90, 90);
noFill();
line(width*0.5, 0, width*0.5, height);
line(0, height*0.5, width, height*0.5);
for (float d = width * 0.25; d < width * 1.5; d += 200) {
ellipse(width*0.5, height*0.5, d, d);
}
}
void keyPressed() {
if (key == '1')hueCol = 320;
if (key == '2')hueCol = 220;
if (key == '3')hueCol = 50;
if (key == 's')saveFrame("####.png");
}
void mousePressed() {
actRandomSeed = (int)random(10000);
}
Happy Coding!!
応援してくださる方!いつでもサポート受け付けてます!