EaselJS

EaselJS  0.4.2

EaselJS > EaselJS > BitmapAnimation
Search:
 
Filters

Class BitmapAnimation - extends DisplayObject

Displays frames or sequences of frames (ie. animations) from a sprite sheet image. A sprite sheet is a series of images (usually animation frames) combined into a single image. For example, an animation consisting of 8 100x100 images could be combined into a 400x200 sprite sheet (4 frames across by 2 high). You can display individual frames, play frames as an animation, and even sequence animations together. See the SpriteSheet class for more information on setting up frames and animations.

Constructor

BitmapAnimation ( spriteSheet )
Parameters:
spriteSheet <SpriteSheet> The SpriteSheet instance to play back. This includes the source image(s), frame dimensions, and frame data. See SpriteSheet for more information.

Properties

_advanceCount - protected Number

Default Value: 0

_animation - protected Object

Default Value: null

currentAnimation - final String

Returns the currently playing animation. READ-ONLY.

currentAnimationFrame - Number

Specifies the current frame index within the current playing animation. When playing normally, this will increase successively from 0 to n-1, where n is the number of frames in the current animation.
Default Value: 0

currentFrame - Number

The frame that will be drawn when draw is called. Note that with some SpriteSheet data, this will advance non-sequentially. READ-ONLY.
Default Value: -1

offset - Number

When used in conjunction with animations having an frequency greater than 1, this lets you offset which tick the playhead will advance on. For example, you could create two BitmapAnimations, both playing an animation with a frequency of 2, but one having offset set to 1. Both instances would advance every second tick, but they would advance on alternating ticks (effectively, one instance would advance on odd ticks, the other on even ticks).
Default Value: 0

onAnimationEnd - Function

Specifies a function to call whenever any animation reaches its end. It will be called with two params: the first will be a reference to this instance, the second will be the name of the animation that just ended.

paused - Boolean

Prevents the animation from advancing each tick automatically. For example, you could create a sprite sheet of icons, set paused to true, and display the appropriate icon by setting currentFrame.
Default Value: false

snapToPixel - Boolean

Whether or not the Bitmap should be draw to the canvas at whole pixel coordinates.
Default Value: true

spriteSheet - SpriteSheet

The SpriteSheet instance to play back. This includes the source image, frame dimensions, and frame data. See SpriteSheet for more information.

Methods

_goto

protected void _goto ( frameOrAnimation )
Moves the playhead to the specified frame number or animation.
Parameters:
frameOrAnimation <String|Number> The frame number or animation that the playhead should move to.
Returns: void

_normalizeCurrentFrame

protected void _normalizeCurrentFrame ( )
Normalizes the current frame, advancing animations and dispatching callbacks as appropriate.
Returns: void

_tick

protected void _tick ( )
Advances the currentFrame if paused is not true. This is called automatically when the Stage ticks.
Returns: void

advance

void advance ( )
Advances the playhead. This occurs automatically each tick by default.
Returns: void

cache

void cache ( )
Because the content of a Bitmap is already in a simple format, cache is unnecessary for Bitmap instances. You should not cache Bitmap instances as it can degrade performance.
Returns: void

clone

Point clone ( )
Returns a clone of the Point instance.
Returns: Point
a clone of the Point instance.

cloneProps

protected void cloneProps ( o )
Parameters:
o <Text>
Returns: void

draw

void draw ( ctx , ignoreCache )
Draws the display object into the specified context ignoring it's visible, alpha, shadow, and transform. Returns true if the draw was handled (useful for overriding functionality). NOTE: This method is mainly for internal use, though it may be useful for advanced uses.
Parameters:
ctx <CanvasRenderingContext2D> The canvas 2D context object to draw into.
ignoreCache <Boolean> Indicates whether the draw operation should ignore any current cache. For example, used for drawing the cache (to prevent it from simply drawing an existing cache back into itself).
Returns: void

gotoAndPlay

void gotoAndPlay ( frameOrAnimation )
Sets paused to false and plays the specified animation name, named frame, or frame number.
Parameters:
frameOrAnimation <String|Number> The frame number or animation name that the playhead should move to and begin playing.
Returns: void

gotoAndStop

void gotoAndStop ( frameOrAnimation )
Sets paused to true and seeks to the specified animation name, named frame, or frame number.
Parameters:
frameOrAnimation <String|Number> The frame number or animation name that the playhead should move to and stop.
Returns: void

initialize

protected void initialize ( )
Initialization method.
Returns: void

isVisible

Boolean isVisible ( )
Returns true or false indicating whether the display object would be visible if drawn to a canvas. This does not account for whether it would be visible within the boundaries of the stage. NOTE: This method is mainly for internal use, though it may be useful for advanced uses.
Returns: Boolean
Boolean indicating whether the display object would be visible if drawn to a canvas

play

void play ( )
TODO: Doc.
Returns: void

stop

void stop ( )
TODO: Doc.
Returns: void

toString

String toString ( )
Returns a string representation of this object.
Returns: String
a string representation of the instance.

uncache

void uncache ( )
Because the content of a Bitmap is already in a simple format, cache is unnecessary for Bitmap instances. You should not cache Bitmap instances as it can degrade performance.
Returns: void

updateCache

void updateCache ( )
Because the content of a Bitmap is already in a simple format, cache is unnecessary for Bitmap instances. You should not cache Bitmap instances as it can degrade performance.
Returns: void