Show HN: SVG Clocks
s3.amazonaws.com
s3.amazonaws.com
Sadly you'd need some JS to set them to the right time though, which rather ruins the beauty of it. I think. If anyone knows a way to do it without JS I'd love to hear how.
The only non-JS solution is to tell people to only load the page at exactly 12:00:00, but that's a bit impractical.
If it's just a problem of initialization, couldn't you include a continuously-updated current_time.css file served with cache-control: no-cache?
You could estimate timezone from IP. It's not perfect, but it's the best you're gonna get without getTimezoneOffset().
http://lee-phillips.org/skymap/
You might consider my solution cheating, however.
EDIT: The trick I used is basically what jwarren describes below.
Basically they were rendering an animated gif on the server and streaming to the browser, so that the watch told the correct time, but the hands appeared behind the glass of the photo-realistic watch.
This was when most sites (not that there were many!) only had rudimentary static graphics, with the odd flashing "under construction' sign.
I googled, but couldn't find any reference to it, although Roxen the company still seems to be going, with the Roxen Web Server having become a CMS platform.
//smooth-out the rotation of the hour hand: rotate 0.008333333 of a degree every second
hour_rotate_angle = ((30*tDate.getHours())-90)+(0.008333333*((tDate.getMinutes()*60)+tDate.getSeconds()));
hour_hand.setAttribute("transform", "rotate("+hour_rotate_angle+",50,50)");
hour_hand_shadow.setAttribute("transform", "rotate("+hour_rotate_angle+",50,50)");
360/0.008333333 is 43,200.43,200 seconds equates to only 12 hours, so I'm wondering if this clock is off because it's missing 12 hours out of the day. If I half the coefficient 0.008333333 to 0.004166666, does that make it correct...
I think I just ironed out my struggle. I'm posting this before I know the result... I hope the suspense is killing you all.
I only dug out these clocks over the weekend and tweaked the home page a bit before posting it here. I haven't touched the actual Javascript or svg in over 5 yrs!
I initially posted them so they could be used with iGoogle gadgets (remember those?) The original clocks where hosted on Google sites (just to show their age :)) https://sites.google.com/site/clockamatics/
If I had to guess, that magic number is some sort of compensator to smooth out the animation, but I honestly don't remember...should be a lesson for why code should be well documented:)
360 degrees divided by the number of seconds in 24-hours (86400) gives you your rotation value: 0.004166666 degrees of rotation per second.
Now all you need to know is the number of seconds that have elapsed for the current time:
hour_rotate_angle = (0.004166666*((tDate.getHours()*3600)+(tDate.getMinutes()*60)+tDate.getSeconds()));
If you replace lines 58 and 92 with this code, the 24-hour clock works.One downside of 24 hour clocks: a broken one is only right once a day.
I'm wondering if there are some uses for this, apart from just having a clock in your browser which is cool enough.
I noticed when it updates the second hand (this is present on most clocks). The hand moves and appears very blocking for several frames until anti-aliasing kicks in.
Is this a web browser issue?
(FF27, windows 7 x86_64).
What's the copyright/license on these?
Those were the days. Phoenix was the browser.
NetworkError: 403 Forbidden - https://s3.amazonaws.com/macslow/clock#{i}.svg?w=3&h=3
NetworkError: 403 Forbidden - https://s3.amazonaws.com/macslow/images/ui-bg_glass_75_e6e6e...
NetworkError: 403 Forbidden - https://s3.amazonaws.com/macslow/images/ui-icons_888888_256x...
NetworkError: 403 Forbidden - https://s3.amazonaws.com/macslow/images/ui-bg_flat_75_ffffff...