API Documentation for: 0.0.1
Show:

Animator Class

Defined in: Animator:8
Namespace: cloudkid

[PIXI Only] Animator for interacting with Spine animations

Methods

_onMovieClipDone

(
  • timeline
)
private

Called when a movie clip is done playing, calls the AnimTimeline's callback if it has one

Parameters:

_repool

(
  • timeline
)
private

Defined in _repool:285

Put an AnimTimeline back into the general pool after it's done playing or has been manually stopped

Parameters:

_update

(
  • elapsed
)
private

Defined in _update:304

Update each frame

Parameters:

  • elapsed Int

    The time since the last frame

checkSpineForAnimation

(
  • clip
  • anim
)
Boolean

Checks to see if a Spine animation includes a given animation alias

Parameters:

  • clip PIXI.Spine

    The spine to search

  • anim String

    The animation alias to search for

Returns:

Boolean:

Returns true if the animation is found

destroy

()

Defined in destroy:446

Destroy this

init

() static

Defined in init:53

Initializes the singleton instance of Animator.

instanceHasAnimation

(
  • instance
  • anim
)
Boolean

Checks to see if a Spine animation includes a given animation alias

Parameters:

  • instance PIXI.Spine

    The animation to search. This has to be a Spine animation.

  • anim String

    The animation alias to search for

Returns:

Boolean:

Returns true if the animation is found

play

(
  • clip
  • anim
  • [options]
)

Defined in play:64

Play a specified animation

Parameters:

  • clip PIXI.MovieClip | PIXI.Spine

    The clip to play

  • anim String | Array

    Depending on the type of clip, this could be one of several things.

    If animating a MovieClip, this should be the array of Textures that is the animation (or null to use the existing array on the clip).

    If animating a Spine object:

    • If anim is a string it will play that single animation by name.
    • If anim is an array of strings it will play as a list of animations (only the last one can loop).
    • If anim is an array of objects (with anim, loop, and speed properties) then multiple animations will be played simultaneously. When multiple animations play, animation stops when any non looping animation ends.
  • [options] Object | Function optional

    The object of optional parameters or onComplete callback function

    • [onComplete=null] Function optional

      The function to call once the animation has finished

    • [loop=false] Bool optional

      Whether the animation should loop

    • [speed=1] Int optional

      The speed at which to play the animation

    • [startTime=0] Int optional

      The time in milliseconds into the animation to start.

    • [soundData=null] Object | String optional

      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.

stop

(
  • clip
  • doCallback
)

Defined in stop:239

Stop a clip

Parameters:

  • clip PIXI.MovieClip | PIXI.Spine

    The clip to stop

  • doCallback Bool

    Whether the animations callback should be run

stop

()

Defined in stop:266

Stops all current animations

Properties

_animPool

Array private static

Defined in _animPool:30

Stored collection of AnimTimelines. This is internal to Animator and can't be accessed externally.

_numAnims

Int private static

Defined in _numAnims:22

The number of animations

_timelines

Array private

Defined in _timelines:15

The collection of AnimTimelines that are playing

captions

cloudkid.Captions public

Defined in captions:46

The global captions object to use with animator

soundLib

cloudkid.Audio | cloudkid.Sound public

Defined in soundLib:38

The instance of cloudkid.Audio or cloudkid.Sound for playing audio along with animations.