Wednesday, December 9, 2009

SVG/SMIL "Dock" Demo

Today, I decided to see what what it'd be like to make an MacOS-style "dock" in SVG, using SMIL <animateTransform> elements to achieve the zooming hover effects.

Once I got that working, I felt like I really should make the icons do something useful when you click them. So, I hooked them up to control an embedded iframe.

Here's the result: SMIL Dock

Screenshot:


Screencast:


(Note that the demo will only do anything useful in a mozilla-central nightly build -- that is, Firefox 3.7 / Gecko 1.9.3 -- since earlier versions don't have support for SMIL.)

Tuesday, December 8, 2009

SVG Animation in Action: Marek Raida's "SVG Cavern Fighter" Game

Marek Raida has come up with another beautiful demo that shows off the power of SVG. This one's called SVG Cavern Fighter, and it's a classic side-scrolling shoot-em-up type game, with enemies and items that pulse and wiggle. The game logic is written in Javascript, and the enemy/item animations are all done with SMIL.

It looks really great (and it's quite fun to play) in mozilla-central nightly builds! (In earlier Firefox versions, with no SMIL support, the game logic still mostly works, but the enemies and items won't animate.)

Marek's been iterating on this game pretty rapidly, adding new features and fixing bugs every few days. His latest version will always be linked from his blog. Give it a try, and send him any feedback that you might have!

Monday, October 26, 2009

SMIL enabled by default on nightly builds!

Good news: SVG Animation (SMIL) support is now enabled by default in mozilla-central nightly builds!

SMIL support has actually been built into our nightlies for some time now, but until last week, it was turned off by default, using an about:config preference. But we're confident that it will be ready to ship in Firefox 3.7 and that it's stable enough for our nightly testers to give it a spin, so we've flipped the switch!

Brian Birtles has a nice status page, documenting what currently works and what's not yet supported.

In particular, SMIL animation now works for most SVG-recognized CSS properties. Colors, numeric values like opacities & lengths, and enumerated values should all work, and I'm working on remaining types (see below). With support for CSS properties, we can make much prettier animations now, with flashing colors and fade-in using opacity -- for example, this simple demo.

Marek Raida has some fun demos on his blog, too -- I especially like the 'good spirit' animation and the 'digging' animation (which requires scripting for handling mouse events).

Here's what's on the immediate roadmap for people working on SMIL:

  • dholbert: Finish off support for CSS properties (bug 520239, bug 520487, bug 520488)

  • jwatt: Support more SVG properties (e.g. bug 522267)

  • birtles: Support syncbase timing - that is, animations whose start/end times are dependent on other animations. (bug 474743)


So, play away! I'm looking forward to feedback from nightly testers.

Friday, January 16, 2009

SVG Animation (SMIL) support has landed!

Great news: support for SVG Animation (using SMIL) has now landed in mozilla-central! Zbigniew Braniecki has posted a nice summary of the history of this feature's development at Mozilla.

Great thanks to Brian Birtles for his excellent work on this patch (both in its early days and also during his Mozilla internship thus far), to Robert O'Callahan for his very thorough code-reviews, to Tim Rowley for keeping the patch up-to-date for so long, to Chris Double for his work on fixing crashes & adding features, and to Jeff Schiller for his moral support and patch-testing!

Now that SMIL has landed...
  • We can do really sweet animations directly in the browser, without any Javascript or Flash required. :)
  • We have improved support for the SVG specification
  • We win two more points on the Acid3 Test (in smil-enabled builds) for a total score of 95.
A few caveats:
  • This is mostly an initial framework for us to build upon, so it's still missing a number of key features (which will enable yet-more-awesome animations).
  • By default, the SMIL code is disabled via a build-time flag (see Bug 473705), so it's not included in nightly builds yet. (That will hopefully change as soon as we've got an about:config flag set up.)
For anyone interested in trying this out, give the tryserver build a spin! Or, if you compile your own builds, you can enable SMIL by adding "ac_add_options --enable-smil" to your .mozconfig file.

On my list of things to fix soon:
  • Bug 473904: Add an about:config toggle SMIL support
  • Bug 474049: Add support for animating CSS properties