pub fn exponential_smooth_factor(
    reach_this_fraction: f32,
    in_this_many_seconds: f32,
    dt: f32
) -> f32
Expand description

Calculate a lerp-factor for exponential smoothing using a time step.

  • exponential_smooth_factor(0.90, 1.0, dt): reach 90% in 1.0 seconds
  • exponential_smooth_factor(0.50, 0.2, dt): reach 50% in 0.2 seconds

Example:

let t = exponential_smooth_factor(0.90, 0.2, dt); // reach 90% in 0.2 seconds
smoothed_value = lerp(smoothed_value..=target_value, t);