Linear interpolation between two scalar values.
t = 0 returns a, t = 1 returns b. Values of t outside
[0, 1] extrapolate — the result is NOT clamped.
Don't use this for smooth follow at a fixed alpha per frame.x = lerp(x, target, 0.1) per frame converges 2× faster at 60 fps
than at 30 fps — the visual feel changes with the frame rate. Use
damp instead for frame-rate-independent smoothing.
Parameters
a: number
the value at t = 0
b: number
the value at t = 1
t: number
the interpolation parameter (typically 0..1, but not clamped)
Linear interpolation between two scalar values.
t = 0returnsa,t = 1returnsb. Values oftoutside[0, 1]extrapolate — the result is NOT clamped.Don't use this for smooth follow at a fixed alpha per frame.
x = lerp(x, target, 0.1)per frame converges 2× faster at 60 fps than at 30 fps — the visual feel changes with the frame rate. Use damp instead for frame-rate-independent smoothing.