Skip to content

Instantly share code, notes, and snippets.

Created March 27, 2014 09:37
Show Gist options
  • Save anonymous/9803808 to your computer and use it in GitHub Desktop.
Save anonymous/9803808 to your computer and use it in GitHub Desktop.
"swimmers"
float t, r1, r2, d, time;
float q = 0.001;
void setup() {
smooth(8);
size(500, 500);
fill(240);
noStroke();
}
void draw() {
time = frameCount/48.0;
background(0);
pushMatrix();
translate(width/2, height/2 + 12);
rotate(QUARTER_PI);
for (int a=1000; a>0; a--) {
t = time - q*a;
pushMatrix();
rotate(TWO_PI*t/6);
for (int i=0; i<6; i++) {
r1 = map(cos(TWO_PI*t + PI*(i%2)), -1, 1, 80, 150);
r2 = map(-cos(TWO_PI*t), -1, 1, 2, 60);
pushMatrix();
rotate((i+t)*TWO_PI/6);
translate(r1, 0);
for (int j=0; j<3; j++) {
pushMatrix();
rotate((j+2*t)*TWO_PI/3);
translate(r2, 0);
d = 12*pow(.993, a);
fill(255*pow(.997, a));
ellipse(0, 0, d, d);
popMatrix();
}
popMatrix();
}
popMatrix();
}
popMatrix();
saveFrame("f##.gif");
if(frameCount==48) exit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment