Monday, October 27, 2008

Flex Specific[anim]ations Posted

We've just posted a couple of specifications on the Flex open source site about the new animation work going into the next release of Flex ('Gumbo'). Check them out if you're interested, and give us feedback if you have any suggestions (on the forums if you'd like, but I'd be happy with comments on this blog as well, since I'm all about the new effects for this release).

The New Effects spec discusses the new animated effect base class, FxAnimate, along with several subclasses that implement the new effects. Many of these effects should look familiar to those already using Flex (FxMove looks an awful lot like Move, FxResize is strangely similar to Resize, etc.). The main change is that the new effects will act on both components (like the old effects) as well as the new graphics elements (which the old effects don't handle, as discussed in the spec). In fact, targets of the new effects could be any types of objects at all, although many of the effects do assume particular public properties (such as FxMove assuming that the target has "x" and "y" properties). For example, FxAnimate can be used to animate an arbitrary set of properties on the target, with no assumption of what type it is.

There is also a fairly big change in the Effect internals, in the way that FxAnimate actually changes properties, and in its use of the new Animation class, which is discussed in ...

The Arbitrary Type Interpolation spec covers the new Animation class, which is basically a rewrite of the old Flex Tween class. It changes the way that time and value are eased (splitting the old 'easing' process into separate time-interpolation and value-interpolation steps), which allows both more flexibility and the ability to animate properties that are not simple Numbers. One example of this capability is seen in the new ColorInterpolator class, which is used in the new FxAnimateColor effect covered in the first spec above.

Intrepid readers will notice that these specs, and the underlying code, bear a remarkable resemblance to the Flexy library posted here a few weeks ago. Barring some name changes since then and other small API tweaks, the functionality is exactly the same. The capabilities exposed in Flex are greater than those in Flexy, in particular at the higher 'effects' level, because Flex can perform more work when it knows what it's animating (so FxMove can query the state-transition system to automatically derive from/to values, for example). But the underlying classes (especially Animation and the interpolation and easing classes) are the same between these projects.

Please check out the specs, check out the code, play with it, and let us know what you think.

Note that the APIs, and the specs, will change over time to reflect more API modifications and additions. But the essential ideas of the effects architecture are in there and ripe for building upon.

In the meantime, I'll be working on more functionality for the effects system. Ideally, I would be writing some blogs and demos about all of the new stuff now, but I'm focusing on getting stuff working for MAX now and can't take a break for demoing the goodies just yet. They call them deadlines for a reason (make it to the finish line or you're dead). I'll definitely have some stuff to show at MAX in late November, however, and also at Devoxx in Antwerp in December, and will certainly get around to posting some blog entries on it after that.

No comments: