Here’s what I came up with
Works except there’s a jump after the first second / minute / hour as it doesn’t know how far through a given interval it is when it boots
Should be easy enough to fix for minute and hour, may have to live it with for second
float m;
float s;
float r = 0;
float offset1 = 0;
float offset2 = 0;
float secondMillis;
float prevSecondMillis;
float minuteMillis;
float prevMinuteMillis;
float hourMillis;
float prevHourMillis;
int prevSecond;
int prevMinute;
int prevHour;
float seed = 0;
float shortDashLength;
float longDashLength;
void setup() {
noCursor();
size(720, 720, P3D);
//fullScreen(P3D);
frameRate(60);
textSize(50);
//shortDashLength = 35;
//longDashLength = 45;
prevSecond = second();
}
void draw() {
strokeWeight(1);
shortDashLength = map(noise(seed),0,1,15,65);
longDashLength = map(noise(seed+100),0,1,5,150);
seed += 0.001;
if (second()!=prevSecond) {
secondMillis = 0;
prevSecond = second();
} else {
secondMillis += millis() - prevSecondMillis;
prevSecondMillis = millis();
}
if (minute()!=prevMinute) {
minuteMillis = 0;
prevMinute = minute();
} else {
minuteMillis += millis() - prevMinuteMillis;
prevMinuteMillis = millis();
}
if (hour()!=prevHour) {
hourMillis = 0;
prevHour = hour();
} else {
hourMillis += millis() - prevHourMillis;
prevHourMillis = millis();
}
s = map(second(), 0, 60, 0, TWO_PI);
s += map(secondMillis, 0, 1000, 0, TWO_PI/60);
m = map(minute(), 0, 60, 0, TWO_PI);
m += map(minuteMillis, 0, 60000, 0, TWO_PI/60);
//m += TWO_PI/60;
h = map(hour(), 0, 12, 0, TWO_PI);
h += map(hourMillis, 0, 60000*12, 0, TWO_PI/60);
//h -= TWO_PI/12*2;
background(0);
stroke(255);
drawDots();
drawDashes();
strokeWeight(1);
pushMatrix();
translate (width/2, height/2);
rotate(s);
line(0, 0, 0, (-height/2)+33);
popMatrix();
strokeWeight(2);
//minute
pushMatrix();
translate (width/2, height/2);
rotate(m);
line(0, 0, 0, -height/2 + 33);
popMatrix();
//hour
pushMatrix();
translate (width/2, height/2);
rotate(h);
line(0, 0, 0, -height/4);
popMatrix();
//text
//pushMatrix();
//translate (width/2, height/2);
//text(second(), 0, 0);
//text(minuteMillis, 0, 50);
//popMatrix();
}
void drawDots() {
noFill();
pushMatrix();
translate (width/2, height/2);
for (int i = 0; i <12; i++) {
rotate(TWO_PI / 12);
//circle(height/2-30, 0, 10);
//line(height/4, 0,height/4-10, 0);
}
popMatrix();
}
void drawDashes() {
pushMatrix();
translate (width/2, height/2);
//rotate(-TWO_PI/12*2);
rotate(-TWO_PI/60);
for (int i = 0; i <60; i++) {
rotate((TWO_PI / 60));
if (i%5==0) {
//println(i);
line(height/2-longDashLength, 0, height/2-30, 0);
} else {
line(height/2-shortDashLength, 0, height/2-30, 0);
}
}
popMatrix();
}