#floats #lerp #float #function #inverse-lerp

float-lerp

Lerp and InverseLerp functions for floats

3 unstable releases

0.2.0 Jul 6, 2022
0.1.1 Jul 6, 2022
0.1.0 Jul 6, 2022

#2784 in Rust patterns

Download history 7/week @ 2024-07-29 13/week @ 2024-09-09 21/week @ 2024-09-23 8/week @ 2024-09-30 2/week @ 2024-10-07 9/week @ 2024-10-14 44/week @ 2024-10-21 54/week @ 2024-10-28

110 downloads per month

MIT/Apache

3KB

Lerp and InverseLerp for float values

lerp

Find the value between two floats using a 0-1 fraction:

// Returns 1.5 because 1.5 is 0.5 distance between 1.0 and 2.0
lerp(1.0, 2.0, 0.5) 

inverse_lerp

Find the fraction a given value lies at between two floats

// Returns 0.5 because 1.5 is 0.5 of the distance between 1.0 and 2.0
inverse_lerp(1.0, 2.0, 1.5)

Dependencies

~150KB