Phaser API Documentation

  Version: 
Filter
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord
Namespace: Center
Phaser.Scale.Center

Members

<static, constant> CENTER_BOTH: number
Focus
Focus

Description:

The game canvas is centered both horizontally and vertically within the parent. To do this, the parent has to have a bounds that can be calculated and not be empty.

Centering is achieved by setting the margin left and top properties of the game canvas, and does not factor in any other CSS styles you may have applied.

Type:
number
Since: 3.16.0
Focus
Focus
<static, constant> CENTER_HORIZONTALLY: number
Focus
Focus

Description:

The game canvas is centered horizontally within the parent. To do this, the parent has to have a bounds that can be calculated and not be empty.

Centering is achieved by setting the margin left and top properties of the game canvas, and does not factor in any other CSS styles you may have applied.

Type:
number
Since: 3.16.0
Focus
Focus
<static, constant> CENTER_VERTICALLY: number
Focus
Focus

Description:

The game canvas is centered both vertically within the parent. To do this, the parent has to have a bounds that can be calculated and not be empty.

Centering is achieved by setting the margin left and top properties of the game canvas, and does not factor in any other CSS styles you may have applied.

Type:
number
Since: 3.16.0
Focus
Focus
<static, constant> NO_CENTER: number
Focus
Focus

Description:

The game canvas is not centered within the parent by Phaser. You can still center it yourself via CSS.

Type:
number
Since: 3.16.0
Focus
Focus