~/todd-fleeman/case-study — session log entry

~/Polar Clock

started 2026-10-13 · last touched 2026-10-14
why this exists

Time as rings instead of hands. Six rings sit inside each other: the month on the inside, the second on the outside. Each one fills around the circle as its stretch of time passes. The outer ring sweeps once a minute, the hour ring takes a whole day, and the inner ring takes all year. It's a rebuild of an old D3 v3 clock, moved to v7, React and TypeScript. The jQuery and Moment.js dependencies are gone, and a date bug from the original got fixed along the way. It's part of the clock set: the same time as the Analog Clock, read a completely different way.

built on / learned
D3JS
Data Visualizations
Learned

Every ring is a fraction. Each unit of time becomes a value from 0 to 1: seconds over 60, hours over 24, months over 12. Multiplying by a full turn gives the end angle of the ring's arc. It's the same idea as the Analog Clock, drawn as arcs instead of hands.

Rings that creep. Each value adds in the smaller units below it, all the way down to milliseconds. So every ring moves continuously instead of jumping when its unit rolls over.

Months aren't all the same length. The date ring needs to know how many days the current month has. Asking for the 32nd day of the month rolls over into the next month, and 32 minus that date is the month's length. One line, no lookup table.

Labels that ride the arc. Each label rotates to the end of its ring, then turns a quarter turn so it reads along the curve. Past the halfway point it flips the other way, so nothing ends up upside down.

Color that tracks progress. A D3 scale with interpolateHsl darkens each ring as it fills, using the site's palette. It replaced a hand-written HSL interpolator from the original.

Join once, update every frame. The rings and labels are joined once. Then d3.timer feeds the same elements fresh values every frame, and stopping the timer on unmount keeps it from running after the clock is gone.

where this might go

Rings that fill are progress bars that fit inside each other. Swap time for any goal with smaller goals inside it, and this becomes a dashboard: a fundraiser's day, week and campaign; a team's quarter, game and season; a reading challenge's chapter, book and year. Run it backward and it's a countdown for a kid waiting on a birthday or the last day of school, with every ring emptying toward the big day. It works anywhere people want to see how close they are, at every scale at once.