Rss

Animation Tracks

Animation in ISE works off a generic Track<> class with given animation types (i.e. Vector, Trajectory, Euler).

Core Animation
All tracks are attached to an “Animation Target”, which is basically a reference to a class property. Then, when the Track is added to a Scene, the Property is automatically animated.

Example:

Let’s say we have a class object representing “Aliens”, and we want to animate “Alien1”, using it’s custom Location property, which is a Vector. First we need to create the AnimateTarget:

AnimateTarget<Vector> Alien1Flyby = new AnimateTarget<Vector>(Alien1, "Location", -1);

The -1 indicates that the Location property is not indexed. A value >=0 will indicate that the Property is indexed, and represent the index to use.

Now that the AnimateTarget is created, it can be animated:

Track<Vector> alientrack = new Track<Vector>(Alien1Flyby, 2.5f, KeyType.Smooth, new Vector(0,0,0), new Vector(1,1,2), new Vector(2,1,2), new Vector(3,3,3));

 

This will create an animated Track attached to Alien1’s Location property, lasting for 2.5 seconds, using Smooth interpolation, and then use the 4 KeyFrames that are passed. The Keyframes is a flexible-length parameter (must be at least 1 though!), and the Track will automatically spread out the keyframes evenly across the Time.

Now the Track has been created, add it to the Scene:

 

myScene.Add(alientrack);

 

And that’s it!

Other Options

It doens’t need to be a Vector, supported property types include Double, Float, Int, Scalar, Color, Trajectory, Point, Euler.

Double, Int and Float are special cases. The Property can be a float, but the animate keyframe type must be AnimateFloat, as the keyframe must contain the ability to interpolate with Bezier splines. These clasees have been provided.

Animating a Composite.

A Composite is an array of multiple Coordinate Primitives, so as such a Composite cannot animate as a whole, however you can animate individual Primtiives in the Array easily. Use the PropertyIndex of the AnimateTarget to select the index in the Composite to animate.

Animating without a Property

You can create a Track without an AnimateTarget. In this case, the Track will have a CurrentValue property representing it’s currently animated value, which you may then reference for your own purposes.