73 lines
1.1 KiB
Plaintext
73 lines
1.1 KiB
Plaintext
|
int numFrames = 50;
|
||
|
float size = 10;
|
||
|
twoCircle tc;
|
||
|
line l, l2, l3;
|
||
|
|
||
|
void setup(){
|
||
|
size(500,500);
|
||
|
tc = new twoCircle();
|
||
|
l = new line(250, 300);
|
||
|
l2 = new line(250, 200);
|
||
|
}
|
||
|
|
||
|
class twoCircle {
|
||
|
float size = 10;
|
||
|
int y = 250;
|
||
|
int x = 250;
|
||
|
|
||
|
void show(float t){
|
||
|
stroke(0, 30, 225);
|
||
|
strokeWeight(size * 1.5);
|
||
|
point(x, y);
|
||
|
stroke(255);
|
||
|
strokeWeight(size*0.75);
|
||
|
point(x, y);
|
||
|
|
||
|
size = size + 2*sin(TWO_PI*t);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class line {
|
||
|
float start, end, size;
|
||
|
|
||
|
line(float s, float e) {
|
||
|
start = s;
|
||
|
end = e;
|
||
|
size = 10;
|
||
|
}
|
||
|
|
||
|
float x1(float t){
|
||
|
return start + size*0.1;
|
||
|
}
|
||
|
float y1(float t){
|
||
|
return start - size*0.75;
|
||
|
}
|
||
|
|
||
|
float x2(float t){
|
||
|
return end + size*0.1 + 10*abs(cos(TWO_PI*t));
|
||
|
}
|
||
|
float y2(float t){
|
||
|
return end - 50 + 10*sin(TWO_PI*t) - size*0.75;
|
||
|
}
|
||
|
|
||
|
void show(float t) {
|
||
|
strokeWeight(2);
|
||
|
line(x1(t),y1(t),x2(t),y2(t));
|
||
|
size = size + 2*sin(TWO_PI*t);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void draw(){
|
||
|
background(0);
|
||
|
|
||
|
float t = 1.0*(frameCount-1)/numFrames;
|
||
|
tc.show(t);
|
||
|
l.show(t);
|
||
|
l2.show(t);
|
||
|
|
||
|
if(frameCount<=numFrames){
|
||
|
saveFrame("fr###.png");
|
||
|
}
|
||
|
|
||
|
}
|