Illuminated clocks
Three live clocks for Denver, New York and San Francisco. Each hand lights only the marks it reads, shifting finish with ambient mode and local sun.
8:42 PM tells you the time somewhere faster than any clock face can. Four characters, nothing to work out. I put three analog clocks in my site’s header anyway.
Digits give you a number. A dial puts time in space. Set Denver, New York and San Francisco side by side and the three second hands cross the same mark at the same instant. The minute hands agree too. Everything the cities share falls into step, so your eye goes straight to the one thing that differs: the hour.
That only works if the dial is quiet. An ordinary watch face prints 12 hours, 12 five-minute numerals and 60 ticks, and shows all of them all day. Three of those in a small popover is 252 marks, and at any moment nearly all of them describe a time it isn’t.
So these clocks only show what a hand is pointing at. The hour hand lights the two hours it sits between. The minute hand does the same on its own ring. The second hand carries a tight asymmetric glow along the ticks as it sweeps. The rest of the dial is dark.
Getting from the first working version to the one in the header took 16 commits over one afternoon, and almost none of them added anything. These are the decisions that mattered.
Take the ink away
The first build kept every mark faintly on: ticks at 15 percent, hours at 19. I was sure the hands would look stranded without a ring around them.
It went the other way. Once the unlit marks dropped to nothing, three dials took less effort to read than one printed face had. With no ring to scan, there is nowhere to look but the hands.
All 84 marks stay on, dimmed. One wide symmetric halo spills across 60 coarse ticks and both numeral rings.
240 ticks with an asymmetric 5° lead and 11° trail locked to the needle, plus two-numeral bracketing.
The same second, twice. Step the left clock through three earlier builds.
The name goes on the dial
Early builds set the city under each clock, like a caption. Printing DEN and PM on the face instead, beneath the hands, changed what the thing was. A label under a circle is an icon. Print that a hand sweeps across is an object behind glass.
A label. The hands have nothing to cross.
Print. The hands pass over it, and their shadow and glow fall on it.
Run the time through twelve. Only on the right do the hands have a name to cross.
The order of painting is what makes it work. The plate, lit marks and rim reflections go down first, then the city print, and the three hands last, so each hand’s shadow and glow land on whatever is beneath it.
How a hand casts light
I love details like these. Nobody points at them, and the clock goes flat the moment one is missing. Making light on a canvas behave like light took three rules and one lie.
Two numerals, never one
My first fix for stray light was strict: a hand lights the last numeral it passed and nothing else. It was tidy, and it was wrong for most of every hour. At 5:52 the hour hand is four degrees from the 6, and the only numeral lit is the 5 behind it. Your eye gets pulled the wrong way.
Now the two numerals either side of a hand share its light, the nearer one brighter. The falloff isn’t a straight line. It holds close to full strength until the hand is well clear, so the numeral you are reading doesn’t start to fade the moment the hand moves off it.
Drag the hand, or use the slider.
Drag the hour hand toward 6, then switch to Snapped. At 5:52 the hand is nearly on the 6 and the 6 is still dark.
Light that moves with the needle
My first trailing wake kept everything ahead of the second hand pitch black and offset the rim glint behind it. In motion it felt broken: ticks popped on late and the bright edge dragged behind the needle like a separate animation.
Now the light is locked straight onto the tip. At full size the ring carries 240 ticks, four a second. Each tick wakes softly over 5 degrees just before the needle arrives, peaks right under it, and fades out behind over 11 degrees. The bevel reflection shares the same peak and envelope, so the edge glow and the ticks move as one light across twelve without a seam.
Each tick wakes smoothly 5° before the needle reaches it, peaks under the tip, and fades over 11° behind. The bevel highlight shares the same envelope.
The needle at its real speed, six degrees a second. Ticks wake 5° before contact and linger 11° behind, so the light rides with the tip instead of lagging it.
One scale per hand
The last rule keeps the hands out of each other’s light. The minute hand lights the minute numerals and passes over the hours without touching them. The needle owns the ticks. Break that and the minute hand lights an hour it has nothing to say about, and the dial is lying a little.
The rim gets the same care. A broad reflection follows the minute hand around it, a tighter glint rides dead-on the needle, and the two cross at twelve cleanly.
The honest version looked wrong
This is the one place where being right made it worse. The hands are dark steel with a narrow glowing insert near the tip. On a black dial, physics says you see the insert and nothing else. I built that. The stems vanished, and each hand became a bright dash floating in space with nothing tying it to the center.
So the hands cheat twice. A fine polished edge runs all the way round each one, bright enough to trace the stem through pitch black back into the center collar. And a fixed light from the upper left rolls across the bevel as the hand turns, the way brushed steel would. Each luminous bar sits right up inside the curved nose, with the same steel border at the tip as on the sides, so it reads as part of the hand instead of floating behind it.
Only the insert glows. Put that blur on the whole hand and the brushed steel turns muddy.
Turn the baton past the dashed line and the bright edge changes sides. Take the rim away on Red and the stem is gone.
Two skies, four finishes
Most dark modes swap the paint. A clock for another city has two lights to answer to: the room you are sitting in, and whether the sun is up where the clock is.
So there are four finishes. On a light page, a city in daylight gets white enamel and graphite hands with no glow at all, because glow on white is invisible. After its sunset the same clock turns navy, dark enough to carry night on a white page without being a black hole in it. My first navy was too blue beside the gray text, so it went darker.
On a dark page, daylight cities are black dials lit white. Night ones go red. I kept getting hit by cool white glare when I checked the corner of my own site late at night. Red is what cockpit gauges and StandBy’s bedside clock use for the same reason: it leaves your night vision alone. There is more on that in a docked screen belongs to the room.
Denver takes its sunrise and sunset from the same forecast as the weather card beside it, so the two never disagree. New York and San Francisco work theirs out from latitude and longitude, and land within a couple of minutes of an almanac.
Light appearance
Dark appearance
Scrub the day. Each clock changes finish when its own sun goes down: on November 24, that is 2:33 in New York, 4:39 in Denver and 5:54 in San Francisco, all in Denver time.
What it costs
The dials are drawn on a canvas with four times the pixels a Retina screen needs, and redrawn finer still when you pinch to zoom. That is what keeps a steel edge about half a pixel wide from breaking into stairs. Halfway through I rebuilt them in SVG, hoping for crisper lines. They came out softer, and the rim reflections fought it at twelve o’clock, so I went back.
One drawing routine serves the 135px clocks in the header and the larger faces on this page. Below 140px it draws every other tick, and below 111px the hour numerals hit a 10px floor and stop shrinking.
None of that is free. Three 135px header dials at 4× density hold about 3.3 MB of pixels, and a single 240px close-up on this page takes 3.5 MB. The clocks stop drawing when they scroll out of view or the tab is hidden, and if you have asked your system for less motion the second hand holds still on the minute.
Some choices cost legibility too. Dark numerals focus you up close, but from across a room you read the angle of the hands first, and a printed ring would help. The clocks these replaced had an arc on the bezel showing how many hours each city was ahead or behind. These don’t, and you compare the hands instead. And the polished edge that keeps a hand visible is a lie about how steel behaves in the dark. I would make all three trades again.
It is a ridiculous amount of attention for something you look at for two seconds. But a working clock widget takes five minutes to make now. What is left is deciding which half pixel of steel matters when nobody is checking.
For a different way of reading time across cities, see the crew agenda for a Denver to San Francisco flight.