sketch/setSquare/setSquare.pde
2020-03-25 23:01:04 +11:00

46 lines
826 B
Plaintext

int numFrames = 50;
int n = 500;
class Thing {
float x = random(100, 400);
float y = random(100, 400);
float radius = random(2,15);
float size = random(1,2.5);
float offset = 9*noise(0.02*x, 0.02*y);
void show(){
stroke(255);
strokeWeight(size);
float t = 1.0*(frameCount-1)/numFrames;
rect(x,y, radius*sin(TWO_PI*t + offset), radius*sin(TWO_PI*t + offset));
//point(x + radius*cos(TWO_PI*t + offset), y + radius*sin(TWO_PI*t + offset));
}
}
Thing[] array = new Thing[n];
void setup(){
size(500,500);
for(int i=0;i<n;i++){
array[i] = new Thing();
}
}
void draw(){
background(0);
float t = 1.0*(frameCount-1)/numFrames;
stroke(255);
strokeWeight(10);
for(int i=0;i<n;i++){
array[i].show();
}
if(frameCount<=numFrames){
saveFrame("fr###.png");
}
}