PROWAREtech
C/C++: LERP - Linear Interpolation Function
A useful function for easing the transition between two values over time.
Two versions for reference:
double lerp(double a, double b, double t)
{
return a + (b - a) * t;
}
double lerp(double a, double b, double t)
{
return a * (1 - t) + b * t;
}
See the JavaScript LERP article for examples of using LERP and vector LERP (VLERP).
Comment