Examples Linear Interpolation

Linear Interpolation

Interpolation calculates a value between two other values. For example, the number 5 is halfway between 0 and 10. Different types of interpolation use different rates of change between values. Linear interpolation, abbreviated as lerp, uses a constant rate of change. The lerp() function linearly interpolates between two numbers.

Move the mouse across the screen and the symbol will follow. Between drawing each frame of the animation, the ellipse moves part of the distance from its current position toward the cursor.