Batch Float Math (mtb)
Add, multiply and combine animation curves
- FLOATS
Once you're building animation curves out of MTB's FLOATS - those per-frame lists that drive pan, zoom and rotate - you eventually want to combine two of them. Add a slow drift onto a fast wobble. Multiply a curve by an envelope so it fades in. Subtract one from another. Batch Float Math is the little arithmetic node that does that, operating element-by-element across the float streams you wire in.
It's unglamorous plumbing, but it's the difference between hand-authoring every curve and composing them from simpler pieces. Layered motion - a gentle overall push with a subtle handheld shake on top - is just two curves and an add.
How it works
It runs one arithmetic operation across the float inputs you connect, pairing up values by position: result at frame 0 is a[0] op b[0], frame 1 is a[1] op b[1], and so on. The operation is picked from a dropdown, and there's a reverse switch for the operations where order matters.
The inputs and outputs that matter
operation-add,sub,mul,div,pow, orabs. Add and multiply are the everyday ones (layer curves, apply an envelope);absfolds negatives positive;powshapes a curve's steepness.reverse(default false) - flips the operand order. Irrelevant foraddandmul(they're commutative), but it changes the result forsub,div, andpow- so if your subtraction or division came out backwards, this is the toggle.
The output is a FLOATS curve you feed onward to Batch2d Transform, Auto Pan, or another batch-float node. (You supply the float streams it operates on by wiring them into the node.)
How to install it
Via ComfyUI Manager: search MTB Nodes, install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/melMass/comfy_mtb
then restart. No models - it's arithmetic.
Common issues & troubleshooting
The result looks backwards. For sub, div, and pow, the order of the two curves matters - a - b isn't b - a. Flip reverse instead of re-wiring your inputs.
The two curves are different lengths. Element-wise math wants matching lengths. If one curve is shorter, pad it to length first (Batch Float Fill) so the operation lines up frame-for-frame instead of stopping early or misaligning.
Divide-by-zero weirdness. If a div produces infinities or NaNs, check that the second curve never hits zero at any frame. Add a small constant, or clamp it first with Batch Float Fit.
It's part of a family. On its own this node isn't much. It shines composed with the others: build base curves, remap them with Batch Float Fit, combine them here, then drive Batch2d Transform. That's the MTB animation loop.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| reverse | BOOLEAN | false | — |
| operation | COMBO | add | 6 options: add, sub, mul, div, pow, abs |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| FLOATS | FLOATS | — |