TextureAtlas Class
Handles a spritesheet.
Constructor
TextureAtlas
-
image -
spritesheetData
Parameters:
-
imageImage | HTMLCanvasElement | ArrayThe image that all textures pull from. This can also be an array of images, if the TextureAtlas should be built from several spritesheets.
-
spritesheetDataObject | ArrayThe JSON object describing the frames in the atlas. This is expected to fit the JSON Hash format as exported from TexturePacker. This can also be an array of data objects, if the TextureAtlas should be built from several spritesheets.
Methods
getFrame
-
name
Handler when the skip button is pressed
Parameters:
-
nameStringThe frame name to get.
Returns:
The texture by that name, or null if it doesn't exist.
getFrames
-
name -
numberMin -
numberMax -
[maxDigits=4] -
[outArray]
Get an array of Textures that match a specific name.
Parameters:
-
nameStringThe base name of all frames to look for, like "anim_#" to search for an animation exported as anim_0001.png (the ".png" is dropped when the TextureAtlas is loaded).
-
numberMinIntThe number to start on while looking for frames. Flash generally starts at 1.
-
numberMaxIntThe number to go until while looking for frames. If your animation runs from frame 0001 to frame 0014, numberMax would be 14.
-
[maxDigits=4]Int optionalMaximum number of digits, like 4 for an animation exported as anim_0001.png
-
[outArray]Array optionalIf already using an array, this can fill it instead of creating a new one.
Returns:
An collection of cloudkid.TextureAtlas.Textures.
