let colWidth, rowHeight, seconds;
let secondsPerRow, secondsPerColumn;
const secondsInHour = 60 * 60;
let hu, sat, bhu, bright;
const w = (secondsInHour / 5);
createCanvas(w + border * 2, h + border * 2);
colorMode(HSB, 360, 100, 100);
iterationLength = random([15, 30, 45, 60]);
secondsPerColumn = secondsInHour / iterationLength;
colWidth = w / secondsPerColumn;
function easeInOutQuad(x) {
return x < 0.5 ? 2 * x * x : 1 - pow(-2 * x + 2, 2) / 2;
'C4': (t, period) => note(261.63, t, period),
'C#4': (t, period) => note(277.18, t, period),
'Eb4': (t, period) => note(311.13, t, period),
'E4': (t, period) => note(329.63, t, period),
'G4': (t, period) => note(392.00, t, period),
'G#4': (t, period) => note(415.30, t, period),
'B4': (t, period) => note(493.88, t, period),
function note(freq, t, period) {
return sin((freq * PI * t) / period);
function cSharpMinor(t, period) {
return notes["C#4"](t, period) +
function cSharpMinorSeventh(t, period) {
return cSharpMinor(t, period) +
seconds = d.getHours() * secondsInHour + d.getMinutes() * 60 + d.getSeconds();
let y = d.getFullYear() % yearPeriod;
hu = [(y * hf), (y * hf) + hf];
bhu = lerp(hu[0],hu[1],0.5);
hp = d.getMinutes() / 60;
sat = map(d.getMonth(), 0, 11, 50, 90);
bright = easeInOutQuad(dp * 2) * 15 + 70;
function drawTicks(tickList, a) {
const tb = (dp > 0.9) ? 100 : 0;
for (var i = 0; i < tickList.length; i++) {
rotate(createVector(x - x1, y - y1).heading());
for (let s = 0; s < width; s++) {
const p = (dist(x1, y1, x, y) / 2);
const vy = (i % 2 === 0 ? -1 : 1) * 10 * cSharpMinorSeventh(s, p*500);
const ip = ((i + 1) / tickList.length);
stroke(bhu, sat, tb, a * ip);
stroke(bhu, sat, tb, 0.8);
const es = min(width,height) - border*4;
background(bhu, sat/2, bright/3);
stroke(bhu, sat, bright/5, 1);
strokeWeight(border * 2);
rect(0, 0, width, height);
const bbright = map(dp, 0, 1, 85, 25);
for (let r = 0; r < 24; r++) {
const rowSeconds = r * secondsInHour;
for (let c = 0; c < secondsPerColumn; c++) {
const y = height - border - ((r + 1) * rowHeight);
const blockSeconds = rowSeconds + ((c + 1) * iterationLength);
if (seconds > blockSeconds) {
fill(hu[0] + (c / secondsPerColumn) * hu[1], sat, bright);
rect(border + x, y, colWidth, rowHeight);
const a = map(random(0, 1), 0, 1, (-PI / 2 + TAU * (hp + buffer)), (-PI / 2 + TAU * (hp - buffer)));
const b = min(width, height);
const r = random(b / 8, b / 2);
const x = width / 2 + r * cos(a);
const y = height / 2 + r * sin(a);
drawTicks(pticks, map(ticks.length, 0, iterationLength * 0.2, 0.2, 0.0));
if (ticks.length === iterationLength) {