Creates a new Canvas DOM element, or pulls one from the pool if free.
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 |
selfParent | boolean | <optional> | false |
Use the generated Canvas element as the parent? |
The canvas element that was created or pulled from the pool
Creates a new Canvas DOM element, or pulls one from the pool if free.
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. |
The created canvas.
Creates a new Canvas DOM element, or pulls one from the pool if free.
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. |
The created WebGL canvas.
Gets the first free canvas index from the pool.
name | type | arguments | Default | description |
---|---|---|---|---|
canvasType | number | <optional> | Phaser.CANVAS |
The type of the Canvas. Either |
The first free canvas, or null
if a WebGL canvas was requested or if the pool doesn't have free canvases.
Looks up a canvas based on its parent, and if found puts it back in the pool, freeing it up for re-use. The canvas has its width and height set to 1, and its parent attribute nulled.
name | type | description |
---|---|---|
parent | * |
The canvas or the parent of the canvas to free. |
Gets the total number of used canvas elements in the pool.
The number of used canvases.
Gets the total number of free canvas elements in the pool.
The number of free canvases.
Disable context smoothing on any new Canvas element created.
Enable context smoothing on any new Canvas element created.