Linear Interpolation (lerp)

The value part of the way from a to b, where t runs from 0 to 1.

lerp(a, b, t) = a + (b − a) t

t = 0 gives a, t = 1 gives b and t = 0.5 the midpoint.

To approach a target by a fraction each frame independently of frame length, use the fraction 1 − e^(−k·dt).

Calculator

Change a value and the result and picture update instantly.

Result

Interpolated value30

Animated picture

The picture follows your values. Some points and shapes can be dragged.

Use in game development

Smooth camera follow, colour and volume changes and in-between animation poses.

Code example (JavaScript)

camera.x += (player.x - camera.x) * (1 - Math.exp(-5 * dt)); // smooth follow

What the symbols mean

SymbolMeaning
aStart a
bEnd b
tFraction t (0–1)
vInterpolated value

More formulas in this category

Frequently asked questions

What is the formula for Linear Interpolation (lerp)?
The formula for Linear Interpolation (lerp) is lerp(a, b, t) = a + (b − a) t. The value part of the way from a to b, where t runs from 0 to 1.

Math Formula Quiz Math for Game Development

Sources

Checked: 2026-11-29