Nodes/ComfyUI-Apt_Preset/basicIn_Remap_slide
ComfyUI Node

basicIn_Remap_slide

A 0-1 knob you can bend to any range you actually need

By cardenluo·Created 2 years ago·Updated 18 days ago· 309
basicIn_Remap_slide
    • source_value
    • slide_value
    source_min0.000
    source_max1.000
    slide0.000
    precision0.001

    A lot of the values you actually want to animate or dial in don't live comfortably on a 0-1 scale - a CFG value wants to sit somewhere around 1-10, a resolution dimension wants hundreds or thousands, a custom weight might want to run negative. But a single, consistent 0-1 slider is a much nicer thing to build a UI or an animation curve around than a dozen differently-scaled widgets. basicIn_Remap_slide is the bridge: you drag one 0-1 slider, and it maps that onto whatever real-world range you tell it to.

    How it works

    You set source_min and source_max to the actual range you want (defaults 0 and 1, but either can go from -9999 to 9999) - say, source_min = 1 and source_max = 10 for a CFG-shaped range. Then you drag slide, which always stays 0-1 no matter what range you've configured. The node linearly maps your 0-1 position onto the source_minsource_max range and outputs the result. precision (default 0.001) controls how finely the underlying calculation rounds, which matters if you're chaining this into something sensitive to tiny float differences.

    The inputs and outputs that matter

    source_min/source_max define the target range once, up front - you'll usually set these and forget them. slide is the thing you actually touch, animate, or drive from another node, day to day. Two outputs come back: source_value (the remapped result, in your real-world range - this is almost always the one you want) and slide_value (the raw 0-1 position passed straight through, handy if something downstream also needs the unscaled slider position rather than the mapped value).

    Why bother with the indirection

    You could just type the value you want directly into whatever's downstream and skip this node entirely - for a one-off, that's genuinely fine. Where this node earns its keep is anywhere you want to animate or automate that value later: once your real range is expressed as a clean 0-1 slide, it becomes trivial to drive it from this pack's Amp_drive_value or any other 0-1-shaped signal, without redoing the math for your target range every time. Set the range up front, then treat slide as the one dial you actually touch or automate going forward.

    Installing it

    Search "ComfyUI-Apt_Preset" in ComfyUI Manager, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git
    

    Run install.bat on Windows (pip install -r requirements.txt on Linux/Mac), restart. Pure arithmetic - no models involved.

    Where people get it backwards

    The most common mix-up is wiring slide_value into something that expected the actual remapped number - since both outputs are floats and sit right next to each other, it's an easy slot to grab by accident. If a downstream value looks stuck between 0 and 1 when you were expecting it to range up into the hundreds, that's almost always this mistake: you grabbed slide_value instead of source_value. The other thing worth knowing: if you set source_min higher than source_max, the node doesn't error, it just inverts the mapping - dragging the slider up moves your output down. That's sometimes exactly what you want (inverse relationships are a real use case) but it's worth doing on purpose, not by accident.

    CategoryApt_Preset/IO_Port

    Inputs (4)

    NameTypeDefaultDescription
    source_minFLOAT0.000-9999–9999
    source_maxFLOAT1.000-9999–9999
    slideFLOAT0.0000–1
    precisionFLOAT0.0010.001–1000

    Outputs (2)

    NameTypeDescription
    source_valueFLOAT
    slide_valueFLOAT