Packagecom.pblabs.animation
Classpublic class Animator
InheritanceAnimator Inheritance flash.events.EventDispatcher
Subclasses FrameAnimator, PointAnimator

Class for animating between a start value and end value.

To animate more complex types, subclass this and implement the interpolate method.



Public Properties
 PropertyDefined By
  animationType : AnimatorType
The type of playback to use for the animation.
Animator
  currentValue : *
[read-only] The current value of the animation.
Animator
  duration : Number
The time it should take to animate from the start value to the target value.
Animator
  ease : Function
The current ease function that will be used to animate from start to target value
Animator
  elapsed : Number
[read-only] The amount of time that has passed since the animation started.
Animator
  isAnimating : Boolean
[read-only] Whether or not the animation is currently playing.
Animator
  repeatCount : int
The current number times the animation will be repeated.
Animator
  startValue : *
The value the animation should start at.
Animator
  targetValue : *
The value to animate to.
Animator
  totalRepeatCount : int
[read-only] The total number of times to repeat the animation.
Animator
Public Methods
 MethodDefined By
  
animate(elapsed:Number):void
This should be called every frame to perform the animation.
Animator
  
finish():void
Set the current value to the target value instantly.
Animator
  
play():void
Starts playback.
Animator
  
reset():void
Resets the animation to all the values it had before it started playing.
Animator
  
reverse():void
Reverses the animation, effectively setting the start value to the target value and the target value to the start value.
Animator
  
start(startValue:*, targetValue:*, duration:Number, type:AnimatorType, repeatCount:int = 0):void
Starts the animation.
Animator
  
stop():void
Stops playback.
Animator
Protected Methods
 MethodDefined By
  
doEase(start:*, end:*, elapsed:Number, duration:Number):*
Applies an ease function Can be overridden to support easing objects
Animator
  
interpolate(start:*, end:*, time:Number):*
Performs the actual animation.
Animator
Events
 Event Summary Defined By
   This event is dispatched by an Animator when the animation completely finishes.Animator
   This event is dispatched by an Animator when the animation has finished one iteration and is repeating.Animator
   This event is dispatched by an Animator when the animation is resumed after being manually stopped.Animator
   This event is dispatched by an Animator when the animation first starts.Animator
   This event is dispatched by an Animator when the animation is manually stopped.Animator
Property Detail
animationTypeproperty
animationType:AnimatorType

The type of playback to use for the animation.


Implementation
    public function get animationType():AnimatorType
    public function set animationType(value:AnimatorType):void
currentValueproperty 
currentValue:*  [read-only]

The current value of the animation.


Implementation
    public function get currentValue():*
durationproperty 
duration:Number

The time it should take to animate from the start value to the target value.


Implementation
    public function get duration():Number
    public function set duration(value:Number):void
easeproperty 
ease:Function

The current ease function that will be used to animate from start to target value


Implementation
    public function get ease():Function
    public function set ease(value:Function):void
elapsedproperty 
elapsed:Number  [read-only]

The amount of time that has passed since the animation started.


Implementation
    public function get elapsed():Number
isAnimatingproperty 
isAnimating:Boolean  [read-only]

Whether or not the animation is currently playing.


Implementation
    public function get isAnimating():Boolean
repeatCountproperty 
repeatCount:int

The current number times the animation will be repeated.


Implementation
    public function get repeatCount():int
    public function set repeatCount(value:int):void
startValueproperty 
startValue:*

The value the animation should start at.


Implementation
    public function get startValue():*
    public function set startValue(value:any):void
targetValueproperty 
targetValue:*

The value to animate to.


Implementation
    public function get targetValue():*
    public function set targetValue(value:any):void
totalRepeatCountproperty 
totalRepeatCount:int  [read-only]

The total number of times to repeat the animation.


Implementation
    public function get totalRepeatCount():int
Method Detail
animate()method
public function animate(elapsed:Number):void

This should be called every frame to perform the animation.

Parameters

elapsed:Number — The amount of time that has elapsed since the last call to this.

doEase()method 
protected function doEase(start:*, end:*, elapsed:Number, duration:Number):*

Applies an ease function Can be overridden to support easing objects

Parameters

start:*
 
end:*
 
elapsed:Number
 
duration:Number

Returns
*
finish()method 
public function finish():void

Set the current value to the target value instantly.

interpolate()method 
protected function interpolate(start:*, end:*, time:Number):*

Performs the actual animation. This can be overridden by subclasses to interpolate more complex types. This default implementation will only work for values that can use the +, -, and operators.

Parameters

start:* — The value to interpolate from.
 
end:* — The value to interpolate to.
 
time:Number — The interpolation factor. A value of 0 will return the start value, a value of 1 will return the end value. A value of 0.5 should return the value half way between start and end.

Returns
* — The interpolated value.
play()method 
public function play():void

Starts playback.

reset()method 
public function reset():void

Resets the animation to all the values it had before it started playing.

reverse()method 
public function reverse():void

Reverses the animation, effectively setting the start value to the target value and the target value to the start value.

start()method 
public function start(startValue:*, targetValue:*, duration:Number, type:AnimatorType, repeatCount:int = 0):void

Starts the animation. This is simply a shorthand way to specify all the necessary parameters for playback. Play can be called instead if the properties are already set.

Parameters

startValue:*
 
targetValue:*
 
duration:Number
 
type:AnimatorType
 
repeatCount:int (default = 0)

stop()method 
public function stop():void

Stops playback. It can be resumed by calling Play.

Event Detail
ANIMATION_FINISHED_EVENT Event
Event Object Type: com.pblabs.animation.AnimationEvent
AnimationEvent.type property = com.pblabs.animation.AnimationEvent.ANIMATION_FINISHED_EVENT

This event is dispatched by an Animator when the animation completely finishes.
ANIMATION_REPEATED_EVENT Event  
Event Object Type: com.pblabs.animation.AnimationEvent
AnimationEvent.type property = com.pblabs.animation.AnimationEvent.ANIMATION_REPEATED_EVENT

This event is dispatched by an Animator when the animation has finished one iteration and is repeating.
ANIMATION_RESUMED_EVENT Event  
Event Object Type: com.pblabs.animation.AnimationEvent
AnimationEvent.type property = com.pblabs.animation.AnimationEvent.ANIMATION_RESUMED_EVENT

This event is dispatched by an Animator when the animation is resumed after being manually stopped.
ANIMATION_STARTED_EVENT Event  
Event Object Type: com.pblabs.animation.AnimationEvent
AnimationEvent.type property = com.pblabs.animation.AnimationEvent.ANIMATION_STARTED_EVENT

This event is dispatched by an Animator when the animation first starts.
ANIMATION_STOPPED_EVENT Event  
Event Object Type: com.pblabs.animation.AnimationEvent
AnimationEvent.type property = com.pblabs.animation.AnimationEvent.ANIMATION_STOPPED_EVENT

This event is dispatched by an Animator when the animation is manually stopped.