Phaser API Documentation

  Version: 
<static, private> SpriteSheetFromAtlas(texture, frame, config, config.frameWidth, [config.frameHeight], [config.startFrame], [config.endFrame], [config.margin], [config.spacing])

Description:

Parses a Sprite Sheet and adds the Frames to the Texture, where the Sprite Sheet is stored as a frame within an Atlas.

In Phaser terminology a Sprite Sheet is a texture containing different frames, but each frame is the exact same size and cannot be trimmed or rotated.

Parameters:

name type arguments Default description
texture Phaser.Textures.Texture

The Texture to add the Frames to.

frame Phaser.Textures.Frame

The Frame that contains the Sprite Sheet.

config object

An object describing how to parse the Sprite Sheet.

config.frameWidth number

Width in pixels of a single frame in the sprite sheet.

config.frameHeight number <optional>

Height in pixels of a single frame in the sprite sheet. Defaults to frameWidth if not provided.

config.startFrame number <optional> 0

Index of the start frame in the sprite sheet

config.endFrame number <optional> -1

Index of the end frame in the sprite sheet. -1 mean all the rest of the frames

config.margin number <optional> 0

If the frames have been drawn with a margin, specify the amount here.

config.spacing number <optional> 0

If the frames have been drawn with spacing between them, specify the amount here.

Returns:
Description:

The Texture modified by this parser.

Since: 3.0.0