Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

TweenService not working as expected when tweening the Hue of Color3.fromHSV?

Asked by
C1RAXY 81
2 years ago
Edited 2 years ago

So I'm trying to make a nice stroke for a button in game which I wanted to make a cool RGB transition in loop, I made it no problems with this code:

local main = script.Parent.Main

function Start(speed)
    local Start2 = function(speed)
        print("Empiezo")
        for i = 0, 1, speed%2/100 do
            task.wait(0.01)
            main.UIStroke.Color = Color3.fromHSV(i,1,1)
            print(i)
            if i > 1 then
                i = 0
                print(i)
            end
        end
        Start(speed)
    end
    Start2(speed)
end

local RGB = coroutine.create(function()
    Start(1) -- 1 = fast -> 0.1 = slow
end)
coroutine.resume(RGB)

I know it's not the prettiest way to write it so I tried using TweenService like this:

main.UIStroke.Color = Color3.fromHSV(0.001, 1/1, 1/1)
TS:Create(main.UIStroke, TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, math.huge, true, 1), {Color = Color3.fromHSV(1,1/1,1/1)}):Play()

In my head they should work the same way but they don't. The idea I had is that since I used a porcentage value it should tween into 0.005 --> 0.010 --> ... Is there a way to solve what's happening with that tween? Any clues in how TweeningService interpolates values?

0
I am pretty sure you can tween the rgb and if not you can always make vector3 objects and try to tween those with the x y z being r g b or h s v. greatneil80 2647 — 2y

Answer this question