CoderHusk
(CoderHusk)
1
I’ve heard that you can use bilinear interpolation for this but like oddly this will work if its just 1 component, like 1,0,0 and 0,0,1
and of course it will work if its the same color gradient 0,0.5,0 and 0,1,0
However attempting to do a mix of color variants like 1,1,0 and 0,1,1 creates this pseudo random mess…
In other words, how can I interpolate a matrix?
2 Likes
CoderHusk
(CoderHusk)
2
EDIT: was just a code error, my method was working. You basically just interpolate each component individually.
local function lerpColor(y)
local rgbComp = {}
rgbComp[1] = maxColor.R+(minColor.R - maxColor.R)*y
rgbComp[2] = maxColor.G+(minColor.G - maxColor.G)*y
rgbComp[3] = maxColor.B+(minColor.B - maxColor.B)*y
return Color3.new(rgbComp[1], rgbComp[2], rgbComp[3])
end
3 Likes
Doesn’t roblox already have Color3:Lerp()
?
1 Like
CoderHusk
(CoderHusk)
4
Can’t find anything about it, no