2 ms·
Very nice indeed. Technically you should be able to do the same thing in CSS... I knocked this together in 20 minutes as a proof of concept: http://codepen.io/o
by onion2k 13y ago
Very nice indeed. Technically you should be able to do the same thing in CSS... I knocked this together in 20 minutes as a proof of concept: http://codepen.io/onion2k/details/kmouK http://codepen.io/onion2k/details/kmouK
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.
- Edmond 13y agoyeah you'll need some code to animate the handles.
- onion2k 13y agoIf by 'handles' you mean hands, what I built does that with CSS3's animation and transformations. No JS necessary. It's setting the initial positions that's the problem - CSS has no clock functionality. 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.
- Edmond 13y agoapparently a firefox issue, it doesn't animate in FF but does in Chrome.
- onion2k 13y agoThat's actually a lazy-developer-only-bothered-with-the-webkit-animation-class issue rather than a Firefox issue. Adding keyframes, moz-keyframes, and o-keyframes would make it cross-browser.
- schiffern 13y ago> The only non-JS solution is to tell people to only load the page at exactly 12:00:00 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().
- jwarren 13y agoFor extreme impracticality, you could have server-side generated CSS which outputs the right CSS values depending on what time it's requested. Then no JS is required.
- leephillips 13y agoI made a star chart, which is kind of like a clock in the form of a map of the sky, in pure HTML/CSS, that starts at the correct current time without resorting to JS: http://lee-phillips.org/skymap/ http://lee-phillips.org/skymap/ You might consider my solution cheating, however. EDIT: The trick I used is basically what jwarren describes below.
- onion2k 13y agoInteresting article and a great app. But yeah, that's "cheating". :)