springroll.Animator Class

Module: Animation

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

Constructor

springroll.Animator

(
  • app
)

Parameters:

_makeTimeline

(
  • clip
  • eventList
  • onComplete
  • onCancelled
)
springroll.AnimatorTimeline
private

Defined in _makeTimeline:249

Creates the AnimatorTimeline for a given animation

Parameters:

  • clip

    The instance to animate

  • eventList Array

    List of animation events

  • onComplete Function

    The function to callback when we're done

  • onCancelled Function

    The function to callback when cancelled

Returns:

springroll.AnimatorTimeline:

The Timeline object

_onSoundDone

(
  • timeline
  • playIndex
  • soundAlias
)
private

Defined in _onSoundDone:873

The sound is done

Parameters:

_remove

(
  • timeline
  • doCancelled
)
private

Defined in _remove:536

Remove a timeline from the stack

Parameters:

_startUpdate

()
private

Defined in _startUpdate:726

Start the updating

_stopUpdate

()
private

Defined in _stopUpdate:736

Stop the updating

canAnimate

(
  • clip
)
Boolean

Defined in canAnimate:358

Determines if a given instance can be animated by Animator. 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:

  • clip

    The object to check for animation properties.

Returns:

Boolean:

If the instance can be animated or not.

createInstance

(
  • clip
)
springroll.AnimatorInstance
private

Defined in createInstance:376

Create an instance by clip

Parameters:

  • clip

    The animation object to animate

Returns:

springroll.AnimatorInstance:

The animator instance

destroy

()

Defined in destroy:900

Stops all animations and cleans up the variables used.

getDefinitionByClip

(
  • clip
)
Function | Null
private

Get a definition by clip

Parameters:

  • clip

    The animation clip

Returns:

Function | Null:

The new definition

getDuration

(
  • instance
  • event
)
Number
public

Defined in getDuration:443

Get duration of animation event (or sequence of events) in seconds

Parameters:

  • instance

    The timeline to check

  • event String | Array

    The frame label event or array, in the format that play() uses.

Returns:

Number:

Duration of animation event in milliseconds

getTimeline

(
  • clip
)
springroll.AnimatorTimeline

Defined in getTimeline:672

Get the timeline object for an instance

Parameters:

  • clip

    The animation clip

Returns:

getTimelineByClip

(
  • clip
)
springroll.AnimatorTimeline
private

Loop a clip by timeline

Parameters:

  • clip

    The clip to check

Returns:

springroll.AnimatorTimeline:

The timeline for clip

hasAnimation

(
  • clip
  • event
)
Boolean
public

Defined in hasAnimation:425

Checks if animation exists

Parameters:

  • clip

    The instance to check

  • event String

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

Returns:

Boolean:

does this animation exist?

isFunction

(
  • func
)
Boolean
private

Defined in isFunction:942

Check to see if object is a Function

Parameters:

  • func

    The object to check

Returns:

Boolean:

if object is Function

isNumber

(
  • num
)
Boolean
private

Defined in isNumber:930

Check to see if object is a Number

Parameters:

  • num

    The object to check

Returns:

Boolean:

if object is Number

isString

(
  • str
)
Boolean
private

Defined in isString:918

Check to see if object is a String

Parameters:

  • str

    The string

Returns:

Boolean:

if object is String

onSoundStarted

(
  • timeline
  • playIndex
)
private

Defined in onSoundStarted:856

The sound has been started

Parameters:

pause

()

Defined in pause:609

Pause all tweens which have been excuted by play()

(
  • elapsed
)
private

Defined in :746

The update every frame

Parameters:

  • elapsed Int

    The time in milliseconds since the last frame

pauseInGroup

(
  • paused
  • container
)

Defined in pauseInGroup:651

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

Parameters:

  • paused Boolean

    If this should be paused or unpaused

  • container createjs.Container

    The container to stop timelines contained within

play

(
  • clip
  • options
  • [onComplete]
  • [onCancelled]
)
springroll.AnimatorTimeline

Defined in play:141

Play an animation for a frame label event, with more verbose play options.

Parameters:

  • clip

    The display object with the same API to animate.

  • options Object

    One of or an array of the following

    • anim String

      the frame label of the animation to play, e.g. "onClose" to "onClose_stop".

    • [start=0] Int optional

      Milliseconds into the animation to start. A value of -1 starts from a random time in the animation.

    • [speed=1] Int optional

      a multiplier for the animation speed.

    • [audio] Object | String optional

      Audio to sync the animation to using springroll.Sound. audio can be a String if you want the audio to start 0 milliseconds into the animation.

      • [alias] String optional
        The sound alias
      • [start] Int optional
        The sound delay
  • [onComplete] Function optional

    The callback function for when the animation is done.

  • [onCancelled] Function | Boolean optional

    A callback function for when an animation is stopped with Animator.stop() or to play another animation. A value of 'true' uses onComplete for onCancelled.

Returns:

springroll.AnimatorTimeline:

The Timeline object that represents this play() call.

play

(
  • clip
  • eventList
  • [onComplete]
  • [onCancelled]
)
springroll.AnimatorTimeline

Defined in play:163

Play an animation for a frame label event or events

Parameters:

  • clip

    The display object with the same API to animate.

  • eventList String | Array

    The name of an event or collection of events

  • [onComplete] Function optional

    The callback function for when the animation is done.

  • [onCancelled] Function | Boolean optional

    A callback function for when an animation is stopped with Animator.stop() or to play another animation. A value of 'true' uses onComplete for onCancelled.

Returns:

springroll.AnimatorTimeline:

The Timeline object that represents this play() call.

poolInstance

(
  • instance
)
private

Defined in poolInstance:393

Destroy an instance

Parameters:

  • instance springroll.AnimatorInstance

    The instance to destroy

register

(
  • qualifiedClassName
  • priority
)

Defined in register:120

Register an animator instance definition type

Parameters:

  • qualifiedClassName String

    The class name

  • priority Int

    The priority order for definition

resume

()

Defined in resume:628

Resumes all tweens executed by the play()

stop

(
  • clip
  • [removeCallbacks=false]
)

Defined in stop:483

Stop the animation.

Parameters:

  • clip

    The instance to stop the action on

  • [removeCallbacks=false] Boolean optional

    Completely disregard the on complete or on cancelled callback of this animation.

stopAll

(
  • [container]
  • [removeCallbacks=false]
)

Defined in stopAll:504

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. This only checks one layer deep.

  • [removeCallbacks=false] Boolean optional

    Completely disregard the on complete or on cancelled callback of the current animations.

_definitions

Array private

Defined in _definitions:40

The collection of AnimatorPlugin definitions

_hasTimelines

Boolean private

Defined in _hasTimelines:88

If there are timelines available

_paused

Boolean private

Defined in _paused:95

If the Animator is paused

_timelineMap

Map private

Defined in _timelineMap:54

The collection of active timelines, indexed by MovieClip/instance. This will be null in browsers where Map is not supported.

_timelinePool

Array private

Defined in _timelinePool:81

The collection of used timeline objects

_timelines

Array private

Defined in _timelines:47

The collection of timelines

app

springroll.Application private

Defined in app:33

Reference to the application

captions

springroll.Captions

Defined in captions:27

The global captions object to use with animator

debug

Boolean

Defined in debug:21

If we fire debug statements

paused

Boolean

Defined in paused:713

Whether the Animator class is currently paused.