Tic toc tic toc
Tuesday, 18. April 2006, 02:09:46
Of course, you need an SVG-capable browser that handles simple javascript and a reasonable level of animation to see the full clock. As I write, that rules out Firefox, means that you need a build of Opera Merlin (technical preview 2 or one of the more recent weekly builds), or it should work in any browser with the old Adobe SVG viewer.
The cool thing is that the basic code is simple. There is one javascript (mostly, admittedly, because I am bad at writing javascript), and the rest is done with declarative animation. It has a few nifty features - clicking on the background changes it (this is one short line per skin, although with a couple of lines I could do a funky flip effect), and you can adjust it with the winder button (like a real clock). Because SMIL Animation 1.0 has no pause/resume function, adjusting it multiple times might feel a bit wierd unless you reset it. And it needs some work still - no metadata or description yet
I made it mostly as a learning exercise for an article that should be ready in a couple of weeks, about SVG animation, but if you can't wait, check out the source code. With some comments, an attempt to keep it reasonably clean, an embedded PNG and no compression the thing is all of 8k. If I wanted to reduce the codesize it would be easy enough to halve that.
And if this all seems too technical and dull, but you still got this far, here are some more screenshots...

Funny thing is, the winder was easy to code, but I spent a long time spec-reading to understand why it behaves funny if you go forward or backward more than once each without resetting. (Because there is no pause - you have to change the old adjustment for a new one if you use it again). Until then, I racked my brains over the reset button and javascript wierdness. But once I understood what was happening, the reset button literally took me less than 15 seconds to code and test. The hard part turned out to be putting the red rectangle in the right place - 3 seconds of thinking time required...
The hardest coding bit of the lot was getting the little dots for minutes and seconds. The price of two short lines of elegant code was half an hour with a calculator. Still, now I know how to do it right the first time, and can repeat it in about 5 minutes. And two lines of code is a cheap way of making it happen.
Hope you enjoy it. There are, of course, other SVG clocks out there. If I had seen Doug Schepers' efforts earlier I might not have been motivated to learn quite as much as I did. So I am glad I started with my head in the sand for this exercise.
I attended the two speeches you had at the gathering, and I really like what you stand for and how you present yourself. I do find it kind of weird to meet people like you which I watch and hear alot about, but never actually meet (it's often like that in Norway, we don't really get alot of closeups with the good software guys).
Anyhow, like I said, I think it's great that you chose Opera above other companies and after being a Firefox user for a long time, I really do feel that Opera is a better browser, just so very completed. The bittorrent features alone is a great reason to get it.
I guess it comes down to that I really love the fact that you were at the gathering and hung out with us, it really, really inspires us small norwegians to get up and become something.
By jorgen_veisdal, # 18. April 2006, 12:43:12
thanks. Yes, I think BitTorrent is a very cool thing. It is one of a big handful of things that only some people realise are in Opera. In my list are also zoom and keboard control (my interest in accessibility is substantially personal
But the best thing, I think, is that there is a choice of standards-based browsers. Different interfaces, different features, different prices (Yep, even though Opera is now free for desktops, you can still buy some browsers, and you can always pay for support), different styles.
Norway is a bit like Australia - it's hard to get people to visit and hang out. But it's worth visiting both places, because there are some exciting things happening. And everybody has something cool and unique to teach, if I only have the time to find out what it is.
Anyway, I enjoyed hanging out at the Gathering, sleeping on a shelf (please nobody tell Jon I was perched so precariously a couple of metres above the precious prizes
By chaals, # 18. April 2006, 16:35:41
Update!
New version hasn't changed the basic functionality, but I did do some code clean-up, and added metadata (title, author info, ...)
It's in the same place as the old one was. That version is hereby consigned to wierd archives, as it should be.
By chaals, # 18. April 2006, 17:19:34
A great thing people who couldn't make it! Recommend it to anyone interested in standards, Opera or just a good talk.
By jorgen_veisdal, # 23. April 2006, 14:46:38
This is valuable if thousands of people are looking at it (something that would be a surprise to me, in this particular case. But you never know).
By chaals, # 24. April 2006, 00:56:16