/**
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
* If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice.
* You may add additional accurate notices of copyright ownership.
*
* It is desirable to notify that Covered Software was "Powered by AlternativaPlatform" with link to http://www.alternativaplatform.com/
* */
package alternativa.engine3d.animation {
import alternativa.engine3d.alternativa3d;
import alternativa.engine3d.animation.keys.Track;
import alternativa.engine3d.core.Object3D;
use namespace alternativa3d;
/**
*
* Plays complex animation which consists of a set of animation tracks.
* Every animated property of every model's element presented by separated track.
* Track is somewhat similar to separate animated layer in Flash, but the layer stores animation of all properties for some element at once.
* In opposite, track stores animation for every property (for an example, separate track for a scale and separate track for a coordinates).
* Track also can contain keyframes in arbitrary positions. Frames, contained between keyframes, are linearly interpolated
* (i.e. behave themselves like a timeline frames in flash, for which motion twin was created ).
* Animation clip connects each track with a specific object.
* Animation clip stores information about animation for the whole model, i.e. for any element state at any time moment.
* Animation works handled by AnimationController.
*
* @see alternativa.engine3d.animation.keys.Track
* @see alternativa.engine3d.animation.keys.TransformTrack
* @see alternativa.engine3d.animation.keys.NumberTrack
* @see alternativa.engine3d.animation.AnimationController
*/
public class AnimationClip extends AnimationNode {
/**
* @private
*/
alternativa3d var _objects:Array;
/**
* Name of the animation clip.
*/
public var name:String;
/**
* Defines if animation should be repeated.
*/
public var loop:Boolean = true;
/**
* Length of animation in seconds. If length of any animation track is changed, updateLength()
* method should be called to recalculate the length of the clip.
*
* @see #updateLength()
*/
public var length:Number = 0;
/**
* Handles the active animation execution. Plays animation if value is true.
*
* @see AnimationNode#isActive
*/
public var animated:Boolean = true;
/**
* @private
* Current value of time.
*/
private var _time:Number = 0;
/**
* @private
*/
private var _numTracks:int = 0;
/**
* @private
*/
private var _tracks:Vector.