Inverse Lerp
Tells how far a number is between two others, as a t.
Node id math/inverse-lerp
The Inverse Lerp node does the opposite of Lerp:
it outputs the fraction t of the way from a to b at which value
lies. With a = 10 and b = 20, 10 gives 0, 15 gives 0.5 and 20 gives 1.
Parameters
| Name | Type | Default |
|---|---|---|
| clamp | boolean | false |
Inputs
| Name | Type | Default | Notes |
|---|---|---|---|
| value | number | 0.5 | |
| a | number | 0 | |
| b | number | 1 |
Outputs
| Name | Type | Notes |
|---|---|---|
| t | number |
Behaviour
- Defaults.
valuedefaults to 0.5,ato 0 andbto 1. - Not clamped by default. A
valuebeyond the ends gives atoutside 0 to 1: witha= 10 andb= 20, 30 gives 2 and 0 gives -1. Turn on theclampparameter (on the node or in the property inspector) to keeptfrom 0 to 1. - Reversed ends (
agreater thanb) are not an error:tcounts froma, so witha= 20 andb= 10, 12 gives 0.8. - Equal ends (
a=b) divide by zero, like Divide: the result is Infinity, -Infinity, or NaN whenvalueequals them too (clamped or not). There is no node error.
Related nodes
- Lerp: turns the
tback into a number, between two other ends. - Map Range: Inverse Lerp and Lerp in one node.
- Ease, Ease Bézier
and Ease Steps: shape the
t, which they expect from 0 to 1.