CSS/Javascript Word Clock

A little experiment I built: a word clock using CSS3 transforms and a little Javascript to run the actual clock. Useful? Maybe not. Fun? Definitely.
The code behind it is fairly straight-forward. Let's take a peak:
CSS
The first thing we need to do is set a base set of styles for each arm of the clock.
1li {2position: absolute;3width: 150px;4text-transform: lowercase;5-webkit-transform-origin: 0 center;6-moz-transform-origin: 0 center;7color: rgba(255, 255, 255, 0.1);8position: absolute;9left: 0;10top: 0;11}
This is basically saying for each arm, position it at the top of the clock body, and then rotate around left side, so that we have uniform rotations.
Then, for each arm, we set the actual rotation. Here is the HTML for the "hour" arms:
1<ol id="hours">2<li><span>One</span></li>3<li><span>Two</span></li>4<li><span>Three</span></li>5<li><span>Four</span></li>6<li><span>Five</span></li>7<li><span>Six</span></li>8<li><span>Seven</span></li>9<li><span>Eight</span></li>10<li><span>Nine</span></li>11<li><span>Ten</span></li>12<li><span>Eleven</span></li>13<li><span>Twelve</span></li>14</ol>
And, the corresponding CSS:
1#hours > li {2padding: 0 0 0 80px;3}4#hours > li:nth-child(1) {5-webkit-transform: rotate(-60deg);6-moz-transform: rotate(-60deg);7}8#hours > li:nth-child(2) {9-webkit-transform: rotate(-30deg);10-moz-transform: rotate(-30deg);11}12#hours > li:nth-child(3) {13-webkit-transform: rotate(0deg);14-moz-transform: rotate(0deg);15}16#hours > li:nth-child(4) {17-webkit-transform: rotate(30deg);18-moz-transform: rotate(30deg);19}20#hours > li:nth-child(5) {21-webkit-transform: rotate(60deg);22-moz-transform: rotate(60deg);23}24#hours > li:nth-child(6) {25-webkit-transform: rotate(90deg);26-moz-transform: rotate(90deg);27}28#hours > li:nth-child(7) {29-webkit-transform: rotate(120deg);30-moz-transform: rotate(120deg);31}32#hours > li:nth-child(8) {33-webkit-transform: rotate(150deg);34-moz-transform: rotate(150deg);35}36#hours > li:nth-child(9) {37-webkit-transform: rotate(180deg);38-moz-transform: rotate(180deg);39}40#hours > li:nth-child(10) {41-webkit-transform: rotate(210deg);42-moz-transform: rotate(210deg);43}44#hours > li:nth-child(11) {45-webkit-transform: rotate(240deg);46-moz-transform: rotate(240deg);47}48#hours > li:nth-child(12) {49-webkit-transform: rotate(270deg);50-moz-transform: rotate(270deg);51}
The first line sets the padding, so that each hour arm begins 80px from the center. The rest set up the individual rotations for each arm, at 30 degrees each. The minute and second hands have more padding, and rotate 6 degrees for each arm. The rest of the CSS in the file is used to style the clock, and to show/hide the extra text.
Javascript
All we need to do for the javascript is create a function that sets class="active" on each arm of the current time. So, at 12:45 and 20 seconds, the 12 hour arm, the 45 minute arm, and the 20 second arm have class="active", and the rest are normal. Then we simply set an interval to run every second.
1$(function () {2var hours = $('#hours'),3minutes = $('#minutes'),4seconds = $('#seconds')56//these are default grabs so that the first time it runs, it doesn't throw an error7//after that, we use them to cache the current active arm for each group, so that we8//don't have to waste time searching9var cHour = $('html'),10cMinute = $('html'),11cSecond = $('html')1213var setCurrentTime = function () {14//establish what the time is15var currentTime = new Date()16var hour = currentTime.getHours() - 117if (hour == -1) {18hour = 1119}20var minute = currentTime.getMinutes() - 121if (minute == -1) {22minute = 5923}24var second = currentTime.getSeconds() - 125if (second == -1) {26second = 5927}28var ampm = 'am'29if (hour > 11) {30ampm = 'pm'31hour = hour - 1232}33if (hour == 11) {34ampm = 'pm'35}3637//remove the active class, and add it to the new time38cHour.removeClass('active')39cHour = hours.children(':eq(' + hour + ')').addClass('active')4041cMinute.removeClass('active')42cMinute = minutes.children(':eq(' + minute + ')').addClass('active')4344cSecond.removeClass('active')45cSecond = seconds.children(':eq(' + second + ')').addClass('active')4647$('body').removeClass('am').removeClass('pm').addClass(ampm)48}49//set the interval to run each second50setInterval(setCurrentTime, 1000)51})
It's a fun little experiment that doesn't have any real value on it's own, but it's a good exercise and as good of an excuse as any to play around with CSS transforms.
The full CSS file can be found here, and the javascript can be found here