Tweening by code comes to WPF

Darren David has just released the first public version of his tweening classes for Microsoft’s WPF. Called “PennerDoubleAnimation” and “Animator”, they’re hosted at Google Code and help developers create animations by code more easily while fighting some specific WPF caveats. To quote,

I had three primary goals in mind:

* Be able to start an animation and assign an “OnComplete” handler in one line of code
* Have those animations set the final value of the property to the “To” value of the animation, then disappear (basically, if I animate the Canvas.Left property of a Rectangle from 0 to 100, I expect the Canvas.Left property to be 100 when the animation completes, and I want to be able to assign a new value directly to that property)
* Bring the canonical Penner easing equations to WPF, but leverage the WPF animation engine so I can use them in XAML or in code.

Apparently he’s been successful on those goals. Check this blog post for more details.

  • Inspired by Tweener and the PennerDouble Animation, I’ve created my own engine for both Silverlight and WPF called the Artefact Animator. It actually uses the same class files to produce each version – so there are no surprises jumping back and forth between WPF and Silverlight. I’d encourage you to check it out over at

    There are a couple of other main differences inspired by Tweener. It doesn’t use storyboards and instead relies on getter/setters registered to the Type of value being animated, the DependencyProperty registered, or a string used as a shortcut – like “x” for Canvas.LeftProperty. Some other big ones include; animating multiple properties, more callbacks, and generally more access to animation information.