The Circle FX Controller.
This FX controller manages the circle effect for a Game Object.
This effect will draw a circle around the texture of the Game Object, effectively masking off any area outside of the circle without the need for an actual mask. You can control the thickness of the circle, the color of the circle and the color of the background, should the texture be transparent. You can also control the feathering applied to the circle, allowing for a harsh or soft edge.
Please note that adding this effect to a Game Object will not change the input area or physics body of the Game Object, should it have one.
A Circle effect is added to a Game Object via the FX component:
const sprite = this.add.sprite();
sprite.preFX.addCircle();
sprite.postFX.addCircle();
new Circle(gameObject, [thickness], [color], [backgroundColor], [scale], [feather])
name | type | arguments | Default | description |
---|---|---|---|---|
gameObject | Phaser.GameObjects.GameObject |
A reference to the Game Object that has this fx. |
||
thickness | number | <optional> | 8 |
The width of the circle around the texture, in pixels. |
color | number | <optional> | 0xfeedb6 |
The color of the circular ring, given as a number value. |
backgroundColor | number | <optional> | 0xff0000 |
The color of the background, behind the texture, given as a number value. |
scale | number | <optional> | 1 |
The scale of the circle. The default scale is 1, which is a circle the full size of the underlying texture. |
feather | number | <optional> | 0.005 |
The amount of feathering to apply to the circle from the ring. |
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 alpha of the background, behind the texture, given as a number value.
The color of the background, behind the texture, given as a number value.
The color of the circular ring, given as a number value.
The amount of feathering to apply to the circle from the ring, extending into the middle of the circle. The default is 0.005, which is a very low amount of feathering just making sure the ring has a smooth edge. Increase this amount to a value such as 0.5 or 0.025 for larger amounts of feathering.
A reference to the Game Object that owns this effect.
The internal gl color array for the ring color.
The internal gl color array for the background color.
The scale of the circle. The default scale is 1, which is a circle the full size of the underlying texture. Reduce this value to create a smaller circle, or increase it to create a circle that extends off the edges of the texture.
The width of the circle around the texture, in pixels. This value doesn't factor in the feather, which can extend the thickness internally depending on its value.
The FX_CONST type of this 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.