====== lerp ====== {{tag>math needs_examples}} ''fixed lerp(fixed a, fixed b, fixed alpha)'' ===== Description ===== Performs [[wp>Linear interpolation|linear interpolation]] (or extrapolation) between two numbers and returns the result. ===== Examples ===== lerp(A, B, 0.0) -> A lerp(A, B, 1.0) -> B lerp(A, B, 0.5) -> (A + B) / 2 // Average of a and b. Simple animation of movement between two points: for (int time = 0; time < 1.0; time += 0.05) { int x = lerp(x1, x2, time); int y = lerp(y1, y2, time); DrawSomething(x, y); Delay(1); }