Packagealternativa.engine3d.animation
Classpublic class AnimationClip
InheritanceAnimationClip Inheritance AnimationNode Inheritance Object

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 also

alternativa.engine3d.animation.keys.Track
alternativa.engine3d.animation.keys.TransformTrack
alternativa.engine3d.animation.keys.NumberTrack
alternativa.engine3d.animation.AnimationController


Public Properties
 PropertyDefined By
  animated : Boolean = true
Handles the active animation execution.
AnimationClip
 InheritedisActive : Boolean
[read-only] Determines if the animation is active.
AnimationNode
  length : Number = 0
Length of animation in seconds.
AnimationClip
  loop : Boolean = true
Defines if animation should be repeated.
AnimationClip
  name : String
Name of the animation clip.
AnimationClip
  normalizedTime : Number
Current normalized time in the interval [0, 1].
AnimationClip
  notifiers : Vector.<AnimationNotify>
[read-only] The list of notification triggers.
AnimationClip
  numTracks : int
[read-only] Number of tracks in the AnimationClip.
AnimationClip
  objects : Array
The list of animated objects.
AnimationClip
 Inheritedparent : AnimationNode
[read-only] Parent of this node in animation tree hierarchy.
AnimationNode
 Inheritedspeed : Number = 1
Animation speed.
AnimationNode
  time : Number
Current time of animation.
AnimationClip
Public Methods
 MethodDefined By
  
AnimationClip(name:String = null)
Creates a AnimationClip object.
AnimationClip
  
addNotify(time:Number, name:String = null):AnimationNotify
Creates an AnimationNotify instance which is capable of firing notification events when playback reaches the specified time on the time line.
AnimationClip
  
addNotifyAtEnd(offsetFromEnd:Number = 0, name:String = null):AnimationNotify
Creates an AnimationNotify instance which is capable of firing notification events when playback reaches the specified time on the time line.
AnimationClip
  
Adds a new track to the animation clip.
AnimationClip
  
attach(object:Object, includeDescendants:Boolean):void
Binds tracks from the animation clip to given object.
AnimationClip
  
Clones the clip.
AnimationClip
  
getTrackAt(index:int):Track
Returns the track object instance that exists at the specified index.
AnimationClip
  
Removes specified notification trigger.
AnimationClip
  
Removes the specified track from the clip.
AnimationClip
  
slice(start:Number, end:Number):AnimationClip
Returns a fragment of the clip between specified bounds.
AnimationClip
  
Updates the length of the clip in order to match with length of longest track.
AnimationClip
Property Detail
animatedproperty
public var animated:Boolean = true

Handles the active animation execution. Plays animation if value is true.

See also

lengthproperty 
public var length:Number = 0

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 also

loopproperty 
public var loop:Boolean = true

Defines if animation should be repeated.

nameproperty 
public var name:String

Name of the animation clip.

normalizedTimeproperty 
normalizedTime:Number

Current normalized time in the interval [0, 1].


Implementation
    public function get normalizedTime():Number
    public function set normalizedTime(value:Number):void
notifiersproperty 
notifiers:Vector.<AnimationNotify>  [read-only]

The list of notification triggers.


Implementation
    public function get notifiers():Vector.<AnimationNotify>
numTracksproperty 
numTracks:int  [read-only]

Number of tracks in the AnimationClip.


Implementation
    public function get numTracks():int
objectsproperty 
objects:Array

The list of animated objects. Animation tracks are bound to the objects by object names.


Implementation
    public function get objects():Array
    public function set objects(value:Array):void

See also

Track.object
timeproperty 
time:Number

Current time of animation.


Implementation
    public function get time():Number
    public function set time(value:Number):void
Constructor Detail
AnimationClip()Constructor
public function AnimationClip(name:String = null)

Creates a AnimationClip object.

Parameters
name:String (default = null) — name of the clip
Method Detail
addNotify()method
public function addNotify(time:Number, name:String = null):AnimationNotify

Creates an AnimationNotify instance which is capable of firing notification events when playback reaches the specified time on the time line.

Parameters

time:Number — The time in seconds to which the notification trigger will be bound.
 
name:String (default = null) — The name of AnimationNotify instance.

Returns
AnimationNotify — A new instance of AnimationNotify class bound to specified time counting from start of the time line.

See also

addNotifyAtEnd()method 
public function addNotifyAtEnd(offsetFromEnd:Number = 0, name:String = null):AnimationNotify

Creates an AnimationNotify instance which is capable of firing notification events when playback reaches the specified time on the time line. The time is specified as an offset from the end of time line towards its start.

Parameters

offsetFromEnd:Number (default = 0) — The offset in seconds from the end of the time line towards its start, where the event object will be set in.
 
name:String (default = null) — The name of notification trigger.

Returns
AnimationNotify — A new instance of AnimationNotify class bound to specified time.

See also

addTrack()method 
public function addTrack(track:Track):Track

Adds a new track to the animation clip. The total length of the clip is recalculated automatically.

Parameters

track:Track — track which should be added.

Returns
Track — added track.

See also

attach()method 
public function attach(object:Object, includeDescendants:Boolean):void

Binds tracks from the animation clip to given object. Only those tracks which have object property equal to the object's name are bound.

Parameters

object:Object — The object to which tracks are bound.
 
includeDescendants:Boolean — If true, the whole tree of the object's children (if any) is processed.

See also

clone()method 
public function clone():AnimationClip

Clones the clip. Both the clone and the original reference the same tracks.

Returns
AnimationClip
getTrackAt()method 
public function getTrackAt(index:int):Track

Returns the track object instance that exists at the specified index.

Parameters

index:int — index.

Returns
Track — the track object instance that exists at the specified index.
removeNotify()method 
public function removeNotify(notify:AnimationNotify):AnimationNotify

Removes specified notification trigger.

Parameters

notify:AnimationNotify — The notification trigger to remove.

Returns
AnimationNotify — The removed notification trigger.
removeTrack()method 
public function removeTrack(track:Track):Track

Removes the specified track from the clip. The clip length is automatically recalculated.

Parameters

track:Track — track which should be removed.

Returns
Track — removed track.

See also

slice()method 
public function slice(start:Number, end:Number):AnimationClip

Returns a fragment of the clip between specified bounds.

Parameters

start:Number — The start time of a fragment in seconds.
 
end:Number (default = NaN) — The end time of a fragment in seconds.

Returns
AnimationClip — The clip fragment.
updateLength()method 
public function updateLength():void

Updates the length of the clip in order to match with length of longest track. Should be called after track was changed.