Generative Art #135
Code
void setup() {
size(840, 840);
pixelDensity(2);
noLoop();
rectMode(CENTER);
}
void draw() {
background(0);
int c = 20;
float w = width/c;
for (int j = 0; j < c+1; j ++) {
for (int i = 0; i < c+1; i ++) {
float noiseS = 0.07;
float angle = map(noise(i * noiseS, j * noiseS), 0, 1, 0, TAU);
push();
translate(i * w, j * w);
rotate(angle);
stroke(0);
fill(getCol());
arrow(0, 0, w);
pop();
}
}
powder();
}
void arrow(float x, float y, float s) {
int b = (int)random(6);
float hs = s/2;
fill(getCol());
stroke(getCol());
strokeWeight(1);
if(b == 0){
line(x+hs, y, x-hs, y);
line(x+hs, y, x, y - hs/2);
line(x+hs, y, x, y + hs/2);
}
else if(b == 1){
noStroke();
beginShape();
vertex(x+hs, y);
vertex(x, y+hs);
vertex(x, y+hs/2);
vertex(x-hs, y+hs/2);
vertex(x-hs, y-hs/2);
vertex(x, y-hs/2);
vertex(x, y-hs);
vertex(x+hs, y);
endShape();
}
else if(b == 2){
noStroke();
beginShape();
vertex(x+hs, y);
vertex(x, y+hs/2);
vertex(x, y+hs/4);
vertex(x-hs, y);
vertex(x, y-hs/4);
vertex(x, y-hs/2);
vertex(x+hs, y);
endShape();
}
else if(b == 3){
for(float i = hs; i > -hs; i -= s/4){
line(x + i, y, x + i - s/5, y + hs/2);
line(x + i, y, x + i - s/5, y - hs/2);
}
}
else if(b == 4){
noStroke();
beginShape();
for(float a = 0; a < TAU; a += TAU/360){
vertex(x + hs * cos(a), y + hs * sin(a));
}
beginContour();
for(float a = TAU; a > 0; a -= TAU/3){
vertex(x + hs * 0.7 * cos(a), y + hs * 0.7 * sin(a));
}
endContour();
endShape();
}
else{
noFill();
beginShape();
vertex(x, y + hs * 0.1);
vertex(x, y + hs);
vertex(x + hs, y + hs * 0.1);
vertex(x - hs, y + hs * 0.1);
endShape();
beginShape();
vertex(x, y - hs * 0.1);
vertex(x, y - hs);
vertex(x + hs, y - hs * 0.1);
vertex(x - hs, y - hs * 0.1);
endShape();
}
}
void powder() {
for (int i = 0; i < 500000; i ++) {
stroke(255, 60);
strokeWeight(0.4);
point(random(width), random(height));
}
}
void mousePressed() {
redraw();
noiseSeed((int)random(100000));
}
void keyPressed() {
if (key == 's')saveFrame("####.png");
}
int[] colors = {#ff595e, #ffca3a, #8ac926, #1982c4, #6a4c93};
int getCol() {
return colors[(int)random(colors.length)];
}
いろんな矢印を作って角度にパーリンノイズ を適用。
Happy coding!!
応援してくださる方!いつでもサポート受け付けてます!