UIGradient
Applies a color and transparency gradient to the UI elements rendered by the parent GuiObject.
| Memory category | Instances |
|---|
Member index 8
Description
UIGradient applies a color and transparency gradient to the UI elements rendered by the parent GuiObject. The appearance of the gradient is configurable through its Color (ColorSequence), Transparency (NumberSequence), Offset (Vector2), and Rotation (number).
A UIGradient will not apply to child or descendant GuiObjects. In order to apply the same gradient to multiple objects, you will need multiple gradient instances.
See also Appearance Modifiers for more information on UIGradient objects and how they work.
Supported Objects
You can apply gradients to Frame, TextLabel, TextButton, ImageLabel, ImageButton, and ViewportFrame. However, ScrollingFrame and TextBox are not currently supported.
Performance Considerations
In order to efficiently use a UIGradient, follow these principles:
Avoid using more than 6 color stops on the Color sequence.
Avoid using a UIGradient on any object that applies a text stroke (TextStrokeColor3), as the gradient will try to blend with strokes and borders, and may cause performance issues.
Avoid setting Color and Transparency frequently: this causes the sequence of colors to rebuild often, which is expensive. If possible, set these properties only once and try to animate the Offset or Rotation properties to achieve a similar effect. Alternatively, you can change the color of the parent GuiObject using such properties as BackgroundColor3, ImageColor3, or TextColor3.
When applying an unchanging gradient on a UI element whose state changes a lot, there is a tradeoff between using a UIGradient (processing time) and a static gradient image (memory).
History 40
- 732 Change Tags of Type from [] to [NotBrowsable]
- 732 Change Tags of TileMode from [] to [NotBrowsable]
- 732 Change Tags of Scale from [] to [NotBrowsable]
- 731 Change Default of Type from to Linear
- 731 Change Default of Transparency from to NumberSequence(0 0 0 1 0 0 )
- 731 Change Default of TileMode from to Clamp
- 731 Change Default of Scale from to 1
- 731 Change Default of Rotation from to 0
- 731 Change Default of Offset from to Vector2(0, 0)
- 731 Change Default of Enabled from to true
- 731 Change Default of Color from to ColorSequence(0 1 1 1 0 1 1 1 1 0 )
- 726 Add Type
- 726 Change Default of Transparency from NumberSequence(0 0 0 1 0 0 ) to
- 726 Add TileMode
- 726 Add Scale
- 726 Change Default of Rotation from 0 to
- 726 Change Default of Offset from Vector2(0, 0) to
- 726 Change Default of Enabled from true to
- 726 Change Default of Color from ColorSequence(0 1 1 1 0 1 1 1 1 0 ) to
- 553 Change Default of Transparency from to NumberSequence(0 0 0 1 0 0 )
- 553 Change Default of Rotation from to 0
- 553 Change Default of Offset from to Vector2(0, 0)
- 553 Change Default of Enabled from to true
- 553 Change Default of Color from to ColorSequence(0 1 1 1 0 1 1 1 1 0 )
- 486 Change ThreadSafety of Transparency from ReadOnly to ReadSafe
- 486 Change ThreadSafety of Rotation from ReadOnly to ReadSafe
- 486 Change ThreadSafety of Offset from ReadOnly to ReadSafe
- 486 Change ThreadSafety of Enabled from ReadOnly to ReadSafe
- 486 Change ThreadSafety of Color from ReadOnly to ReadSafe
- 462 Change ThreadSafety of Transparency from to ReadOnly
- 462 Change ThreadSafety of Rotation from to ReadOnly
- 462 Change ThreadSafety of Offset from to ReadOnly
- 462 Change ThreadSafety of Enabled from to ReadOnly
- 462 Change ThreadSafety of Color from to ReadOnly
- 423 Add Enabled
- 412 Add Transparency
- 412 Add Rotation
- 412 Add Offset
- 412 Add Color
- 412 Add UIGradient
Members 8
Color
| Type | Default | |
|---|---|---|
| ColorSequence | 0 1 1 1 0 1 1 1 1 0 | |
| Thread safety | ReadSafe |
|---|---|
| Category | Appearance |
| Loaded/Saved | true |
History 6
- 731 Change Default of Color from to ColorSequence(0 1 1 1 0 1 1 1 1 0 )
- 726 Change Default of Color from ColorSequence(0 1 1 1 0 1 1 1 1 0 ) to
- 553 Change Default of Color from to ColorSequence(0 1 1 1 0 1 1 1 1 0 )
- 486 Change ThreadSafety of Color from ReadOnly to ReadSafe
- 462 Change ThreadSafety of Color from to ReadOnly
- 412 Add Color
Enabled
| Type | Default | |
|---|---|---|
| bool | true | |
| Thread safety | ReadSafe |
|---|---|
| Category | Appearance |
| Loaded/Saved | true |
Offset
| Type | Default | |
|---|---|---|
| Vector2 | 0, 0 | |
| Thread safety | ReadSafe |
|---|---|
| Category | Appearance |
| Loaded/Saved | true |
Rotation
| Type | Default | |
|---|---|---|
| float | 0 | |
| Thread safety | ReadSafe |
|---|---|
| Category | Appearance |
| Loaded/Saved | true |
Scale
| Type | Default | |
|---|---|---|
| float | 1 | |
| Thread safety | ReadSafe |
|---|---|
| Category | Appearance |
| Loaded/Saved | true |
TileMode
| Type | Default | |
|---|---|---|
| GradientTileMode | Clamp | |
| Thread safety | ReadSafe |
|---|---|
| Category | Appearance |
| Loaded/Saved | true |
Transparency
| Type | Default | |
|---|---|---|
| NumberSequence | 0 0 0 1 0 0 | |
| Thread safety | ReadSafe |
|---|---|
| Category | Appearance |
| Loaded/Saved | true |
History 6
- 731 Change Default of Transparency from to NumberSequence(0 0 0 1 0 0 )
- 726 Change Default of Transparency from NumberSequence(0 0 0 1 0 0 ) to
- 553 Change Default of Transparency from to NumberSequence(0 0 0 1 0 0 )
- 486 Change ThreadSafety of Transparency from ReadOnly to ReadSafe
- 462 Change ThreadSafety of Transparency from to ReadOnly
- 412 Add Transparency
Type
| Type | Default | |
|---|---|---|
| GradientType | Linear | |
| Thread safety | ReadSafe |
|---|---|
| Category | Appearance |
| Loaded/Saved | true |