Skip to content

Instantly share code, notes, and snippets.

@quat1024
Created December 6, 2015 04:34
Show Gist options
  • Save quat1024/a0e478b636e3944d104e to your computer and use it in GitHub Desktop.
Save quat1024/a0e478b636e3944d104e to your computer and use it in GitHub Desktop.
clockwork
void setup() {
size(500,500,OPENGL);
frameRate(60);
smooth(8);
}
float s = 2.5;
void draw() {
background(#D7FAD7);
translate(width/2,height/2);
scale(1.3);
strokeWeight(s);
float timer = frameCount/25f;
float t = ((timer + (0.38 * sin(timer*2)))*0.5);
for(int layer = 0; layer < 4; layer++) {
int amount = (layer*4)+4;
float offset = layer*radians(45);
float minr = layer*60;
float maxr = (layer+1)*45;
float speed = ((layer%2)-0.5)*2;
for(int i=0; i < amount; i++) {
float r = (i*(TAU/amount))+offset+(t*speed);
stroke(#04623A);
line(sin(r)*maxr,cos(r)*minr,sin(r)*minr,cos(r)*maxr);
noStroke();
fill(#04623A);
ellipse(sin(r)*maxr,cos(r)*minr,s,s);
ellipse(sin(r)*minr,cos(r)*maxr,s,s);
}
}
//saveFrame(frameCount + ".png");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment