Generative Art #165
Code
void setup(){
size(800, 800);
pixelDensity(2);
noLoop();
}
void draw(){
ArrayList<PVector>points = new ArrayList<PVector>();
float maxl = 80;
background(0);
for (int i=0; i<200; i++) {
float x = random(width), y= random(height);
float s = random(40, 300);
color col = getCol();
float rnd = random(0.1, 1);
for (float j=0; j<=s; j++) {
float ss = map(j, 0, s, 0, s);
float alph = map(j, 0, s*rnd, 220, 0);
stroke(col, alph);
strokeWeight(1);
noFill();
noiseCircle(x, y, ss);
}
fill(col);
noStroke();
circle(x, y, 5);
noiseSeed(int(random(100000)));
points.add(new PVector(x, y));
}
for (PVector p : points) {
for (PVector other : points) {
float d = dist(other.x, other.y, p.x, p.y);
if (p != other) {
if (d < maxl) {
stroke(255, 50);
strokeWeight(1);
line(other.x, other.y, p.x, p.y);
}
}
}
}
}
void noiseCircle(float x, float y, float d) {
float noiseMax = 0.45;
push();
translate(x, y);
beginShape();
for (float a=0; a<TAU; a+=TAU/360) {
float xoff = map(cos(a), -1, 1, 0, noiseMax);
float yoff = map(sin(a), -1, 1, 0, noiseMax);
float r = map(noise(xoff, yoff), 0, 1, d*0.3, d);
float posx = r * cos(a);
float posy = r * sin(a);
vertex(posx, posy);
}
endShape(CLOSE);
pop();
}
void mousePressed(){
redraw();
}
void keyPressed(){
if(key == 's')saveFrame("####.png");
}
int[] colors = {#e2316c ,#4091e8 ,#568cea ,#7dd7f2 ,#49eddc};
//int[] colors = {#006e90, #f18f01, #adcad6, #99c24d, #41bbd9};
int getCol(){
return colors[(int)random(colors.length)];
}
Happy coding!
応援してくださる方!いつでもサポート受け付けてます!