rojo/.cursor/rules/roblox/reference/engine/classes/UIGradient.yaml
2026-02-02 12:08:47 -06:00

193 lines
6.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# This file is automatically generated. Please don't edit it manually.
# To submit a bug report on the content, see
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
name: UIGradient
type: class
memory_category: Instances
summary: |
Applies a color and transparency gradient to the UI elements rendered by the
parent `Class.GuiObject`.
description: |
**UIGradient** applies a color and transparency gradient to the UI elements
rendered by the parent `Class.GuiObject`. The appearance of the gradient is
configurable through its `Class.UIGradient.Color|Color`
(`Datatype.ColorSequence`), `Class.UIGradient.Transparency|Transparency`
(`Datatype.NumberSequence`), `Class.UIGradient.Offset|Offset`
(`Datatype.Vector2`), and `Class.UIGradient.Rotation|Rotation` (number).
A `Class.UIGradient` will not apply to child or descendant
`Class.GuiObject|GuiObjects`. In order to apply the same gradient to multiple
objects, you will need multiple gradient instances.
See also [Appearance Modifiers](../../../ui/appearance-modifiers.md) for more
information on `Class.UIGradient` objects and how they work.
#### Supported Objects
You can apply gradients to `Class.Frame`, `Class.TextLabel`,
`Class.TextButton`, `Class.ImageLabel`, `Class.ImageButton`, and
`Class.ViewportFrame`. However, `Class.ScrollingFrame` and `Class.TextBox` are
not currently supported.
#### Performance Considerations
In order to efficiently use a `Class.UIGradient`, follow these principles:
- Avoid using more than 6 color stops on the `Class.UIGradient.Color|Color`
sequence.
- Avoid using a `Class.UIGradient` on any object that applies a text stroke
(`Class.TextLabel.TextStrokeColor3|TextStrokeColor3`), as the gradient will
try to blend with strokes and borders, and may cause performance issues.
- Avoid setting `Class.UIGradient.Color|Color` and
`Class.UIGradient.Transparency|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
`Class.UIGradient.Offset|Offset` or `Class.UIGradient.Rotation|Rotation`
properties to achieve a similar effect. Alternatively, you can change the
color of the parent `Class.GuiObject` using such properties as
`Class.GuiObject.BackgroundColor3|BackgroundColor3`,
`Class.ImageLabel.ImageColor3|ImageColor3`, or
`Class.TextLabel.TextColor3|TextColor3`.
- When applying an unchanging gradient on a UI element whose state changes a
lot, there is a tradeoff between using a `Class.UIGradient` (processing
time) and a static gradient image (memory).
code_samples: []
inherits:
- UIComponent
descendants: []
tags: []
deprecation_message: ''
properties:
- name: UIGradient.Color
summary: |
Determines the color blended with the parent GuiObject along the length of
the gradient.
description: |
This property describes the color to blend with the parent UI element
along the provided `Datatype.ColorSequence`. This property works in a
similar manner to `Class.Beam.Color` or `Class.Trail.Color`, except that
it applies over an on-screen distance determined by the
`Class.UIGradient.Offset|Offset` and `Class.UIGradient.Rotation|Rotation`.
code_samples: []
type: ColorSequence
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Appearance
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: UIGradient.Enabled
summary: |
Whether the gradient is enabled or not.
description: |
Whether the gradient is enabled or not.
code_samples: []
type: boolean
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Appearance
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: UIGradient.Offset
summary: |
Determines the scalar translation of the gradient from the center of the
parent GuiObject.
description: |
This property determines the scalar translation of the gradient from the
center of the parent `Class.GuiObject`. It is a scalar translation,
meaning that the actual pixel offset is determined by the
`Class.GuiBase2d.AbsoluteSize|AbsoluteSize` of the parent
`Class.GuiObject`. So, a value of `(1, 0)` would shift the gradient
horizontally to the right by a distance equal to the parent object's
on‑screen size. Depending on the `Class.UIGradient.Rotation|Rotation`,
this may cause the gradient to be partially visible or not visible at all.
Also see `Class.UIGradient.Rotation|Rotation` which also affects the
geometry of the applied gradient.
code_samples: []
type: Vector2
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Appearance
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: UIGradient.Rotation
summary: |
Determines the clockwise rotation in degrees of the gradient starting from
left to right.
description: |
This property determines the **clockwise** rotation in degrees of the
`Class.UIGradient` starting from left to right. The beginning and end
control points snap to the edges of the parent `Class.GuiObject`, but
maintain the provided rotation.
Also see `Class.UIGradient.Offset|Offset` which also affects the geometry
of the applied gradient.
code_samples: []
type: float
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Appearance
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: UIGradient.Transparency
summary: |
Determines how much the parent GuiObject can be seen through along the
length of the gradient.
description: |
This property describes how opaque the parent UI element will be along the
provided `Datatype.NumberSequence`. This property works in a similar
manner to `Class.Beam.Transparency` or `Class.Trail.Transparency`, except
that it applies over an on‑screen distance determined by the
`Class.UIGradient.Offset|Offset` and `Class.UIGradient.Rotation|Rotation`.
Note that the envelope values of the
`Datatype.NumberSequenceKeypoint|NumberSequenceKeypoints` are ignored.
code_samples: []
type: NumberSequence
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Appearance
serialization:
can_load: true
can_save: true
capabilities:
- UI
methods: []
events: []
callbacks: []