Latest News

January 24th, 2008:
Added Vector2Tweener and Vector3Tweener for moving in more dimensions.
Added new PositionChanged event for better handling of updates.
January 6th, 2008: Updated release 1.0 with bugfix for bug #231

Project Description

This is a library for XNA for doing animation movement - tweening. Can be used for movement, color changes, fades and whaterver you can dream up that has to be changed over time.

The XNA Tweener library exposes the Tweener class and 11 different easing equations for making advanced animation movement easy:

Linear
Quadratic
Cubic
Quartic
Quintic
Sinusoidal
Exponential
Circular
Elastic
Back
Bounce

Each equation has functions for both easing in and out and both in and out, which gives you a full 31 different ways to tween. You can also provide your own tweening equations by passing a delegate to the Tweener class.

The included equations are all adaptions from the fabulous Easing framework for Flash/ActionScript made by Robert Penner.

The Tweener class tweens float values, so it is flexible and not tied to positioning. So you can easily tween for instance rotation or scale.

Included is a demo project that shows how the library works.

Usage

  1. Create the Tweener

        Tweener tweener = new Tweener(0, Math.PI, TimeSpan.FromSeconds(2.0f), Bounce.EaseOut); 
        tweener.PositionChanged += delegate (float newRotation) { myRotation = newRotation } 

  1. Update the Tweener on each frame and read the new position

        protected override void Update(GameTime gameTime)
        {
             ...
             tweener.Update(gameTime);
             ...
        }

  1. When the tweener is finished you can react to the Ended event

        tweener.Ended += DoSomethingCrazy();

Future development

  • Make a 360 demo project
  • Make tweener classes for Color structure and the all powerful PropertyTweener
  • Make a tweening function to use the Curve class from XNA
  • Looping

Great stuff?

If you are using this library and want to encourage further deveolpment of it, or just show appreciation for the work that has been done - please consider making a donation to the project.

You can also just post comments telling me how much the library rocks/sucks. Suggestions for future directions of the project, and of course code is also appreciated - it shows that you care for it!

If you make great games with it, please tell me and I will post it here.

Have fun. Make cool games.

Last edited Jan 24, 2008 at 9:29 PM by fehaar, version 14