Phaser API Documentation

  Version: 
add(name, sourceIndex, x, y, width, height)

Description:

Adds a new Frame to this Texture.

A Frame is a rectangular region of a TextureSource with a unique index or string-based key.

The name given must be unique within this Texture. If it already exists, this method will return null.

Parameters:

name type description
name number | string

The name of this Frame. The name is unique within the Texture.

sourceIndex number

The index of the TextureSource that this Frame is a part of.

x number

The x coordinate of the top-left of this Frame.

y number

The y coordinate of the top-left of this Frame.

width number

The width of this Frame.

height number

The height of this Frame.

Returns:
Description:

The Frame that was added to this Texture, or null if the given name already exists.

Since: 3.0.0
Source: src/textures/Texture.js (Line 137)