Phaser API Documentation

  Version: 
addAtlas(key, source, data, [dataSource])

Description:

Adds a Texture Atlas to this Texture Manager.

In Phaser terminology, a Texture Atlas is a combination of an atlas image and a JSON data file, such as those exported by applications like Texture Packer.

It can accept either JSON Array or JSON Hash formats, as exported by Texture Packer and similar software.

As of Phaser 3.60 you can use this method to add a atlas data to an existing Phaser Texture.

Parameters:

name type arguments description
key string

The unique string-based key of the Texture.

source HTMLImageElement | Array.<HTMLImageElement> | Phaser.Textures.Texture

The source Image element/s, or a Phaser Texture.

data object | Array.<object>

The Texture Atlas data/s.

dataSource HTMLImageElement | HTMLCanvasElement | Array.<HTMLImageElement> | Array.<HTMLCanvasElement> <optional>

An optional data Image element.

Returns:
Description:

The Texture that was created, or null if the key is already in use.

Since: 3.0.0