--- id: math-lerp name: Math.lerp category: math kind: namespace-method tokens: Math.lerp sig: Math.lerp(a, b, t) -> fixed tip: Blend between two values by a 0..1 amount. order: 8 ns: Math member: lerp --- Linear interpolation: returns a when t is 0.0, b when t is 1.0, and a proportional blend in between — the exact value a + (b - a) * t. All three arguments are fixed and the result is fixed. It is the workhorse behind smooth motion: ease a camera toward a target, fade a value over time, or sample a gradient. Values of t outside 0..1 extrapolate past the endpoints. Parameters: - `a` — the value returned at `t = 0.0` - `b` — the value returned at `t = 1.0` - `t` — the blend amount, normally `0.0`..`1.0` ```ludic program EaseCamera { state EaseCameraState { camera_x: fixed = 0.0 } let target_x: fixed = 100.0 handler Follow(ease_camera_st: mut EaseCameraState) phase Update { ease_camera_st.camera_x = Math.lerp(ease_camera_st.camera_x, target_x, 0.1) # glides a tenth of the way each frame } } ```