Lerp (linear interpolation) finds a value part of the way between two others: lerp(a, b, t) = a + (b − a) × t. In animation it smooths motion by moving a fraction closer to a target every frame.
Lerp is short for linear interpolation. Given a start a, an end b and an amount t between 0 and 1, lerp returns the value that far along the way: t = 0 gives a, t = 1 gives b, and t = 0.5 gives the halfway point. It works for positions, colours, sizes and anything else made of numbers.
In interactive animation, lerp is often used as smoothing. Every frame, move the current value a fraction of the remaining distance toward the target, for example 10%. The result is a soft follow that eases out on its own, used for cursor followers, smooth scrolling and camera movement.
That simple version depends on the frame rate: at 120 frames per second it moves twice as often as at 60 and feels faster. Make it frame-rate independent by scaling the fraction with the time since the last frame, as in the code below.
const lerp = (a, b, t) => a + (b - a) * t;
// smoothing that feels the same at any frame rate (dt in seconds)
function follow(current, target, dt, speed = 10) {
return lerp(current, target, 1 - Math.exp(-speed * dt));
}