Linearly interpolates between x and y. The third parameter t (usually a value between 0 and 1) is the amount by which to interpolate — a value of 0 returns the x value and 1 returns the y value.
x
y
t
0
1
lerp(5, 10, 0.5); // returns 7.5lerp(0, 100, 0.1); // returns 10lerp(22, 79, 1); // returns 79 Copy
lerp(5, 10, 0.5); // returns 7.5lerp(0, 100, 0.1); // returns 10lerp(22, 79, 1); // returns 79
The first value.
The second value.
The amount by which to interpolate (0 returns x, 1 returns y).
0.2.4
Linearly interpolates between
xandy. The third parametert(usually a value between0and1) is the amount by which to interpolate — a value of0returns thexvalue and1returns theyvalue.