Fit Number (mtb)
Remap a value between two ranges, with an easing curve if you want one
- FLOAT
If you've used Blender's Map Range node, or After Effects' linear()/ease() expressions, you already know what Fit Number does: it takes a value living in one range and rescales it into a different range, optionally with a curve instead of a straight line. It's one of those small nodes that quietly does a lot of work in animation graphs - anything that drives a parameter off a frame counter or a batch index usually runs through something like this first.
Why you'd reach for it
Say you've got a frame index counting 0 to 120 (from mtb's own Animation Builder, or any counter node), and you want it to drive your CFG from 4 up to 9 over that span, easing in rather than moving linearly. That's exactly this node's job: source_min/source_max describe the range your incoming number actually lives in, target_min/target_max describe the range you want it mapped to, and easing decides the shape of that mapping instead of a straight line.
Inputs that matter
value- the number you're remapping.source_min/source_max- the rangevalueis coming from (defaults 0–1).target_min/target_max- the range you want it mapped into (defaults 0–1).easing- one of 22 curve options:Linear, and then the standard Sine/Quart/Cubic/Circ families each in In/Out/In-Out flavors, plus more beyond that. If you've done any UI or motion-graphics work, these names will be familiar; if not, the short version is: "In" starts slow and accelerates, "Out" starts fast and decelerates, "In/Out" does both.clamp(defaultfalse) - whether the output gets clamped to the target range ifvaluefalls outside the source range. Leave this off and an out-of-range input extrapolates past your target bounds; turn it on if you specifically don't want that.
Output is a single FLOAT - feed it straight into whatever widget or node accepts one.
Installing it
- ComfyUI Manager - search "MTB Nodes", install, restart.
- Manual -
cd ComfyUI/custom_nodes && git clone https://github.com/melMass/comfy_mtb, restart. A manual clone needspip install -r requirements.txtrun inside thecomfy_mtbfolder first.
Fit Number is pure math - no models, no extra dependencies beyond what the rest of the pack needs.
Common issues & troubleshooting
Output looks flipped or way off. Double-check source_min/source_max actually match the real range of whatever's feeding value. This node has no idea what your upstream data actually looks like - if your frame counter runs 0–119 instead of 0–120, or your batch index is 1-based instead of 0-based, the remap will be subtly wrong in a way that's easy to miss until you scrub through frames and notice the curve doesn't land where it should.
Values shoot way outside your target range. That's expected behavior when value falls outside source_min/source_max and clamp is off - the remap keeps extrapolating past your target bounds instead of stopping at them. Flip clamp on if that's not what you want.
The easing looks identical to Linear. Easing only changes anything between the endpoints - at value == source_min or value == source_max every curve gives you the same result as Linear by definition. If you're not seeing a difference, make sure you're actually scrubbing through the middle of the range and not just checking the extremes.
A handful of mtb's nodes fail to load on startup. That's normal for this pack - check the console for [comfy_mtb] STATUS and http://127.0.0.1:8188/mtb for what didn't load. Fit Number is plain math with no optional dependencies, so it's essentially never the one on that list.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| value | FLOAT | 0.00 | — |
| clamp | BOOLEAN | false | — |
| source_min | FLOAT | 0.00 | — |
| source_max | FLOAT | 1.00 | — |
| target_min | FLOAT | 0.00 | — |
| target_max | FLOAT | 1.00 | — |
| easing | COMBO | Linear | 22 options: Linear, Sine In, Sine Out, Sine In/Out, Quart In, Quart Out, +16 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| FLOAT | FLOAT | — |