i dont know if i did anything wrong but it seems like roblox doesnt support it yet. is there a other way that i can actually lerp a colorsequence?
any help is appreciated
i trying to change it to make a stamina bar that if you sprint it gets oranger and more bluer if you release the sprint button but this seems impossible with sequences so i might switch to using single color3
note: i get error if i add sequences to tweens too
Well if you have 2 colour sequences with colours at the same time, you can just interpolate each of the colours individually, then reconstruct the colour sequence at the end. Something like this should work:
local function lerpColourSequence(a: ColorSequence, b: ColorSequence, t: number)
local keypoints = {}
for index, keypoint in a.Keypoints do
local matchingKeypoint = b.Keypoints[index]
if not matchingKeypoint then
warn('ColourSequence can\'t be interpolated as there is no corresponding keypoint in `b`')
return a
end
-- interpolate the colour
table.insert(keypoints, ColorSequenceKeypoint.new(keypoint.Time, keypoint.Value:Lerp(matchingKeypoint.Value, t)))
end
return ColorSequence.new(keypoints)
end