Class: Spritesheet

Tiny. Spritesheet

Utility class for maintaining reference to a collection of Textures on a single Spritesheet.

new Tiny.Spritesheet(baseTexture, data, resolutionFilename)

Name Type Default Description
baseTexture Tiny.BaseTexture

Reference to the source BaseTexture object.

data object

Spritesheet image data.

resolutionFilename string null optional

The filename to consider when determining the resolution of the spritesheet. If not provided, the imageUrl will be used on the BaseTexture.

Members

staticTiny.Spritesheet.BATCH_SIZEnumber

The maximum number of Textures to build per process.

Default Value:
  • 1000

animationsobject

A map containing the textures for each animation.
Can be used to create an Tiny.AnimatedSprite:

new Tiny.AnimatedSprite(sheet.animations['anim_name'])
Version:
  • 1.2.0

texturesobject

A map containing all textures of the sprite sheet.
Can be used to create a Tiny.Sprite:

new Tiny.Sprite(sheet.textures['image.png']);

Methods

Destroy Spritesheet and don't use after this.

Name Type Default Description
destroyBase boolean false optional

Whether to destroy the base texture as well

Parser spritesheet from loaded data. This is done asynchronously to prevent creating too many Texture within a single process.

Name Type Description
callback function

Callback when complete returns a map of the Textures for this spritesheet.

Documentation generated by JSDoc 3.4.3 on Fri Jul 09 2021 19:32:27 GMT+0800 (CST)