| Package | com.pblabs.animation |
| Class | public class Animator |
| Inheritance | Animator flash.events.EventDispatcher |
| Subclasses | FrameAnimator, PointAnimator |
To animate more complex types, subclass this and implement the interpolate method.
| Property | Defined 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 | ||
| Method | Defined 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 | ||
| Method | Defined 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 | ||
| 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 | |||
| animationType | property |
animationType:AnimatorTypeThe type of playback to use for the animation.
public function get animationType():AnimatorType public function set animationType(value:AnimatorType):void| currentValue | property |
currentValue:* [read-only] The current value of the animation.
public function get currentValue():*| duration | property |
duration:NumberThe time it should take to animate from the start value to the target value.
public function get duration():Number public function set duration(value:Number):void| ease | property |
ease:FunctionThe current ease function that will be used to animate from start to target value
public function get ease():Function public function set ease(value:Function):void| elapsed | property |
elapsed:Number [read-only] The amount of time that has passed since the animation started.
public function get elapsed():Number| isAnimating | property |
isAnimating:Boolean [read-only] Whether or not the animation is currently playing.
public function get isAnimating():Boolean| repeatCount | property |
repeatCount:intThe current number times the animation will be repeated.
public function get repeatCount():int public function set repeatCount(value:int):void| startValue | property |
startValue:*The value the animation should start at.
public function get startValue():* public function set startValue(value:any):void| targetValue | property |
targetValue:*The value to animate to.
public function get targetValue():* public function set targetValue(value:any):void| totalRepeatCount | property |
totalRepeatCount:int [read-only] The total number of times to repeat the animation.
public function get totalRepeatCount():int| animate | () | method |
public function animate(elapsed:Number):voidThis 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 |
* |
| finish | () | method |
public function finish():voidSet 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.
|
* — The interpolated value.
|
| play | () | method |
public function play():voidStarts playback.
| reset | () | method |
public function reset():voidResets the animation to all the values it had before it started playing.
| reverse | () | method |
public function reverse():voidReverses 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):voidStarts 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():voidStops playback. It can be resumed by calling Play.
| ANIMATION_FINISHED_EVENT | Event |
com.pblabs.animation.AnimationEventcom.pblabs.animation.AnimationEvent.ANIMATION_FINISHED_EVENTThis event is dispatched by an Animator when the animation completely finishes.
| ANIMATION_REPEATED_EVENT | Event |
com.pblabs.animation.AnimationEventcom.pblabs.animation.AnimationEvent.ANIMATION_REPEATED_EVENTThis event is dispatched by an Animator when the animation has finished one iteration and is repeating.
| ANIMATION_RESUMED_EVENT | Event |
com.pblabs.animation.AnimationEventcom.pblabs.animation.AnimationEvent.ANIMATION_RESUMED_EVENTThis event is dispatched by an Animator when the animation is resumed after being manually stopped.
| ANIMATION_STARTED_EVENT | Event |
com.pblabs.animation.AnimationEventcom.pblabs.animation.AnimationEvent.ANIMATION_STARTED_EVENTThis event is dispatched by an Animator when the animation first starts.
| ANIMATION_STOPPED_EVENT | Event |
com.pblabs.animation.AnimationEventcom.pblabs.animation.AnimationEvent.ANIMATION_STOPPED_EVENTThis event is dispatched by an Animator when the animation is manually stopped.