t2:lerp

lerp


lerp — Performs a linear interpolation

Description


fix32 lerp(fix32 p0, fix32 p1, fix32 fract);

Returns the linear interpolation of p0 and p1 based on fract.
(p0 * (1 - fract)) + (p1 * fract)

Parameters


  • p0: The first fix32 point value.
  • p1: The second fix32 point value.
  • fract: A value between 0.0 and 1.0 that linearly interpolates between p0 and p1.

Return Value


The result of the linear interpolation.

Examples


Example #1 lerp() example

init {
    printf("%.2f", lerp(1.0, 10.0, 0.5)); // 5.5
}
t2/lerp.txt · Last modified: 2016/11/13 03:16 by J2Kbr