setShadow(x, y, color, blur, shadowStroke, shadowFill) → {Phaser.Text}
Sets a drop shadow effect on the Text. You can specify the horizontal and vertical distance of the drop shadow with the x
and y
parameters.
The color controls the shade of the shadow (default is black) and can be either an rgba
or hex
value.
The blur is the strength of the shadow. A value of zero means a hard shadow, a value of 10 means a very soft shadow.
To remove a shadow already in place you can call this method with no parameters set.
Parameters
Name | Type | Argument | Default | Description |
---|---|---|---|---|
x | number | <optional> | 0 | The shadowOffsetX value in pixels. This is how far offset horizontally the shadow effect will be. |
y | number | <optional> | 0 | The shadowOffsetY value in pixels. This is how far offset vertically the shadow effect will be. |
color | string | <optional> | 'rgba(0,0,0,1)' | The color of the shadow, as given in CSS rgba or hex format. Set the alpha component to 0 to disable the shadow. |
blur | number | <optional> | 0 | The shadowBlur value. Make the shadow softer by applying a Gaussian blur to it. A number from 0 (no blur) up to approx. 10 (depending on scene). |
shadowStroke | boolean | <optional> | true | Apply the drop shadow to the Text stroke (if set). |
shadowFill | boolean | <optional> | true | Apply the drop shadow to the Text fill (if set). |
Returns
This Text instance.
- Source code: gameobjects/Text.js (Line 231)
Please login to continue.