LERP / INTERPOLATE
Calculates the linearly interpolated value between two numbers, with a specified proportion.
Syntax
=LERP(value, a, b)
=INTERPOLATE(value, a, b)
The linear interpolation result is calculated as:
(b - a) \* value + a
Arguments
Argument | Type | Description |
---|---|---|
value | Number | The interpolation value. Value must be between 0 and 1 (values outside of the range will be constrained to that range). |
a | Number | The first value to interpolate between. |
b | Number | The second value to interpolate between. |
Examples
=LERP(0.5, 0, 10)
→5
Interpolates between 0 and 10 at a proportion of 0.5
=LERP(0, 0, 10)
→0
Interpolates between 0 and 10 at a proportion of 0
=INTERPOLATE(1, 0, 10)
→10
Interpolates between 0 and 10 at a proportion of 1
=LERP(0.5, -2, 6)
→2
Interpolates between -2 and 6 at a proportion of 0.5
Updated 3 months ago