Tom MacWright

GIF Polyrhythms & GIF CLOCK

GIF CLOCK unraveled

the minute, second, and hour hand of gif clock, in each of their states traveling around the dial, all as one image.

GIFCLOCK was the most popular thing on this site last month. It’s not very technical, unrelated to maps, and is really just an experiment hacked together and deployed from 1-3am. GIFs, it turns out, are pretty big on this little internet.

The point of GIF clock is two things.


There’s no code behind the clock. Of course, I hacked together a few Python scripts to tone down the boring work, but the real thing - there’s no magic.

It is a picture of every clock, that advances every second. Hopefully by the time this is published, I’ll be starting on a successor: YouTube clock. A video of a wall clock ticking away every second of a day, and then looping back when it reaches the next day.

secondstic tac toechess

There’s an interesting range of decision trees and chances in most things. Chess has as many game-tree possibilities as the shannon number. Tic tac toe is shallow enough to be visualized in all of its possible combinations. And then time is always the same: the same states, repeated over and over. It’s unimportant whether you’re watching a video of the states of a clock, or flipcards of all possible clocks, or a working clock - it’s all the same.

So there are some quirks. Like if the minute hand GIF takes too long to load, minutes will be slow. Or if you start it at any time besides noon or midnight, it’ll be inaccurate. It’s a lot like an extremely rudimentary wind-up clock.


The reason why GIF CLOCK is not gigantic is because of polyrhythms. It’s three GIFs - a seconds hand, minutes hand, and hours hand, and each only has as many frames as positions - 60, 60, and 12. So 132 frames total, instead of 60 * 60 * 12 = 43200. Of course, there are 86,400 seconds in a day, but GIF CLOCK doesn’t differentiate between AM & PM.

Polyrhythms are independent, different rhythms that are played at the same time. In music, they’re usually something like 4:3, or 3:2 - things that are sometimes very difficult to learn and perform, but not mathematically complex: the measures that they resolve to are usually similar to musical phrasing. Used tastefully, they tend to sound awesome, like in the middle of Joanna Newsom’s Sawdust and Diamonds.

The relation between a polyrhythm and the number of beats you need to ‘count’ to get to the ‘common beat’ is decided by the least common multiple. And by this measure, the common beat becomes more and more sparse: a 4:5 polyrhythm only lines up every 20th beat. So, musically, playing polyrhythms gets pretty rough beyond single-digits - and to most ears kind of trying.

But having different measures going at the same time is pretty cool for other things: where you’re trying to make semi-random visualizations look truly random and natural, having different longer rhythms going at the same time can make things seem more natural, without having to make longer, more disk-space-expensive loops.

Anyway, for an absurdist clock, consult GIF clock. Gifsicle is instrumental in gif-making for me - the rest is hacked together with Imagemagick

(which is not very enjoyable) and Python/shell scripts.