Archive for the ‘Articles’ Category
While working on OrangeNote, I decided that I wanted a nice modern spinner animation to indicate when a task (like a note search) was being performed asynchronously in the background. You see these things everywhere, and I personally find them pretty slick, but I couldn’t find anything out there already cooked up in WPF, and figured it would be a good learning experience (especially with regards to animation), so I decided to whip up my own.
It didn’t take long before I ran into a pretty solid limitation (or oversight perhaps) concerning animations in WPF: they are all specified with respect to a single property to be animated. In other words, there’s no global, top-down view of the state of objects involved in an animation–everything is fragmented and split up into parallel timelines. Time is innately global. It’s perhaps the most global of all things.
Suffice it to say I found this frustrating and confusing, so my quest to develop a spinning wheel animation quickly escalated into something much more: a new way to do animation in WPF.
I pulled up a copy of WordPad (OrangeNote wasn’t quite usable at this point) and jotted down some rough theoretical ideas for how I might achieve what I wanted. I wanted to keep it simple, and reuse as much of the existing infrastructure as possible, while focusing on enabling multiple properties to be animated together within the confines of a single sequential timeline. I decided the best approach was to think of transforming an ideal representation into an equivalent native representation that WPF could understand. It all has to do with factoring (yes, the same kind of factoring from high-school algebra). The idea is this: take a time-dominant form of representing an animation (where time is on the outside, and property states–represented by Setters–are on the inside) and turn it into the native property-dominant form that WPF is based on.
Turns out it worked. You can read all about it in my latest Code Project article. So if you’re stuck on a particularly complicated animation in WPF and are frustrated that you can’t think globally, check it out. And for that matter, tell your friends too. It’s completely free and open source, of course, and it even includes a spinning wheel demo project. 😉