Skip to content

Instantly share code, notes, and snippets.

@jshaw
Forked from companje/clock.pde
Created February 17, 2023 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jshaw/9f69d6b32b2dcb906e09b4d6f8b3924f to your computer and use it in GitHub Desktop.
Save jshaw/9f69d6b32b2dcb906e09b4d6f8b3924f 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