36 lines
1.2 KiB
Plaintext
36 lines
1.2 KiB
Plaintext
int samplesPerFrame = 5;
|
|
int numFrames = 50;
|
|
float shutterAngle = 1.5;
|
|
|
|
void setup(){
|
|
size(500,500);
|
|
}
|
|
|
|
void draw(){
|
|
background(0);
|
|
|
|
float t = 1.0*(frameCount-1)/numFrames;
|
|
|
|
stroke(144 - 63 * sin(TWO_PI*t));
|
|
strokeWeight(4 + 2 * sin(TWO_PI*t));
|
|
|
|
for(int i = 100; i < 250; i += 10) {
|
|
//right quarter
|
|
line(500 - i, 500 - i - 10*sin(TWO_PI*t), 500 - i + 10 * cos(TWO_PI*t), i + 10 * cos(TWO_PI*t));
|
|
line(500 - i, 500 - i - 10*sin(TWO_PI*t), 500 - i + 10 * cos(TWO_PI*t), 500 - i + 10 * cos(TWO_PI*t));
|
|
//top quarter
|
|
line(i + 50, i - i/10*sin(TWO_PI*t), 500 - i + 10 * cos(TWO_PI*t), i + 10 * cos(TWO_PI*t));
|
|
line(i + 50, i - i/10*sin(TWO_PI*t), i + 10 * cos(TWO_PI*t), i + 10 * cos(TWO_PI*t));
|
|
//left quarter
|
|
line(i, i - 10*sin(TWO_PI*t), i + 10 * cos(TWO_PI*t), 500 - i + 10 * cos(TWO_PI*t));
|
|
line(i, i - 10*sin(TWO_PI*t), i + 10 * cos(TWO_PI*t), i + 10 * cos(TWO_PI*t));
|
|
//bottom quarter
|
|
line(i + 50, 500 - i - i/10*sin(TWO_PI*t), 500 - i + 10 * cos(TWO_PI*t), 500 - i + 10 * cos(TWO_PI*t));
|
|
line(i + 50, 500 - i - i/10*sin(TWO_PI*t), i + 10 * cos(TWO_PI*t), 500 - i + 10 * cos(TWO_PI*t));
|
|
}
|
|
|
|
if(frameCount<=numFrames){
|
|
saveFrame("fr###.png");
|
|
}
|
|
}
|