Skip to main content
Version: Phaser v4.0.0

Phaser.GameObjects.Components.AlphaSingle

Scope: static

Source: src/gameobjects/components/AlphaSingle.js#L12
Since: 3.22.0

Static functions

alpha

alpha: number

Description:

The alpha value of the Game Object.

This is a global value, impacting the entire Game Object, not just a region of it. The value is clamped to the range [0, 1]. Setting alpha to 0 also clears the render flag, preventing the Game Object from being drawn until the alpha is raised above 0 again.

Source: src/gameobjects/components/AlphaSingle.js#L70
Since: 3.0.0


Static functions

clearAlpha

<instance> clearAlpha()

Description:

Clears the alpha value associated with this Game Object.

Immediately sets the alpha back to 1 (fully opaque).

Returns: Phaser.GameObjects.Components.AlphaSingle - This Game Object instance.

Source: src/gameobjects/components/AlphaSingle.js#L35
Since: 3.0.0


setAlpha

<instance> setAlpha([value])

Description:

Set the Alpha level of this Game Object. The alpha controls the opacity of the Game Object as it renders. Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque.

Parameters:

nametypeoptionaldefaultdescription
valuenumberYes1The alpha value applied across the whole Game Object.

Returns: Phaser.GameObjects.Components.AlphaSingle - This Game Object instance.

Source: src/gameobjects/components/AlphaSingle.js#L50
Since: 3.0.0