Phaser.Display.Align.To
Scope: static
Source: src/display/align/to/index.js#L7
Static functions
BottomCenter
<static> BottomCenter(gameObject, alignTo, [offsetX], [offsetY])
Description:
Takes a given Game Object and aligns it so that its top edge is flush with the bottom of the alignTo Game Object, centered horizontally on it.
Tags:
- generic
Parameters:
| name | type | optional | default | description |
|---|---|---|---|---|
| gameObject | Phaser.GameObjects.GameObject | No | The Game Object that will be positioned. | |
| alignTo | Phaser.GameObjects.GameObject | No | The Game Object to base the alignment position on. | |
| offsetX | number | Yes | 0 | Optional horizontal offset from the position. |
| offsetY | number | Yes | 0 | Optional vertical offset from the position. |
Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.
Source: src/display/align/to/BottomCenter.js#L12
Since: 3.0.0
BottomLeft
<static> BottomLeft(gameObject, alignTo, [offsetX], [offsetY])
Description:
Takes a given Game Object and aligns it so that it is placed directly below the alignTo Game Object, with its left edge aligned to the left edge of alignTo.
Tags:
- generic
Parameters:
| name | type | optional | default | description |
|---|---|---|---|---|
| gameObject | Phaser.GameObjects.GameObject | No | The Game Object that will be positioned. | |
| alignTo | Phaser.GameObjects.GameObject | No | The Game Object to base the alignment position on. | |
| offsetX | number | Yes | 0 | Optional horizontal offset from the position. |
| offsetY | number | Yes | 0 | Optional vertical offset from the position. |
Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.
Source: src/display/align/to/BottomLeft.js#L12
Since: 3.0.0
BottomRight
<static> BottomRight(gameObject, alignTo, [offsetX], [offsetY])
Description:
Takes a given Game Object and aligns it so that it is placed directly below and flush with the right edge of the other Game Object. The right edge of gameObject is aligned to the right edge of alignTo, and the top edge of gameObject is placed at the bottom edge of alignTo.
Tags:
- generic
Parameters:
| name | type | optional | default | description |
|---|---|---|---|---|
| gameObject | Phaser.GameObjects.GameObject | No | The Game Object that will be positioned. | |
| alignTo | Phaser.GameObjects.GameObject | No | The Game Object to base the alignment position on. | |
| offsetX | number | Yes | 0 | Optional horizontal offset from the position. |
| offsetY | number | Yes | 0 | Optional vertical offset from the position. |
Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.
Source: src/display/align/to/BottomRight.js#L12
Since: 3.0.0
LeftBottom
<static> LeftBottom(gameObject, alignTo, [offsetX], [offsetY])
Description:
Takes a given Game Object and aligns it so that its right edge touches the left edge of the alignTo Game Object, with its bottom edge aligned to the bottom edge of alignTo.
Tags:
- generic
Parameters:
| name | type | optional | default | description |
|---|---|---|---|---|
| gameObject | Phaser.GameObjects.GameObject | No | The Game Object that will be positioned. | |
| alignTo | Phaser.GameObjects.GameObject | No | The Game Object to base the alignment position on. | |
| offsetX | number | Yes | 0 | Optional horizontal offset from the position. |
| offsetY | number | Yes | 0 | Optional vertical offset from the position. |
Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.
Source: src/display/align/to/LeftBottom.js#L12
Since: 3.0.0
LeftCenter
<static> LeftCenter(gameObject, alignTo, [offsetX], [offsetY])
Description:
Takes a given Game Object and aligns it so that its right edge touches the left edge of the alignTo Game Object, with their vertical centers matched.
Tags:
- generic
Parameters:
| name | type | optional | default | description |
|---|---|---|---|---|
| gameObject | Phaser.GameObjects.GameObject | No | The Game Object that will be positioned. | |
| alignTo | Phaser.GameObjects.GameObject | No | The Game Object to base the alignment position on. | |
| offsetX | number | Yes | 0 | Optional horizontal offset from the position. |
| offsetY | number | Yes | 0 | Optional vertical offset from the position. |
Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.
Source: src/display/align/to/LeftCenter.js#L12
Since: 3.0.0
LeftTop
<static> LeftTop(gameObject, alignTo, [offsetX], [offsetY])
Description:
Takes a given Game Object and aligns it so that its right edge touches the left edge of the alignTo Game Object, with its top edge aligned to the top of alignTo.
Tags:
- generic
Parameters:
| name | type | optional | default | description |
|---|---|---|---|---|
| gameObject | Phaser.GameObjects.GameObject | No | The Game Object that will be positioned. | |
| alignTo | Phaser.GameObjects.GameObject | No | The Game Object to base the alignment position on. | |
| offsetX | number | Yes | 0 | Optional horizontal offset from the position. |
| offsetY | number | Yes | 0 | Optional vertical offset from the position. |
Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.
Source: src/display/align/to/LeftTop.js#L12
Since: 3.0.0
QuickSet
<static> QuickSet(child, alignTo, position, [offsetX], [offsetY])
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.
Tags:
- generic
Parameters:
| name | type | optional | default | description |
|---|---|---|---|---|
| child | Phaser.GameObjects.GameObject | No | The Game Object that will be positioned. | |
| alignTo | Phaser.GameObjects.GameObject | No | The Game Object to base the alignment position on. | |
| position | number | No | The position to align the Game Object with. This is an align constant, such as Phaser.Display.Align.LEFT_CENTER. | |
| offsetX | number | Yes | 0 | Optional horizontal offset from the position, in pixels. |
| offsetY | number | Yes | 0 | Optional vertical offset from the position, in pixels. |
Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.
Source: src/display/align/to/QuickSet.js#L24
Since: 3.22.0
RightBottom
<static> RightBottom(gameObject, alignTo, [offsetX], [offsetY])
Description:
Takes a given Game Object and aligns it so that it is placed immediately to the right of the alignTo Game Object, with their bottom edges aligned.
Tags:
- generic
Parameters:
| name | type | optional | default | description |
|---|---|---|---|---|
| gameObject | Phaser.GameObjects.GameObject | No | The Game Object that will be positioned. | |
| alignTo | Phaser.GameObjects.GameObject | No | The Game Object to base the alignment position on. | |
| offsetX | number | Yes | 0 | Optional horizontal offset from the position. |
| offsetY | number | Yes | 0 | Optional vertical offset from the position. |
Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.
Source: src/display/align/to/RightBottom.js#L12
Since: 3.0.0
RightCenter
<static> RightCenter(gameObject, alignTo, [offsetX], [offsetY])
Description:
Takes a given Game Object and aligns it so that its left edge is flush with the right edge of the alignTo Game Object, with their vertical centers matching.
Tags:
- generic
Parameters:
| name | type | optional | default | description |
|---|---|---|---|---|
| gameObject | Phaser.GameObjects.GameObject | No | The Game Object that will be positioned. | |
| alignTo | Phaser.GameObjects.GameObject | No | The Game Object to base the alignment position on. | |
| offsetX | number | Yes | 0 | Optional horizontal offset from the position. |
| offsetY | number | Yes | 0 | Optional vertical offset from the position. |
Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.
Source: src/display/align/to/RightCenter.js#L12
Since: 3.0.0
RightTop
<static> RightTop(gameObject, alignTo, [offsetX], [offsetY])
Description:
Takes a given Game Object and aligns it so that its left edge is flush with the right edge of the alignTo Game Object, with its top edge matching the top edge of alignTo.
Tags:
- generic
Parameters:
| name | type | optional | default | description |
|---|---|---|---|---|
| gameObject | Phaser.GameObjects.GameObject | No | The Game Object that will be positioned. | |
| alignTo | Phaser.GameObjects.GameObject | No | The Game Object to base the alignment position on. | |
| offsetX | number | Yes | 0 | Optional horizontal offset from the position. |
| offsetY | number | Yes | 0 | Optional vertical offset from the position. |
Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.
Source: src/display/align/to/RightTop.js#L12
Since: 3.0.0
TopCenter
<static> TopCenter(gameObject, alignTo, [offsetX], [offsetY])
Description:
Takes a given Game Object and aligns it so that it is placed directly above the alignTo Game Object, centered horizontally on it. The bottom edge of gameObject is positioned flush with the top edge of alignTo, and their center X coordinates are matched.
Tags:
- generic
Parameters:
| name | type | optional | default | description |
|---|---|---|---|---|
| gameObject | Phaser.GameObjects.GameObject | No | The Game Object that will be positioned. | |
| alignTo | Phaser.GameObjects.GameObject | No | The Game Object to base the alignment position on. | |
| offsetX | number | Yes | 0 | Optional horizontal offset from the position. |
| offsetY | number | Yes | 0 | Optional vertical offset from the position. |
Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.
Source: src/display/align/to/TopCenter.js#L12
Since: 3.0.0
TopLeft
<static> TopLeft(gameObject, alignTo, [offsetX], [offsetY])
Description:
Takes a given Game Object and aligns it so that its bottom edge sits flush with the top edge of the alignTo Game Object, with their left edges aligned. The result is that gameObject appears directly above alignTo, anchored to its left side.
Tags:
- generic
Parameters:
| name | type | optional | default | description |
|---|---|---|---|---|
| gameObject | Phaser.GameObjects.GameObject | No | The Game Object that will be positioned. | |
| alignTo | Phaser.GameObjects.GameObject | No | The Game Object to base the alignment position on. | |
| offsetX | number | Yes | 0 | Optional horizontal offset from the position. |
| offsetY | number | Yes | 0 | Optional vertical offset from the position. |
Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.
Source: src/display/align/to/TopLeft.js#L12
Since: 3.0.0
TopRight
<static> TopRight(gameObject, alignTo, [offsetX], [offsetY])
Description:
Takes a given Game Object and aligns it so that it is positioned directly above the alignTo Game Object, with their right edges aligned.
Tags:
- generic
Parameters:
| name | type | optional | default | description |
|---|---|---|---|---|
| gameObject | Phaser.GameObjects.GameObject | No | The Game Object that will be positioned. | |
| alignTo | Phaser.GameObjects.GameObject | No | The Game Object to base the alignment position on. | |
| offsetX | number | Yes | 0 | Optional horizontal offset from the position. |
| offsetY | number | Yes | 0 | Optional vertical offset from the position. |
Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.
Source: src/display/align/to/TopRight.js#L12
Since: 3.0.0