Generative Art #190
Code
void setup() {
size(800, 800);
pixelDensity(2);
noLoop();
}
void draw() {
ArrayList<PVector> forms = new ArrayList<PVector>();
int c = 80;
float w = width/c;
int cc = int(c*1.1);
for (int j=0; j<cc; j++) {
for (int i=0; i<cc; i++) {
float x = i*w+(w/2);
float y = j*w+(w/2);
forms.add(new PVector(x, y, w));
}
}
background(0);
noStroke();
for(int i=0; i<forms.size(); i++){
PVector f = forms.get(i);
form(f.x, f.y, f.z);
}
noiseSeed(int(random(10000)));
}
void form(float x, float y, float s) {
float nScl = 0.008;
s *= noise(x*nScl, y*nScl)*100;
float hs = s/2;
fill(getCol());
beginShape();
vertex(x-hs, y);
vertex(x, y-hs);
vertex(x+hs, y);
vertex(x, y+hs);
endShape(CLOSE);
}
void mousePressed() {
redraw();
}
void keyPressed() {
if (key == 's')saveFrame("####.png");
}
int[] colors = {#540d6e, #ee4266, #ffd23f, #f3fcf0, #1f271b};
int getCol() {
return colors[(int)random(colors.length)];
}
なんかいろいろやって行き着いた先が四角形を並べることでした。
Happy coding!!
応援してくださる方!いつでもサポート受け付けてます!