API Documentation for: 2.3.1
Show:

TextureAtlas Class

Defined in: TextureAtlas:3
Namespace: cloudkid

Handles a spritesheet.

Constructor

TextureAtlas

(
  • image
  • spritesheetData
)

Defined in TextureAtlas:3

Parameters:

  • image Image | HTMLCanvasElement | Array

    The image that all textures pull from. This can also be an array of images, if the TextureAtlas should be built from several spritesheets.

  • spritesheetData Object | Array

    The 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.

Item Index

Properties

Methods

getFrame

(
  • name
)
cloudkid.TextureAtlas.Texture

Defined in getFrame:58

Handler when the skip button is pressed

Parameters:

  • name String

    The frame name to get.

Returns:

cloudkid.TextureAtlas.Texture:

The texture by that name, or null if it doesn't exist.

getFrames

(
  • name
  • numberMin
  • numberMax
  • [maxDigits=4]
  • [outArray]
)
Array

Defined in getFrames:69

Get an array of Textures that match a specific name.

Parameters:

  • name String

    The 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).

  • numberMin Int

    The number to start on while looking for frames. Flash generally starts at 1.

  • numberMax Int

    The 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 optional

    Maximum number of digits, like 4 for an animation exported as anim_0001.png

  • [outArray] Array optional

    If already using an array, this can fill it instead of creating a new one.

Returns:

Array:

An collection of cloudkid.TextureAtlas.Textures.

Properties

_image

Array private

Defined in _image:15

The an array of image elements (Image|HTMLCanvasElement) that frames in texture atlas use.

frames

Object

Defined in frames:30

The dictionary of Textures that this atlas consists of.