Color:Lerp() from 0-5?

So i need lerp color based on this two “rules”

  1. If number is < 3 we lerp color to black
  2. If number is > 3 we lerp color to white

i think about just: if number is < 3 then
but how i make it “lerp”? if number is 2 then we instantly go black, so, how?

Use TweenService to smoothly tween the color instead of just setting it.

TweenService:Create(Object, TweenInfo.new(1), {Color = Color3.FromRGB(0, 0, 0)}):Play()
1 Like

Linear interpolation is an instantaneous tranisition, not gradual, it’s just a way of calculating a value that represents the fractional alpha of the difference between the smaller input and the larger input.

Num1 = 1, Num2 = 5, Alpha = 0.5
Result = 3 --(Represents 50% of the distance from the smaller value to the larger value).