ComfyUI Node

Number Lerp

Smooth transitions, one slider at a time

By DebugPadawan·Created about a year ago·Updated 5 months ago· 2
Number Lerp
    • lerped
    a0.00
    b1.00
    t0.50

    Lerp - short for linear interpolation - is the answer to "give me a value partway between A and B." Number Lerp does exactly that: you give it a start, an end, and a t factor, and it slides the result smoothly between them. At t=0 you get A, at t=1 you get B, and at 0.5 you get the midpoint. It's the node you reach for when you want a strength, CFG, or denoise value to transition instead of jump.

    It comes from DebugPadawan's ComfyUI Essentials, a pure-Python utility pack. This node is literally the formula a + t * (b - a).

    How it works

    Three required inputs, all FLOATs:

    • a - the start value (default 0)
    • b - the end value (default 1)
    • t - the interpolation factor (default 0.5, widget-bounded 0–1)

    One output: lerped (FLOAT). The UI clamps t to 0–1 on the widget, which is the sensible reading of "interpolation." Note that the code itself won't stop an out-of-range t if it's wired in from another node - feed it 1.5 and you'll get a value past B. Sometimes that's what you want (extrapolation); just know it happens.

    The math is the standard lerp: a + t * (b - a). Worth knowing because it means the result is linear - evenly spaced t values give evenly spaced results, which is exactly what you want for animation and tweening.

    Where lerp earns its keep

    • Animating parameters. If you're building an animation workflow and want the strength to ramp up across frames, feed t a value that increases per frame (from a counter or loop) and lerp between your starting and ending strength. Same for CFG, denoise, or any KSampler parameter you want to sweep.
    • Blending two settings. Two presets you want to crossfade between - lerp is the mathematical version of pulling a slider between them.
    • Driving a Number Remap. Feed the lerped result into a remap to translate a 0–1 sweep onto any scale you need.

    It pairs naturally with the pack's Number Range (to generate the stepped t values) and Random Generator (for random-but-smooth variation).

    Installing it

    One install for the whole pack - ComfyUI Manager, searching for "DebugPadawans-ComfyUI-Essentials," or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/DebugPadawan/DebugPadawans-ComfyUI-Essentials
    

    Then restart ComfyUI. Requirements (numpy, torch, opencv-python) are already present in a stock ComfyUI; no models to download. And don't confuse this pack with cubiq's "ComfyUI Essentials," which is a different, larger pack now in maintenance mode - the search results can look similar.

    Gotchas

    • The t widget is capped at 0–1, but a wired-in t isn't clamped. If you're animating and things overshoot, that's why.
    • Output is a FLOAT. Feed it into Number Round if you need a clean integer, or Number to String if you're building labels or filenames.
    • It's a tiny, low-profile pack with little community chatter around it, so you won't find a mountain of forum threads about this node - the formula is the documentation.
    CategoryDebugPadawan/Number

    Inputs (3)

    NameTypeDefaultDescription
    aFLOAT0.00
    bFLOAT1.00
    tFLOAT0.500–1

    Outputs (1)

    NameTypeDescription
    lerpedFLOAT