API Docs for: 1.0.0
Show:

Kiwi.Textures.TextureAtlas Class

Module: Textures
Parent Module: Kiwi

A TextureAtlas is the base class that is created for each image that is loaded through Kiwi. Each TextureAtlas contains a name (the same as the key that the user chose when loading the image in),the HTMLImageElement that it is for and a number of cells.

Constructor

Kiwi.Textures.TextureAtlas

(
  • name
  • type
  • cells
  • image
  • [sequences]
)
Kiwi.TextureAtlas

Parameters:

  • name String

    Name of the texture atlas. This is usually defined by the developer when loading the assets.

  • type Number

    The type of texture atlas that this is. There are currently only three types.

  • cells Any

    The cells that are within this image..

  • image HTMLImageElement/HTMLCanvasElement

    The image that the texture atlas is using.

  • [sequences] Sequence optional

    Any sequences of cells for this texture atlas. Used for animation.

Returns:

Kiwi.TextureAtlas:

Item Index

Methods

Methods

objType

() public

The type of object that this texture atlas is.

Returns:

string

readJSON

(
  • atlasJSON
)
public

Will populate this texture atlas with information based on a JSON file that was passed.

Parameters:

  • atlasJSON Any

Properties

_type

Number private

The type of texture atlas that this is. This only ever is given a value when the object is instantated.

cellIndex

Number public

The cell that is to be render at the start.

Default: 0

cells

Array public

The cells for this image.

dirty

Boolean public

Indicates that the image data has changed, and needs to be reuplaoded to the gpu in webGL mode.

image

HTMLImageElement/HTMLCanvasElement public

The image that this texture atlas is holding. Can be an HTMLImageElement or a HTMLCanvasElement

name

String public

The name of this texture atlas

sequences

Array public

An array of Sequences that are for this texture.

SINGLE_IMAGE

Number public final static

The number that defines a single image type of texture atlas

Default: 0

SPRITE_SHEET

Number public final static

The number that defines a spritesheet type of texture atlas

Default: 1

TEXTURE_ATLAS

Number public final static

The number that defines a normal texture atlas

Default: 2