Need Help Making an Infinite Scrolling Gradient (Like Anime Vanguards Header)
1. What do you want to achieve?
I’m trying to make a UIGradient move infinitely across an image (horizontally), similar to the animated header gradient in Anime Vanguards. I want it to loop smoothly so it looks endless.
2. What is the issue?
When I tween the gradient’s X offset infinitely using:
local info = TweenInfo.new(3.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, -1, false)
it works, but the problem is the first or last color of the gradient stays visible across the whole image when it loops, making it look static or not seamless.
I tried cloning my keypoints to have matching colors at negative and positive times (so it would wrap around seamlessly from -1 to 1 offset), but ColorSequenceKeypoint.new() doesn’t allow negative time values.
3. What solutions have you tried so far?
- Tweening
Offset.Xfrom-1to1with infinite repeat. - Duplicating keypoints at
-timeandtime(not possible because negative times error). - Making sure the first and last colors match. still not seamless horizontally.
- Looked through Creator Hub and DevForum posts but didn’t find a fix for this specific issue.
Extra details:
I’m trying to keep this simple and performance friendly. I don’t want to use any RenderStepped math or custom loops, just TweenService and UIGradient if possible. If anyone knows a simple method to make the horizontal gradient loop seamlessly, please let me know!
Gradient I’m using:
ColorSequence.new({
ColorSequenceKeypoint.new(0, Color3.new(0.980392, 0.839216, 0.32549)),
ColorSequenceKeypoint.new(0.104, Color3.new(1, 1, 0)),
ColorSequenceKeypoint.new(0.353, Color3.new(1, 0.333333, 0)),
ColorSequenceKeypoint.new(0.604, Color3.new(1, 1, 0)),
ColorSequenceKeypoint.new(0.854, Color3.new(1, 0.333333, 0)),
ColorSequenceKeypoint.new(1, Color3.new(0.980392, 0.839216, 0.32549)),
})