Sunday, September 19, 2010

XNA Storyboard

Project Description
XNA Storyboard provides a Storyboard system for XNA similar to Silverlight's, using DependencyObjects and DependencyProperties developed in C#.
The purpose of this project is to provide an easy to use, yet robust mechanism for animating virtually any kind of value over time.
TargetAction usage
This method is the quickest to implement and will likely integrate the easiest into an existing code base since it does not require you to use DependencyObject/DependencyProperty.
The drawback to this method is that it requires consumption of the updated values on the developer's part, instead of updating a property directly
Basic Example
1. Create an instance of the Storyboard object
Storyboard sb = new Storyboard( yourGameInstance );
Note: Storyboard automatically adds itself to your game instance's Components collection, so it will receive Update messages automatically and simply do it's work after you call Begin
2. Create one or more animations you would like your Storyboard to perform
Storyboard sb = new Storyboard( yourGameInstance );
FloatAnimation fa = new FloatAnimation()
{
   Duration = TimeSpan.FromSeconds( 1.0 ),
   From = 0.0f,
   To = 1.0f
};
sb.Children.Add( fa );
Read more: Codeplex