UIGradient
UIGradient : UIComponent
Overview
A UI component that applies a color and transparency gradient to the background of its parent UI element.
The gradient is applied relative to the area of the parent UI element: Type determines its shape, Rotation its direction, Offset its position, and Scale its width, while TileMode specifies how the area outside the gradient range is filled. The gradient is applied only to the parent UI element's own background and does not affect child UI elements.
UIGradient is used by placing it as a child of the UI element to which the gradient is to be applied. If a UI element has multiple UIGradients, only the first UIGradient is applied.
Properties
Color
ColorSequence
Specifies, as a ColorSequence, the colors that are multiplied with the background color of the parent UI element along the gradient.
Because the colors are multiplied with the background color, it is recommended to set the background color of the parent UI element to white to display the ColorSequence colors as they are. The default is solid white, which keeps the color of the parent UI element unchanged.
Code Samples
Enabled
boolean
Specifies whether the gradient is applied.
When set to false, the gradient is removed and the parent UI element is displayed in its original color. The default is true.
Code Samples
Offset
Vector2
Shifts the position of the gradient.
It uses normalized coordinates in which the size of the parent UI element is 1. For example, specifying Vector2.new(0.5, 0) shifts the gradient by half the width of the parent UI element. The default is Vector2.new(0, 0).
Code Samples
Rotation
number
Specifies the direction of the gradient as an angle in degrees.
The left-to-right direction is 0 degrees, and the gradient rotates clockwise as the value increases. When Type is Conical, this value indicates the angle at which the gradient starts. The default is 0.
Code Samples
Scale
number
Specifies the width of the gradient.
When greater than 1, the gradient is stretched so that only part of it is visible; when less than 1, the gradient is narrowed, leaving areas outside its range. Areas outside the range are filled according to TileMode. The minimum value is 0.01, and the default is 1.
Code Samples
TileMode
Enum.GradientTileMode
Specifies how the area outside the gradient range is filled.
The default is Clamp.
Code Samples
Transparency
NumberSequence
Specifies, as a NumberSequence, the transparency that is added to the parent UI element along the gradient.
A value of 0 keeps the transparency of the parent UI element unchanged, and a value of 1 makes it fully transparent. The Envelope value of NumberSequenceKeypoint is not applied. The default is 0 across the entire range.
Code Samples
Type
Enum.GradientType
Specifies the shape of the gradient.
The default is Linear.
Code Samples
Methods
Events
Last updated