Macaw OS C reference

Function lerp

#include <macaw.h>
double lerp(double a, double b, double t);

Finds the number part of the way from one number to another, for smooth movement and fades.

Parameters

adouble
Where it starts, when t is 0.
bdouble
Where it ends, when t is 1.
tdouble
How far along, from 0 to 1: 0.5 is halfway. Numbers outside that go past a or b.

Returns double

a + (b - a) * t.

In Handy maths for games, with rnd, mid, clamp, sgn, flr.