Phaser API Documentation

  Version: 
<static> create(parent, [width], [height], [canvasType], [selfParent])

Description:

Creates a new Canvas DOM element, or pulls one from the pool if free.

Parameters:

name type arguments Default description
parent *

The parent of the Canvas object.

width number <optional> 1

The width of the Canvas.

height number <optional> 1

The height of the Canvas.

canvasType number <optional> Phaser.CANVAS

The type of the Canvas. Either Phaser.CANVAS or Phaser.WEBGL.

selfParent boolean <optional> false

Use the generated Canvas element as the parent?

Returns:
Description:

The canvas element that was created or pulled from the pool

Type:
  • HTMLCanvasElement
Since: 3.0.0