Provides methods used for setting the alpha properties of a Game Object. Should be applied as a mixin and not used directly.
- Since: 3.0.0
- Source: src/gameobjects/components/Alpha.js (Line 12)
Members
-
alpha :number
-
The alpha value of the Game Object.
This is a global value, impacting the entire Game Object, not just a region of it.
Type:
- number
- Since: 3.0.0
- Source: src/gameobjects/components/Alpha.js (Line 129)
-
alphaBottomLeft :number
-
The alpha value starting from the bottom-left of the Game Object. This value is interpolated from the corner to the center of the Game Object.
Type:
- number
- Since: 3.0.0
- Source: src/gameobjects/components/Alpha.js (Line 227)
-
alphaBottomRight :number
-
The alpha value starting from the bottom-right of the Game Object. This value is interpolated from the corner to the center of the Game Object.
Type:
- number
- Since: 3.0.0
- Source: src/gameobjects/components/Alpha.js (Line 257)
-
alphaTopLeft :number
-
The alpha value starting from the top-left of the Game Object. This value is interpolated from the corner to the center of the Game Object.
Type:
- number
- Since: 3.0.0
- Source: src/gameobjects/components/Alpha.js (Line 167)
-
alphaTopRight :number
-
The alpha value starting from the top-right of the Game Object. This value is interpolated from the corner to the center of the Game Object.
Type:
- number
- Since: 3.0.0
- Source: src/gameobjects/components/Alpha.js (Line 197)
Methods
-
clearAlpha()
-
Clears all alpha values associated with this Game Object.
Immediately sets the alpha levels back to 1 (fully opaque).
- Since: 3.0.0
- Source: src/gameobjects/components/Alpha.js (Line 77)
Returns:
This Game Object instance.
-
setAlpha( [topLeft] [, topRight] [, bottomLeft] [, bottomRight])
-
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.
If your game is running under WebGL you can optionally specify four different alpha values, each of which correspond to the four corners of the Game Object. Under Canvas only the
topLeft
value given is used.Parameters:
Name Type Argument Default Description topLeft
number <optional>
1 The alpha value used for the top-left of the Game Object. If this is the only value given it's applied across the whole Game Object.
topRight
number <optional>
The alpha value used for the top-right of the Game Object. WebGL only.
bottomLeft
number <optional>
The alpha value used for the bottom-left of the Game Object. WebGL only.
bottomRight
number <optional>
The alpha value used for the bottom-right of the Game Object. WebGL only.
- Since: 3.0.0
- Source: src/gameobjects/components/Alpha.js (Line 92)
Returns:
This Game Object instance.