EaselJS  0.3.2

EaselJS > EaselJS > SpriteSheetUtils

static Class SpriteSheetUtils

The SpriteSheetUtils class is a collection of static methods for working with sprite sheets. A sprite sheet is a series of images (usually animation frames) combined into a single image on a regular grid. For example, an animation consisting of 8 100x100 images could be combined into a 400x200 sprite sheet (4 frames across by 2 high). The SpriteSheetUtils class uses a static interface and should not be instantiated.


_workingCanvas - protected static HTMLCanvasElement

_workingContext - protected static CanvasRenderingContext2D



static Image extractFrame ( spriteSheet , frame )
Returns a single frame of the specified sprite sheet as a new PNG image.
spriteSheet <Image> The SpriteSheet instance to extract a frame from.
frame <Number> The frame number or sequence name to extract. If a sequence name is specified, only the first frame of the sequence will be extracted.
Returns: Image
a single frame of the specified sprite sheet as a new PNG image.


static void flip ( spriteSheet , flipData )
Builds a new extended sprite sheet based on the specified sprite sheet by adding flipped frames (vertical, horizontal, or both). Flipping elements on the display list by using setting scaleX/scaleY to -1 is quite expensive in most browsers, so this method allows you to incur the cost of flipping once, in advance, without increasing the load size of your sprite sheets. Returns a new SpriteSheet instance containing the generated image and frame data.
spriteSheet <Image> The sprite sheet to use as the source.
flipData <Object> A generic object that specifies which frames will be flipped, what to name the flipped result, and how to flip the frames (horizontally, vertically, or both). Each property name indicates the name of a new sequence to create, and should reference an array where the first index is the name of the original sequence to flip, the second index indicates whether to flip it horizontally, the third index indicates whether to flip it vertically, and the fourth indicates what the "next" value for the resulting frame data should be. For example, the following would create a new sequence named "walk_left" consisting of the frames from the original "walk_right" sequence flipped horizontally: {walk_left: ["walk_right", true, false]}
Returns: void


static String frameDataToString ( frameData )
Returns a string representing the specified frameData object.
frameData <Object> The frame data to output.
Returns: String
The a String representing the specified frameData object?