Phaser API Documentation

  Version: 
createCanvas(key, [width], [height])

Description:

Creates a new Texture using a blank Canvas element of the size given.

Canvas elements are automatically pooled and calling this method will extract a free canvas from the CanvasPool, or create one if none are available.

Parameters:

name type arguments Default description
key string

The unique string-based key of the Texture.

width number <optional> 256

The width of the Canvas element.

height number <optional> 256

The height of the Canvas element.

Returns:
Description:

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

Since: 3.0.0