Animator Class
Animator is a static class designed to provided base animation functionality, using frame labels of MovieClips
Item Index
Methods
- _canAnimate static
- _hasTimelines static
- _makeTimeline static
- _makeTimeline static
- _remove static
- _startUpdate static
- _stopUpdate static
- destroy static
- getPaused
- getTimeline static
- init static
- onSoundDone
- onSoundStarted
- pause static
- pauseInGroup static
- play static
- playAtRandomFrame static
- static
- resume static
- stop static
- stopAll static
- toString static
Properties
- _optionsHelper
- _paused
- _removedTimelines
- _timelines
- _timelinesMap
- captions static
- debug static
- soundLib static
- VERSION static
Methods
_canAnimate
-
instance
Determines if a given instance can be animated by Animator, to allow things that aren't MovieClips from EaselJS to be animated if they share the same API. Note - 'id' is a property with a unique value for each createjs.DisplayObject. If a custom object is made that does not inherit from DisplayObject, it needs to not have an id that is identical to anything from EaselJS.
Parameters:
-
instanceeaseljs.MovieClipThe object to check for animation properties.
Returns:
If the instance can be animated or not.
_hasTimelines
()
Bool
private
static
Check to see if we have timeline
Returns:
if we have timelines
_makeTimeline
-
instance -
event -
onComplete -
onCompleteParams -
speed -
soundData
Creates the AnimatorTimeline for a given animation
Parameters:
-
instanceeaseljs.MovieClipThe timeline to animate
-
eventStringThe frame label event (e.g. "onClose" to "onClose stop")
-
onCompleteFunctionThe function to callback when we're done
-
onCompleteParamsFunctionParameters to pass to onComplete function
-
speedNumberThe speed at which to play the animation.
-
soundDataObjectData about sound to sync the animation to.
Returns:
The Timeline object
_makeTimeline
-
instance -
event
Checks if animation exists
Parameters:
-
instanceeaseljs.MovieClipThe timeline to check
-
eventStringThe frame label event (e.g. "onClose" to "onClose stop")
Returns:
does this animation exist?
_remove
-
timeline -
doOnComplete
Remove a timeline from the stack
Parameters:
-
timelineAnimatorTimeline -
doOnCompleteBoolIf we do the on complete callback
_startUpdate
()
private
static
Start the updating
_stopUpdate
()
private
static
Stop the updating
destroy
()
static
Stops all animations and cleans up the variables used.
getPaused
()
Bool
Whether the Animator class is currently paused.
Returns:
if we're paused or not
getTimeline
-
instance
Get the timeline object for an instance
Parameters:
-
instancecreatejs.MovieClipMovieClip
Returns:
The timeline
init
()
static
Sets the variables of the Animator to their defaults. Use when _timelines is null, if the Animator data was cleaned up but was needed again later.
onSoundStarted
-
timeline
The sound has been started
Parameters:
-
timelineAnimatorTimeline
pause
()
static
Pause all tweens which have been excuted by Animator.play()
pauseInGroup
-
paused -
container
Pauses or unpauses all timelines that are children of the specified DisplayObjectContainer.
Parameters:
-
pausedBoolIf this should be paused or unpaused
-
containercreatejs.ContainerThe container to stop timelines contained within
play
-
instance -
event -
[options]
Play an animation for a frame label event
Parameters:
-
instanceAnimatorTimelineThe timeline to animate
-
eventStringThe frame label event (e.g. "onClose" to "onClose stop")
-
[options]Object | Function optionalThe object of optional parameters or onComplete callback function
-
[onComplete=null]Function optionalThe callback function when the animation is done
-
[onCompleteParams=null]Array optionalParameters to pass to onComplete function
-
[startTime=0]Int optionalThe time in milliseconds into the animation to start. A value of -1 makes the animation play at a random startTime.
-
[speed=1]Number optionalThe speed at which to play the animation.
-
[soundData=null]Object | String optionalsoundData Data about a sound to sync the animation to, as an alias or in the format {alias:"MyAlias", start:0}. start is the seconds into the animation to start playing the sound. If it is omitted or soundData is a string, it defaults to 0.
-
[doCancelledCallback=false]Bool optionalShould an overridden animation's callback function still run?
-
Returns:
The Timeline object
playAtRandomFrame
-
instance -
event -
[options]
Play an animation for a frame label event, starting at a random frame within the animation
Parameters:
-
instanceAnimatorTimelineThe timeline to animate.
-
eventStringThe frame label event (e.g. "onClose" to "onClose_stop").
-
[options]Object | Function optionalThe object of optional parameters or onComplete callback function
-
[onComplete=null]Function optionalThe callback function when the animation is done
-
[onCompleteParams=null]Array optionalParameters to pass to onComplete function
-
[speed=1]Number optionalThe speed at which to play the animation.
-
[soundData=null]Object optionalsoundData Data about a sound to sync the animation to, as an alias or in the format {alias:"MyAlias", start:0}. start is the seconds into the animation to start playing the sound. If it is omitted or soundData is a string, it defaults to 0.
-
[doCancelledCallback=false]Bool optionalShould an overridden animation's callback function still run?
-
Returns:
The Timeline object
-
elapsed
The update every frame
Parameters:
-
elapsedIntThe time in milliseconds since the last frame
resume
()
static
Resumes all tweens executed by the Animator.play()
stop
-
instance -
doOnComplete
Stop the animation.
Parameters:
-
instancecreatejs.MovieClipThe MovieClip to stop the action on
-
doOnCompleteBoolIf we are suppose to do the complete callback when stopping (default is false)
stopAll
-
container
Stop all current Animator animations. This is good for cleaning up all animation, as it doesn't do a callback on any of them.
Parameters:
-
containercreatejs.ContainerOptional - specify a container to stop timelines contained within
toString
()
static
String representation of this class
Returns:
String
Properties
_optionsHelper
Object
private
An empty object to avoid creating new objects in play() when an options object is not used for parameters.
_paused
Bool
private
If the Animator is paused
_removedTimelines
Array
private
A collection of timelines for removal - kept out here so it doesn't need to be reallocated every frame
_timelinesMap
Dictionary
private
captions
cloudkid.Captions
public
static
The global captions object to use with animator
debug
Bool
public
static
If we fire debug statements
soundLib
cloudkid.Audio | cloudkid.Sound
public
static
The instance of cloudkid.Audio or cloudkid.Sound for playing audio along with animations. This MUST be set in order to play synced animations.
