Skip to content

Instantly share code, notes, and snippets.

@companje
Created May 21, 2012 18:41
Show Gist options
  • Save companje/2763852 to your computer and use it in GitHub Desktop.
Save companje/2763852 to your computer and use it in GitHub Desktop.
Arc Clock in Processing
float heleCirkel = TWO_PI; //tau
void setup() {
size(500,500);
background(0);
smooth();
}
void draw() {
background(0);
translate(width/2,height/2);
rotate(-heleCirkel/4);
noFill();
strokeWeight(20);
strokeCap(SQUARE);
stroke(0, 255, 0);
float s = map(second(), 0, 60, 0, heleCirkel);
arc(0, 0, 70, 70, 0, s);
stroke(255, 0, 0);
float m = map(minute(), 0, 60, 0, heleCirkel);
arc(0, 0, 120, 120, 0, m);
stroke(0, 0, 255);
float h = map(hour(), 0, 60, 0, heleCirkel);
arc(0, 0, 170, 170, 0, h);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment