The Shadow FX Controller.
This FX controller manages the shadow effect for a Game Object.
The shadow effect is a visual technique used to create the illusion of depth and realism by adding darker, offset silhouettes or shapes beneath game objects, characters, or environments. These simulated shadows help to enhance the visual appeal and immersion, making the 2D game world appear more dynamic and three-dimensional.
A Shadow effect is added to a Game Object via the FX component:
const sprite = this.add.sprite();
sprite.preFX.addShadow();
sprite.postFX.addShadow();
new Shadow(gameObject, [x], [y], [decay], [power], [color], [samples], [intensity])
name | type | arguments | Default | description |
---|---|---|---|---|
gameObject | Phaser.GameObjects.GameObject |
A reference to the Game Object that has this fx. |
||
x | number | <optional> | 0 |
The horizontal offset of the shadow effect. |
y | number | <optional> | 0 |
The vertical offset of the shadow effect. |
decay | number | <optional> | 0.1 |
The amount of decay for shadow effect. |
power | number | <optional> | 1 |
The power of the shadow effect. |
color | number | <optional> | 0x000000 |
The color of the shadow. |
samples | number | <optional> | 6 |
The number of samples that the shadow effect will run for. An integer between 1 and 12. |
intensity | number | <optional> | 1 |
The intensity of the shadow effect. |
Toggle this boolean to enable or disable this effect, without removing and adding it from the Game Object.
Only works for Pre FX.
Post FX are always active.
The color of the shadow.
The amount of decay for the shadow effect.
A reference to the Game Object that owns this effect.
The internal gl color array.
The intensity of the shadow effect.
The power of the shadow effect.
The number of samples that the shadow effect will run for.
This should be an integer with a minimum value of 1 and a maximum of 12.
The FX_CONST type of this effect.
The horizontal offset of the shadow effect.
The vertical offset of the shadow effect.
Destroys this FX Controller.
Sets the active state of this FX Controller.
A disabled FX Controller will not be updated.
name | type | description |
---|---|---|
value | boolean |
|
This FX Controller instance.