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: To
Phaser.Display.Align.To

Methods

<static> BottomCenter(gameObject, alignTo, [offsetX], [offsetY])
Focus
Focus

Description:

Takes given Game Object and aligns it so that it is positioned next to the bottom center position of the other.

Parameters:

name type arguments description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>

Optional horizontal offset from the position.

offsetY number <optional>

Optional vertical offset from the position.

Returns:
Description:

The Game Object that was aligned.

Examples:
Since: 3.0.0
Focus
Focus
<static> BottomLeft(gameObject, alignTo, [offsetX], [offsetY])
Focus
Focus

Description:

Takes given Game Object and aligns it so that it is positioned next to the bottom left position of the other.

Parameters:

name type arguments description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>

Optional horizontal offset from the position.

offsetY number <optional>

Optional vertical offset from the position.

Returns:
Description:

The Game Object that was aligned.

Examples:
Since: 3.0.0
Focus
Focus
<static> BottomRight(gameObject, alignTo, [offsetX], [offsetY])
Focus
Focus

Description:

Takes given Game Object and aligns it so that it is positioned next to the bottom right position of the other.

Parameters:

name type arguments description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>

Optional horizontal offset from the position.

offsetY number <optional>

Optional vertical offset from the position.

Returns:
Description:

The Game Object that was aligned.

Examples:
Since: 3.0.0
Focus
Focus
<static> LeftBottom(gameObject, alignTo, [offsetX], [offsetY])
Focus
Focus

Description:

Takes given Game Object and aligns it so that it is positioned next to the left bottom position of the other.

Parameters:

name type arguments description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>

Optional horizontal offset from the position.

offsetY number <optional>

Optional vertical offset from the position.

Returns:
Description:

The Game Object that was aligned.

Examples:
Since: 3.0.0
Focus
Focus
<static> LeftCenter(gameObject, alignTo, [offsetX], [offsetY])
Focus
Focus

Description:

Takes given Game Object and aligns it so that it is positioned next to the left center position of the other.

Parameters:

name type arguments description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>

Optional horizontal offset from the position.

offsetY number <optional>

Optional vertical offset from the position.

Returns:
Description:

The Game Object that was aligned.

Examples:
Since: 3.0.0
Focus
Focus
<static> LeftTop(gameObject, alignTo, [offsetX], [offsetY])
Focus
Focus

Description:

Takes given Game Object and aligns it so that it is positioned next to the left top position of the other.

Parameters:

name type arguments description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>

Optional horizontal offset from the position.

offsetY number <optional>

Optional vertical offset from the position.

Returns:
Description:

The Game Object that was aligned.

Examples:
Since: 3.0.0
Focus
Focus
<static> QuickSet(child, alignTo, position, [offsetX], [offsetY])
Focus
Focus

Description:

Takes a Game Object and aligns it next to another, at the given position. The alignment used is based on the position argument, which is a Phaser.Display.Align property such as LEFT_CENTER or TOP_RIGHT.

Parameters:

name type arguments description
child Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

position number

The position to align the Game Object with. This is an align constant, such as Phaser.Display.Align.LEFT_CENTER.

offsetX number <optional>

Optional horizontal offset from the position.

offsetY number <optional>

Optional vertical offset from the position.

Returns:
Description:

The Game Object that was aligned.

Examples:
Since: 3.22.0
Focus
Focus
<static> RightBottom(gameObject, alignTo, [offsetX], [offsetY])
Focus
Focus

Description:

Takes given Game Object and aligns it so that it is positioned next to the right bottom position of the other.

Parameters:

name type arguments description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>

Optional horizontal offset from the position.

offsetY number <optional>

Optional vertical offset from the position.

Returns:
Description:

The Game Object that was aligned.

Examples:
Since: 3.0.0
Focus
Focus
<static> RightCenter(gameObject, alignTo, [offsetX], [offsetY])
Focus
Focus

Description:

Takes given Game Object and aligns it so that it is positioned next to the right center position of the other.

Parameters:

name type arguments description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>

Optional horizontal offset from the position.

offsetY number <optional>

Optional vertical offset from the position.

Returns:
Description:

The Game Object that was aligned.

Examples:
Since: 3.0.0
Focus
Focus
<static> RightTop(gameObject, alignTo, [offsetX], [offsetY])
Focus
Focus

Description:

Takes given Game Object and aligns it so that it is positioned next to the right top position of the other.

Parameters:

name type arguments description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>

Optional horizontal offset from the position.

offsetY number <optional>

Optional vertical offset from the position.

Returns:
Description:

The Game Object that was aligned.

Examples:
Since: 3.0.0
Focus
Focus
<static> TopCenter(gameObject, alignTo, [offsetX], [offsetY])
Focus
Focus

Description:

Takes given Game Object and aligns it so that it is positioned next to the top center position of the other.

Parameters:

name type arguments description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>

Optional horizontal offset from the position.

offsetY number <optional>

Optional vertical offset from the position.

Returns:
Description:

The Game Object that was aligned.

Examples:
Since: 3.0.0
Focus
Focus
<static> TopLeft(gameObject, alignTo, [offsetX], [offsetY])
Focus
Focus

Description:

Takes given Game Object and aligns it so that it is positioned next to the top left position of the other.

Parameters:

name type arguments description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>

Optional horizontal offset from the position.

offsetY number <optional>

Optional vertical offset from the position.

Returns:
Description:

The Game Object that was aligned.

Examples:
Since: 3.0.0
Focus
Focus
<static> TopRight(gameObject, alignTo, [offsetX], [offsetY])
Focus
Focus

Description:

Takes given Game Object and aligns it so that it is positioned next to the top right position of the other.

Parameters:

name type arguments description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>

Optional horizontal offset from the position.

offsetY number <optional>

Optional vertical offset from the position.

Returns:
Description:

The Game Object that was aligned.

Examples:
Since: 3.0.0
Focus
Focus