Phaser API Documentation

  Version: 
create(key, source, [width], [height])

Description:

Creates a new Texture using the given source and dimensions.

Parameters:

name type arguments description
key string

The unique string-based key of the Texture.

source HTMLImageElement | HTMLCanvasElement | Array.<HTMLImageElement> | Array.<HTMLCanvasElement> | Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper

An array of sources that are used to create the texture. Usually Images, but can also be a Canvas.

width number <optional>

The width of the Texture. This is optional and automatically derived from the source images.

height number <optional>

The height of the Texture. This is optional and automatically derived from the source images.

Returns:
Description:

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

Since: 3.0.0