Game dev
Saved & recent

Lerp

Also called: linear interpolation

Blends between two values. A parameter t from 0 to 1 picks how far along you are. At 0 you get A, at 1 you get B, at 0.5 the midpoint.

Works on numbers, vectors and colors. It is behind fades, camera smoothing and most easing.

lerp(a, b, t) = a + (b - a) * t

Further reading
Catlike Coding: Curves and splines: linear interpolation
0 0.25 0.5 0.75 1 0 2 6 10 weight t value 2 4 6 8 10 B = 10 A = 2
The same weight drives the plot and the scale below it. With endpoints 2 and 10, the halfway value is 6.

View in the full Game dev collection