Kiwi.Textures.SpriteSheet Class
A special type of TextureAtlas that is created when loading in images that are design to be SpriteSheets. A SpriteSheet will generally contain multiple cells and can also contain sequences which are then automatically added as Animations when this texture is used on a Sprite.
Constructor
Kiwi.Textures.SpriteSheet
-
name
-
texture
-
cellWidth
-
cellHeight
-
[numCells]
-
[rows]
-
[cols]
-
[sheetOffsetX]
-
[sheetOffsetY]
-
[cellOffsetX]
-
[cellOffsetY]
Parameters:
-
name
StringThe name of the spritesheet.
-
texture
HTMLImageElement/HTMLCanvasElementThe image that is being used for the spritesheet.
-
cellWidth
NumberThe width of a single cell.
-
cellHeight
NumberThe height of a single cell.
-
[numCells]
Number optionalThe number of cells in total.
-
[rows]
Number optionalThe number of cells that make up a row.
-
[cols]
Number optionalThe number of cells that make up a column.
-
[sheetOffsetX]
Number optionalThe offset of the whole sheet on the x axis. Useful if the image has a border you don't want to show.
-
[sheetOffsetY]
Number optionalThe offset of the whole sheet on the y axis. Useful if the image has a border you don't want to show.
-
[cellOffsetX]
Number optionalAn offset between cells on the x axis. Useful if there is a border between cells which is not to be shown.
-
[cellOffsetY]
Number optionalAn offset between cells on the y axis. Useful if there is a border between cells which is not to be shown.
Returns:
Item Index
Methods
Methods
generateAtlasCells
()
Array
public
Generates the atlas cells based on the information that was provided.
Returns:
objType
()
String
public
The type of object that this is.
Returns:
"SpriteSheet"
Properties
cellHeight
Number
private
The height of a single cell.
cellOffsetX
Number
private
How much each cell should be offset by on the X axis.
cellOffsetY
Number
private
How much each cell should be offset by on the Y axis.
cellWidth
Number
private
The width of a single cell.
cols
Number
private
The number of columns that are on this spritesheet
numCells
Number
private
The number of cells that are on this spritesheet
rows
Number
private
The number of rows for the spritesheet
sheetOffsetX
Number
private
How much the whole spritesheet should be offset by on the X axis.
sheetOffsetY
Number
private
How much the whole spritesheet should be offset by on the Y axis.