springroll.pixi.AdvancedMovieClip Class

Extends PIXI.Sprite
Module: PIXI Animation

A class similar to PIXI.extras.MovieClip, but made to play animations exclusively using the Animator, with data exported by the BitmapMovieClip exporter.

Format for AdvancedMovieClip data (the same as BitmapMovieClip):

{
    fps:30,
    labels:
    {
        animStart:0,
        animStart_loop:15
    },
    origin:{ x: 20, y:30 },
    frames:
    [
        {
            name:"myAnim#",
            min:1,
            max:20,
            digits:4
        }
    ],
    scale:1
}

The example object describes a 30 fps animation that is 20 frames long, and was originally myAnim0001.png->myAnim0020.png, with frame labels on the first and 16th frames. 'digits' is optional, and defaults to 4.

Constructor

springroll.pixi.AdvancedMovieClip

(
  • [data]
  • [atlas]
)

Parameters:

  • [data] Object optional

    Initialization data

    • [fps] Int optional

      Framerate to play the movieclip at. Omitting this will use the current framerate.

    • [labels] Object optional

      A dictionary of the labels in the movieclip to assist in playing animations.

    • [origin={x:0,y:0}] Object optional

      The origin of the movieclip.

    • [frames] Array optional

      An array of frame sequences to pull from the texture atlas.

      • [name] String optional
        The name to use for the frame sequence. This should include a "#" to be replaced with the image number.
      • [min] Int optional
        The first frame number in the frame sequence.
      • [max] Int optional
        The last frame number in the frame sequence.
      • [digits=4] Int optional
        The maximum number of digits in the names of the frames, e.g. myAnim0001 has 4 digits.
    • [scale=1] Number optional

      The scale at which the art was exported, e.g. a scale of 1.4 means the art was increased in size to 140% before exporting and should be scaled back down before drawing to the screen.

  • [atlas] springroll.pixi.TextureAtlas optional

    A TextureAtlas to pull frames from. If omitted, frames are pulled from Pixi's global texture cache.

advance

(
  • [time]
)

Defined in advance:247

Advances the playhead. This occurs automatically each tick by default.

Parameters:

  • [time] Number optional

    The amount of time in milliseconds to advance by.

copyFrom

(
  • other
)

Defined in copyFrom:493

Copies the labels, textures, origin, and framerate from another AdvancedMovieClip. The labels and textures are copied by reference, instead of a deep copy.

Parameters:

  • other AdvancedMovieClip

    The movieclip to copy data from.

destroy

()

Defined in destroy:510

Destroys the AdvancedMovieClip.

getCurrentLabel

() String

Defined in getCurrentLabel:289

Returns the name of the label on or immediately before the current frame.

Returns:

String:

The name of the current label or null if there is no label.

getEvents

() Array

Defined in getEvents:278

Returns a sorted list of the labels which can be played with Animator.

Returns:

Array:

A sorted array of objects with label, length and position (aka frame) properties.

getLabels

() ArrayObject

Defined in getLabels:267

Returns a sorted list of the labels defined on this AdvancedMovieClip.

Returns:

ArrayObject:

A sorted array of objects with label and position (aka frame) properties.

gotoAndStop

(
  • positionOrLabel
)

Defined in gotoAndStop:213

Advances this movie clip to the specified position or label.

Parameters:

  • positionOrLabel String | Number

    The animation or frame name to go to.

init

(
  • data
  • [atlas]
)

Defined in init:308

Initializes or re-initializes the AdvancedMovieClip.

Parameters:

  • data Object

    Initialization data

    • [fps] Int optional

      Framerate to play the movieclip at. Omitting this will use the current framerate.

    • [labels] Object optional

      A dictionary of the labels in the movieclip to assist in playing animations.

    • [origin={x:0,y:0}] Object optional

      The origin of the movieclip.

    • [frames] Array optional

      An array of frame sequences to pull from the texture atlas.

      • [name] String optional
        The name to use for the frame sequence. This should include a "#" to be replaced with the image number.
      • [min] Int optional
        The first frame number in the frame sequence.
      • [max] Int optional
        The last frame number in the frame sequence.
      • [digits=4] Int optional
        The maximum number of digits in the names of the frames, e.g. myAnim0001 has 4 digits.
    • [scale=1] Number optional

      The scale at which the art was exported, e.g. a scale of 1.4 means the art was increased in size to 140% before exporting and should be scaled back down before drawing to the screen.

  • [atlas] springroll.pixi.TextureAtlas optional

    A TextureAtlas to pull frames from. If omitted, frames are pulled from Pixi's global texture cache.

_duration

Number private

Defined in _duration:93

The total time in seconds for the animation.

Default: 0

_events

Array private

Defined in _events:120

An array of event labels.

_framerate

Number private

Defined in _framerate:83

The speed at which the AdvancedMovieClip should play.

Default: 0

_labels

Array private

Defined in _labels:112

An array of frame labels.

_t

Number private

Defined in _t:103

The time elapsed from frame 0 in seconds.

Default: 0

_textures

Array private

Defined in _textures:128

The array of Textures that are the MovieClip's frames.

currentFrame

Number

Defined in currentFrame:72

The current frame of the movieclip.

Default: 0

elapsedTime

Number public

Defined in elapsedTime:169

When the BitmapMovieClip is framerate independent, this is the time elapsed from frame 0 in seconds.

Default: 0

framerate

Number

Defined in framerate:145

The speed at which the AdvancedMovieClip should play.

Default: 0

totalFrames

Int

Defined in totalFrames:196

(Read-Only) The total number of frames in the timeline

Default: 0