lerp - returns linear interpolation of two scalars or vectors based on a weight.
vector1 lerp(vector1 a, vector1 b, vector1 w); vector2 lerp(vector2 a, vector2 b, vector2 w); vector3 lerp(vector3 a, vector3 b, vector3 w); vector4 lerp(vector4 a, vector4 b, vector4 w);
- Vector or scalar to weight; returned when w is zero.
- Vector or scalar to weight; returned when w is one.
- Vector or scalar weight.
Returns the linear interpolation of a and b based on weight w.
a and b are either both scalars or both vectors of the same length. The weight w may be a scalar or a vector of the same length as a and b. w can be any value (so is not restricted to be between zero and one); if w has values outside the [0,1] range, it actually extrapolates.
lerp returns a when w is zero and returns b when w is one.