Mathf.InverseLerp(number a, number b, number value)
Calculates the linear parameter t that produces the interpolant value within the range [a, b].
Parameters:
Name | Type | Description |
---|---|---|
a | number | Start value. |
b | number | End value. |
value | number | Value between start and end. |
Returns:
type | Description |
---|---|
number | Percentage of value between start and end. |
Usage
---@type number
local a;
---@type number
local b;
---@type number
local value;
local val0 = Mathf:InverseLerp(a, b, value)
Extra Detail
The a and b values define the start and end of the line. Value is a location between a and b. Subtract a from both a and b and value to make a', b' and value'. This makes a' to be zero and b' and value' to be reduced. Finally divide value' by b'. This gives the InverseLerp amount.