const gui = new dat.GUI();
let auto = gui.add(settings, 'isAuto');
let setHr = gui.add(settings, 'hr', 0, 23);
let setMin = gui.add(settings, 'min', 0, 59);
[2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 4, 5, 5, 5, 6, 5, 4, 3, 4, 5, 4, 3]
const timeSpeeds = timeLengths.map(speed => 1 / speed);
const daySum = timeLengths.reduce(function(accumulator, hourLength) {
return accumulator + hourLength;
const TotalSecondInADay = timeLengths.reduce(function(accumulator, hourLength) {
return accumulator + hourLength * 60 * 60;
const realTimeRatio = TotalSecondInADay / 24 * 60 * 60;
function getHourPercentage(hour) {
let hourSum = timeLengths.reduce(function(accumulator, hourLength, index) {
return index < hour ? accumulator + hourLength : accumulator;
ws = min(windowWidth, windowHeight) * 0.8;
ellipse(width / 2, height / 2, 5);
function getDisplayHourDeg() {
hourNow = now.getHours();
minNow = now.getMinutes();
settings.hr, settings.min, 0)
hourNow = setNow.getHours();
minNow = setNow.getMinutes();
let secondsPassed = timeLengths.reduce(function(accumulator, hourSpeed, index) {
return index < hourNow ? accumulator + hourSpeed * 60 * 60 : accumulator;
}, 0) + timeLengths[hourNow] * minNow * 60;
return TWO_PI * (secondsPassed / TotalSecondInADay);
function drawHourHand() {
translate(width / 2, height / 2);
rotate(getDisplayHourDeg())
function getSecSinceMidNight() {
return Math.round((now.getTime() - then.getTime()) / 1000);
for (const [index, hr] of timeLengths.entries()) {
translate(width / 2, height / 2);
rotate(TWO_PI * getHourPercentage(index));
rotate(-TWO_PI * getHourPercentage(index) + PI / 2);
textAlign(CENTER, CENTER);