Function: lerp()
ts
function lerp(
from,
to,
ratio
): number;Defined in: math.ts:136
Linear interpolation computation, useful when doing animation
Parameters
| Parameter | Type | Description |
|---|---|---|
from | number | Starting value |
to | number | Ending value |
ratio | number | Interpolation ratio, 0 is the starting value and 1 the ending value |
Returns
number
Example
ts
lerp(10, 20, 0.5); // => 15