UIShadow
Renders configurable shape or text shadows for the parent UI instance.
| Memory category | Instances |
|---|
Member index 10
Description
UIShadow renders a shadow for its parent UI instance. Key features include:
- Adjust the shadow's blurriness with BlurRadius.
- Adjust the shadow's color and transparency with Color and Transparency.
- Adjust the shadow's position and size relative to the parent with Offset and Spread.
- Add multiple shadows under the same parent and adjust their render order with ZIndex.
- Add a shadow to the text in TextLabel, TextButton, or TextBox with Mode.
- Add an inset shadow with Inset.
- Hide the part of the shadow directly behind the parent with ShowBehindParent.
- Apply a gradient to a shadow's color with a child UIGradient.
- If the parent is rotated with GuiObject.Rotation, the shadow will also be rotated.
- If the parent has round corners with UICorner, the shadow will also have round corners.
Limitations
UIShadowdoes not support Path2D.- You cannot apply textures to a
UIShadow.
History 13
Members 10
BlurRadius
| Type | Default | |
|---|---|---|
| UDim | 0, 0 | |
This property determines the shadow's blurriness. A larger value makes the shadow's edges appear softer.
Note that the scale factor of this UDim property is relative to
the parent's width or height, whichever is shorter. This property must
also be non-negative; a negative value will be treated as 0.
| Thread safety | ReadSafe |
|---|---|
| Category | Appearance |
| Loaded/Saved | true |
History 1
- 711 Add BlurRadius
Color
| Type | Default | |
|---|---|---|
| Color3 | 0, 0, 0 | |
This property determines the shadow's color.
| Thread safety | ReadSafe |
|---|---|
| Category | Appearance |
| Loaded/Saved | true |
Enabled
| Type | Default | |
|---|---|---|
| bool | true | |
This property determines whether the UIShadow is visible. Default is
true.
| Thread safety | ReadSafe |
|---|---|
| Category | Data |
| Loaded/Saved | true |
Inset
| Type | Default | |
|---|---|---|
| bool | false | |
When true, the shadow appears on top of and inside the parent. When
false, the shadow appears behind the parent.
Defaults to false. This property has no effect when
Mode is ApplyShadowMode.Text.
| Thread safety | ReadSafe |
|---|---|
| Category | Appearance |
| Loaded/Saved | true |
Mode
| Type | Default | |
|---|---|---|
| ApplyShadowMode | Shape | |
Determines whether the shadow applies to the parent's shape or text. Defaults to ApplyShadowMode.Shape, which renders a shadow for the parent's rectangular area.
ApplyShadowMode.Text renders a shadow for text in a TextLabel, TextButton, or TextBox. On other classes, text mode renders no shadow.
Shape mode and Text mode shadows can coexist under the same parent.
The following properties have no effect in text mode:
| Thread safety | ReadSafe |
|---|---|
| Category | Appearance |
| Loaded/Saved | true |
Offset
| Type | Default | |
|---|---|---|
| UDim2 | {0, 0}, {0, 0} | |
This property moves the shadow relative to the parent's position. The X scale factor is relative to the parent's width, and the Y scale factor is relative to the parent's height.
| Thread safety | ReadSafe |
|---|---|
| Category | Appearance |
| Loaded/Saved | true |
ShowBehindParent
| Type | Default | |
|---|---|---|
| bool | true | |
When true, the entire shadow is rendered. When false, the parent's
shape masks the portion of the shadow directly behind it. Disabling this
property prevents a shadow from obscuring content behind a transparent
parent.
Defaults to true. This property has no effect when
Mode is ApplyShadowMode.Text or
Inset is true.
| Thread safety | ReadSafe |
|---|---|
| Category | Appearance |
| Loaded/Saved | true |
History 1
- 733 Add ShowBehindParent
Spread
| Type | Default | |
|---|---|---|
| UDim2 | {0, 0}, {0, 0} | |
This property expands or shrinks the shadow relative to the parent's size.
The X scale factor is relative to the parent's width, and the Y scale
factor is relative to the parent's height. Properties that are relative to
the parent's size, such as the scale factors of
BlurRadius and Offset,
are not affected by Spread.
This property has no effect when Mode is ApplyShadowMode.Text.
When Inset is true, positive Spread values
expand the shadow toward the center of the parent instead of outward.
| Thread safety | ReadSafe |
|---|---|
| Category | Appearance |
| Loaded/Saved | true |
Transparency
| Type | Default | |
|---|---|---|
| float | 0 | |
This property sets the shadow's transparency, with 0 being fully opaque
and 1 being fully transparent.
| Thread safety | ReadSafe |
|---|---|
| Category | Appearance |
| Loaded/Saved | true |
History 1
- 711 Add Transparency
ZIndex
| Type | Default | |
|---|---|---|
| int | -1 | |
If a UI instance has multiple shadows, they are rendered in order of
increasing ZIndex. Since all shadows are rendered below the parent
instance, ZIndex can only be negative.
| Thread safety | ReadSafe |
|---|---|
| Category | Appearance |
| Loaded/Saved | true |