Phaser API Documentation

  Version: 
Filter

Phaser . FX . Glow

Phaser . FX . Glow

The Glow FX Controller.

This FX controller manages the glow effect for a Game Object.

The glow effect is a visual technique that creates a soft, luminous halo around game objects, characters, or UI elements. This effect is used to emphasize importance, enhance visual appeal, or convey a sense of energy, magic, or otherworldly presence. The effect can also be set on the inside of the Game Object. The color and strength of the glow can be modified.

A Glow effect is added to a Game Object via the FX component:

const sprite = this.add.sprite();

sprite.preFX.addGlow();
sprite.postFX.addGlow();

Constructor:

new Glow(gameObject, [color], [outerStrength], [innerStrength], [knockout])

Parameters:

name type arguments Default description
gameObject Phaser.GameObjects.GameObject

A reference to the Game Object that has this fx.

color number <optional> 0xffffff

The color of the glow effect as a number value.

outerStrength number <optional> 4

The strength of the glow outward from the edge of the Sprite.

innerStrength number <optional> 0

The strength of the glow inward from the edge of the Sprite.

knockout boolean <optional> false

If true only the glow is drawn, not the texture itself.

Since: 3.60.0
Source: src/fx/Glow.js (Line 11)

Extends


Members

active: boolean
Focus
Focus

Description:

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.

Type:
boolean
Inherited from: Phaser.FX.Controller#active
Since: 3.60.0
Source: src/fx/Controller.js (Line 47)
Focus
Focus
color: number
Focus
Focus

Description:

The color of the glow as a number value.

Type:
number
Since: 3.60.0
Source: src/fx/Glow.js (Line 99)
Focus
Focus

Description:

A reference to the Game Object that owns this effect.

Type:
Inherited from: Phaser.FX.Controller#gameObject
Since: 3.60.0
Source: src/fx/Controller.js (Line 38)
Focus
Focus
glcolor: Array.<number>
Focus
Focus

Description:

A 4 element array of gl color values.

Type:
Array.<number>
Since: 3.60.0
Source: src/fx/Glow.js (Line 84)
Focus
Focus
innerStrength: number
Focus
Focus

Description:

The strength of the glow inward from the edge of the Sprite.

Type:
number
Since: 3.60.0
Source: src/fx/Glow.js (Line 66)
Focus
Focus
knockout: number
Focus
Focus

Description:

If true only the glow is drawn, not the texture itself.

Type:
number
Since: 3.60.0
Source: src/fx/Glow.js (Line 75)
Focus
Focus
outerStrength: number
Focus
Focus

Description:

The strength of the glow outward from the edge of the Sprite.

Type:
number
Since: 3.60.0
Source: src/fx/Glow.js (Line 57)
Focus
Focus
type: number
Focus
Focus

Description:

The FX_CONST type of this effect.

Type:
number
Inherited from: Phaser.FX.Controller#type
Since: 3.60.0
Source: src/fx/Controller.js (Line 29)
Focus
Focus

Methods

destroy()
Focus
Focus

Description:

Destroys this FX Controller.

Inherited from: Phaser.FX.Controller#destroy
Since: 3.60.0
Source: src/fx/Controller.js (Line 81)
Focus
Focus
setActive(value)
Focus
Focus

Description:

Sets the active state of this FX Controller.

A disabled FX Controller will not be updated.

Parameters:

name type description
value boolean

true to enable this FX Controller, or false to disable it.

Returns:
Description:

This FX Controller instance.

Inherited from: Phaser.FX.Controller#setActive
Since: 3.60.0
Source: src/fx/Controller.js (Line 62)
Focus
Focus