Function cgl_rs::utils::lerp

source ·
pub fn lerp<T: Copy + Add<Output = T> + Sub<Output = T> + Mul<Output = T>>(
    a: T,
    b: T,
    t: T
) -> T
Expand description

Linearly interpolates between two values.

Arguments

  • a - A value of type T representing the start value.
  • b - A value of type T representing the end value.
  • t - A value of type T representing the interpolation factor.

Returns

A value of type T representing the interpolated value.

Example

let a = 0f32;
let b = 10f32;
let t = 0.5f32;
let result = cgl_rs::utils::lerp(a, b, t);