Skip to main content

lerpf

Function lerpf 

pub fn lerpf(from: f64, to: f64, weight: f64) -> f64
Expand description

Linearly interpolates between two values by the factor defined in weight. To perform interpolation, weight should be between 0.0 and 1.0 (inclusive). However, values outside this range are allowed and can be used to perform extrapolation. If this is not desired, use [method clampf] on the result of this function.

lerpf(0, 4, 0.75) # Returns 3.0

See also [method inverse_lerp] which performs the reverse of this operation. To perform eased interpolation with [method lerp], combine it with [method ease] or [method smoothstep].