-
Notifications
You must be signed in to change notification settings - Fork 1
1. Class Reference
Node2D
Node that provides simple 2D eliptical shadow.
Draws an elliptical ground shadow under a Node2D actor. You control size, position, color, and gradient steps from the inspector or from code.
Shadow textures with the same settings share one cached texture across all Shadow2D nodes.
On ready, the node uses nearest texture filtering, show_behind_parent, and draw order suited for y-sorted scenes.
| Name | Value |
|---|---|
MIN_SHADOW_SIZE |
1 |
| Type | Name | Default |
|---|---|---|
float |
width |
32.0 |
float |
height |
16.0 |
Vector2 |
offset |
Vector2(0, 8) |
Color |
color |
Color(0, 0, 0, 0.5) |
int |
shadow_steps |
1 |
float |
smoothing_amount |
0.0 |
float |
step_falloff |
0.3 |
| Return Type | Method |
|---|---|
void |
apply_dimensions(float new_width, float new_height, Vector2 new_offset) |
ImageTexture |
create_texture() |
Minimum width and height in pixels when the shadow texture is generated.
Horizontal size of the shadow ellipse in pixels.
Vertical size of the shadow ellipse in pixels.
Position offset from the parent node origin in pixels. Positive Y moves the shadow downward.
Shadow tint and base opacity. Alpha drives the overall strength of the shadow.
Number of gradient layers inside the ellipse. 1 draws a single smooth falloff. Higher values add stepped bands.
Range: 1 to 16.
Edge softness from 0.0 (sharp) to 1.0 (fully smooth). Also softens transitions between shadow steps when shadow_steps is above 1.
Range: 0.0 to 1.0.
Alpha multiplier applied per shadow step layer when shadow_steps is above 1.
Range: 0.0 to 1.0.
Sets width, height, and offset together in one texture refresh. Use this when you load actor data and want to avoid multiple rebuilds from separate property assignments.
Returns an ImageTexture built from the current property values. The texture is stored in the shared cache when the same settings are used again.