Question about "Lerp"

How can I lerp a value to another point/number in a given time?

Thanks in advance!

The proper equation is also listed on that page.

The problem is that I don’t really understand what I should do if I want a value to get lerped to another number in a specific time. (for example in 2 seconds)

local lerpTime = 2
local lerpStart = CurTime()

local lerpStartVal = 0
local lerpEndVal = 100

local lerpVal = lerpStartVal

hook.Add(“Think”, “lerp”, function()

local curTime = CurTime()
local elapsed = curTime - lerpStart
local percentage = elapsed / lerpTime

lerpVal = Lerp(percentage, lerpStartVal, lerpEndVal)


Try this out

Thank you very much Zeh Matt, it worked! :slight_smile: