Number Lerp | Basic
The smoothness node hiding in a math pack
- a
- b
- t
- NUMBER
NumberLerp ("Number Lerp | Basic") computes linear interpolation: a + t * (b - a). It's the math behind every fade, blend, and ease in animation, and once you have it as a node you'll start seeing places to use it everywhere. Give it a start (a), an end (b), and a blend factor (t), and it returns the number t fraction of the way between them.
All three inputs - a, b, t - take the pack's NUMBER union type, so ints and floats mix freely. The default t of 0.5 gives you the midpoint. The output is NUMBER: it comes back as an INT only when all three inputs are integers and the result lands on a whole number; otherwise it's a FLOAT.
The inputs that matter
- a - the value at
t = 0(default0). - b - the value at
t = 1(default1). - t - where you are between them (default
0.5).
Why you'd reach for it
Three genuinely useful patterns:
- Smooth transitions. Animate a parameter - denoise, CFG, a strength value - by driving
tfrom a schedule or counter. Att = 0you geta, att = 1you getb, and in between it glides. - Easing without the math. If the linear result feels mechanical, don't replace the node - feed
tthrough a curve first (square it for ease-in, etc.) andNumberLerpdoes the rest. - Blending constants. Two presets, one knob: set
aandbto two configs and exposetas your single control.
A detail that makes this node friendlier than hand-rolled math: t isn't clamped. Values below 0 or above 1 extrapolate - t = 2 gives you 2b - a, which is sometimes exactly what you want for overshoot effects, and a NumberClamp in front of t restores the plain fade when it isn't.
Installing it
Standard pack install - pure Python, no dependencies:
cd ComfyUI/custom_nodes
git clone https://github.com/akatz-ai/ComfyUI-Basic-Math
Restart ComfyUI, find it under Basic Math ➕ → Utility as "Number Lerp | Basic". Or use ComfyUI Manager → Install Custom Nodes → search "ComfyUI-Basic-Math".
The gotchas
The output type follows the inputs: feed it three ints and an exact whole-number result, you get an INT; any float input or fractional result and it's a FLOAT. If you're building a timeline and need the result to stay a consistent type, that's worth knowing before the wire reaches a strictly-typed socket. And yes - "Number Lerp | Basic" is the menu name, same | Basic suffix as the rest of this pack.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| a | INT,FLOAT | 0 | — |
| b | INT,FLOAT | 1 | — |
| t | INT,FLOAT | 0.5 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| NUMBER | INT,FLOAT | — |