API Documentation for: 2.3.1
Show:

Animator Class

Defined in: Animator:13
Namespace: cloudkid

Animator is a static class designed to provided base animation functionality, using frame labels of MovieClips

Item Index

Methods

Methods

_canAnimate

(
  • instance
)
Boolean private static

Defined in _canAnimate:321

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:

  • instance easeljs.MovieClip

    The object to check for animation properties.

Returns:

Boolean:

If the instance can be animated or not.

_hasTimelines

() Bool private static

Defined in _hasTimelines:732

Check to see if we have timeline

Returns:

Bool:

if we have timelines

_makeTimeline

(
  • instance
  • event
  • onComplete
  • onCompleteParams
  • speed
  • soundData
)
AnimatorTimeline private static

Defined in _makeTimeline:235

Creates the AnimatorTimeline for a given animation

Parameters:

  • instance easeljs.MovieClip

    The timeline to animate

  • event String

    The frame label event (e.g. "onClose" to "onClose stop")

  • onComplete Function

    The function to callback when we're done

  • onCompleteParams Function

    Parameters to pass to onComplete function

  • speed Number

    The speed at which to play the animation.

  • soundData Object

    Data about sound to sync the animation to.

Returns:

AnimatorTimeline:

The Timeline object

_makeTimeline

(
  • instance
  • event
)
Bool public static

Defined in _makeTimeline:352

Checks if animation exists

Parameters:

  • instance easeljs.MovieClip

    The timeline to check

  • event String

    The frame label event (e.g. "onClose" to "onClose stop")

Returns:

Bool:

does this animation exist?

_remove

(
  • timeline
  • doOnComplete
)
private static

Defined in _remove:437

Remove a timeline from the stack

Parameters:

_startUpdate

() private static

Defined in _startUpdate:589

Start the updating

_stopUpdate

() private static

Defined in _stopUpdate:602

Stop the updating

destroy

() static

Defined in destroy:114

Stops all animations and cleans up the variables used.

getPaused

() Bool

Defined in getPaused:578

Whether the Animator class is currently paused.

Returns:

Bool:

if we're paused or not

getTimeline

(
  • instance
)
AnimatorTimeline static

Defined in getTimeline:559

Get the timeline object for an instance

Parameters:

  • instance createjs.MovieClip

    MovieClip

Returns:

AnimatorTimeline:

The timeline

init

() static

Defined in init:99

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.

onSoundDone

(
  • timeline
)
private

Defined in onSoundDone:719

The sound is done

Parameters:

onSoundStarted

(
  • timeline
)
private

Defined in onSoundStarted:707

The sound has been started

Parameters:

pause

() static

Defined in pause:494

Pause all tweens which have been excuted by Animator.play()

pauseInGroup

(
  • paused
  • container
)
static

Defined in pauseInGroup:537

Pauses or unpauses all timelines that are children of the specified DisplayObjectContainer.

Parameters:

  • paused Bool

    If this should be paused or unpaused

  • container createjs.Container

    The container to stop timelines contained within

play

(
  • instance
  • event
  • [options]
)
AnimatorTimeline static

Defined in play:129

Play an animation for a frame label event

Parameters:

  • instance AnimatorTimeline

    The timeline to animate

  • event String

    The frame label event (e.g. "onClose" to "onClose stop")

  • [options] Object | Function optional

    The object of optional parameters or onComplete callback function

    • [onComplete=null] Function optional

      The callback function when the animation is done

    • [onCompleteParams=null] Array optional

      Parameters to pass to onComplete function

    • [startTime=0] Int optional

      The time in milliseconds into the animation to start. A value of -1 makes the animation play at a random startTime.

    • [speed=1] Number optional

      The speed at which to play the animation.

    • [soundData=null] Object | String optional

      soundData 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 optional

      Should an overridden animation's callback function still run?

Returns:

AnimatorTimeline:

The Timeline object

playAtRandomFrame

(
  • instance
  • event
  • [options]
)
AnimatorTimeline static

Play an animation for a frame label event, starting at a random frame within the animation

Parameters:

  • instance AnimatorTimeline

    The timeline to animate.

  • event String

    The frame label event (e.g. "onClose" to "onClose_stop").

  • [options] Object | Function optional

    The object of optional parameters or onComplete callback function

    • [onComplete=null] Function optional

      The callback function when the animation is done

    • [onCompleteParams=null] Array optional

      Parameters to pass to onComplete function

    • [speed=1] Number optional

      The speed at which to play the animation.

    • [soundData=null] Object optional

      soundData 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 optional

      Should an overridden animation's callback function still run?

Returns:

AnimatorTimeline:

The Timeline object

(
  • elapsed
)
private static

Defined in :615

The update every frame

Parameters:

  • elapsed Int

    The time in milliseconds since the last frame

resume

() static

Defined in resume:515

Resumes all tweens executed by the Animator.play()

stop

(
  • instance
  • doOnComplete
)
static

Defined in stop:385

Stop the animation.

Parameters:

  • instance createjs.MovieClip

    The MovieClip to stop the action on

  • doOnComplete Bool

    If we are suppose to do the complete callback when stopping (default is false)

stopAll

(
  • container
)
static

Defined in stopAll:411

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:

  • container createjs.Container

    Optional - specify a container to stop timelines contained within

toString

() static

Defined in toString:746

String representation of this class

Returns:

String

Properties

_optionsHelper

Object private

Defined in _optionsHelper:90

An empty object to avoid creating new objects in play() when an options object is not used for parameters.

_paused

Bool private

Defined in _paused:82

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

_timelines

Array private

Defined in _timelines:58

The collection of timelines

_timelinesMap

Dictionary private

Defined in _timelinesMap:75

captions

cloudkid.Captions public static

Defined in captions:50

The global captions object to use with animator

debug

Bool public static

Defined in debug:31

If we fire debug statements

soundLib

cloudkid.Audio | cloudkid.Sound public static

Defined in soundLib:40

The instance of cloudkid.Audio or cloudkid.Sound for playing audio along with animations. This MUST be set in order to play synced animations.

VERSION

String public static

Defined in VERSION:22

The current version of the Animator class