Skip to main content
Version: Phaser v3.88.2

Phaser.Scale.Center

Scope: static

Source: src/scale/const/CENTER_CONST.js#L7
Since: 3.16.0

Static functions​

CENTER_BOTH​

CENTER_BOTH: number​

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.

Source: src/scale/const/CENTER_CONST.js#L38
Since: 3.16.0


CENTER_HORIZONTALLY​

CENTER_HORIZONTALLY: number​

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.

Source: src/scale/const/CENTER_CONST.js#L52
Since: 3.16.0


CENTER_VERTICALLY​

CENTER_VERTICALLY: number​

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.

Source: src/scale/const/CENTER_CONST.js#L66
Since: 3.16.0


NO_CENTER​

NO_CENTER: number​

Description:

The game canvas is not centered within the parent by Phaser.

You can still center it yourself via CSS.

Source: src/scale/const/CENTER_CONST.js#L27
Since: 3.16.0