Skip to content

Instantly share code, notes, and snippets.

@naikrovek
Forked from anonymous/gist:7484767
Created June 15, 2014 10:59
Show Gist options
  • Select an option

  • Save naikrovek/77b8e74fbe014379362d to your computer and use it in GitHub Desktop.

Select an option

Save naikrovek/77b8e74fbe014379362d to your computer and use it in GitHub Desktop.
// http://beesandbombs.tumblr.com/post/65550137124/shapes
// by dave
void setup() {
size(500, 500);
noStroke();
rectMode(CENTER);
}
float time, x, y, d;
void draw() {
time = map(frameCount, 0, 48, 0, 1);
background(248);
fill(0);
for (int i=-8; i<=8; i++) {
rect(width/2 + i*25, height/2 + 20*sin(i*TWO_PI/8 + TWO_PI*time), 3, 350);
rect(width/2 + 20*cos(i*TWO_PI/8 + TWO_PI*time), height/2 + i*25, 350, 3);
}
for (int i=-8; i<=7; i++) {
for (int j=-8; j<=7; j++) {
fill(0);
x = width/2 + (i+.5)*25;
y = height/2 + (j+.5)*25;
d = map(sin(0.04*dist(x, y, width/2, height/2) - TWO_PI*time), -1, 1, 3, 10);
ellipse(x, y, d, d);
fill(248);
if (d-4 >= 0 && (i+j)%2 == 0)
ellipse(x, y, d-4, d-4);
}
}
/*saveFrame("frame-##.png");
if (frameCount == 48)
exit();*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment