UIGradient

Show Deprecated

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).

Summary

Properties

  • Read Parallel

    Determines the color blended with the parent GuiObject along the length of the gradient.

  • Read Parallel

    Whether the gradient is enabled or not.

  • Read Parallel

    Determines the scalar translation of the gradient from the center of the parent GuiObject.

  • Read Parallel

    Determines the clockwise rotation in degrees of the gradient starting from left to right.

  • Determines how much the parent GuiObject can be seen through along the length of the gradient.

Properties

Read Parallel

Enabled

Read Parallel

Offset

Read Parallel

Rotation

Read Parallel

Transparency

Read Parallel

Methods

Events