The information on this page may no longer be accurate. To see the latest, go to our new and improved documentation. You can also learn more about the future of documentation.
Collapse Sidebar




The Offset of a UIGradient determines the scalar translation of the gradient from the center of the parent GuiObject. This value is a scalar translation, meaning that the actual pixel offset is determined by the GuiBase2d/AbsoluteSize|AbsoluteSize of the parent GuiObject. So, a value of (1, 0) would shift the gradient horizontally to the right by a distance equal to the parent GuiObject’s on screen-size. Depending on the UIGradient/Rotation|Rotation, this may cause the gradient to be partially visible or not visible at all.

An animation of a UIGradient's Offset being animated on the X axis from -1 to 1.

In the animation above, the offset of a UIGradient is animated back and forth between the values (-1, 0) and (1, 0). The red dot indicates the start of the gradient, and the blue dot indicates the end. Note how the distance animated is twice that of the frame’s width, as the offset is scalar.

See Also

  • articles/Applying UIGradients, for more information on creating UIGradient objects and how they work.

  • UIGradient/Rotation, which also affects the geometry of the applied gradient

Code Samples

UIGradient.Offset Animation

This code sample demonstrates a simple animation of the UIGradient/Offset|Offset property of a UIGradient. It animates the property linearly from (1, 0) to (-1, 0). This causes a sort of sheen effect.