Nodes/ComfyUI-Keyframed/Curve_1 - Curve_2
ComfyUI Node

Curve_1 - Curve_2

The inverse you build when the pack won't do division

By dmarx·Created 3 years ago·Updated 2 years ago· 92
Curve_1 - Curve_2
  • curve_1
  • curve_2
  • KEYFRAMED_CURVE

Curve_1 - Curve_2 is subtraction, and in this pack subtraction is quietly one of the most important operations in the toolbox - mostly because division is broken and this is how you get an inverse. Multiply a curve by minus one, add a constant, and subtraction becomes the tool that shapes one curve against another: take a schedule and pull out its baseline, or make a weight curve that's "everything except this influence."

It's also the operation behind the pack's most useful mental model: if you want a curve that's the mirror image of another, 1 - curve is a two-node job (Constant-Valued Curve of 1, then subtract your curve from it). That flipped curve is exactly what you want when two prompts should trade places - one fades in as the other fades out.

How it works

Same mechanics as the other curve operators: both inputs are deep-copied, then curve_1 - curve_2 runs from the keyframed library. Arithmetic happens at the union of the keyframes of both curves - every timestamp present in either parent appears in the result, with the values subtracted there. Because the union is what matters, you can subtract two curves built at entirely different resolutions and the result keeps the detail of both.

One thing worth knowing: subtraction here is element-wise across time, so curve_1 - curve_2 gives you the point-by-point difference, not a "remove curve 2's keyframes" operation. If you want the shape of curve 1 with curve 2's influence simply absent, that's multiplication or a rebuild - subtraction is for when you want the actual delta.

The inputs

  • curve_1, curve_2 (both required, forceInput) - the minuend and subtrahend, in that order. Order matters and it's the direction you'd expect.

The output

KEYFRAMED_CURVE - the difference curve, pluggable into any other curve input.

How to install it

Part of the ComfyUI-Keyframed pack, installed once for everything. ComfyUI Manager → search ComfyUI-Keyframed, or:

cd ComfyUI/custom_nodes
git clone https://github.com/dmarx/ComfyUI-Keyframed

then restart ComfyUI. No models, no heavy deps - just keyframed (and toolz), auto-installed on first import.

Troubleshooting

The subtraction operator itself is dependable - this is not the node that misbehaves. Watch out for the union-of-keyframes surprise: subtract a sparse curve from a dense one and the result inherits all the dense curve's keyframes, so a slightly jittery source becomes a slightly jittery difference. And if you're building a 1 - curve inversion for prompt weights, double-check the Constant-Valued Curve node is set to exactly 1.0; a 1.1 or 0.9 baseline is the kind of off-by-a-little that makes your weights sum to something other than 1 and your prompt superposition noticeably lopsided.

Categorykeyframed

Inputs (2)

NameTypeDefaultDescription
curve_1KEYFRAMED_CURVE
curve_2KEYFRAMED_CURVE

Outputs (1)

NameTypeDescription
KEYFRAMED_CURVEKEYFRAMED_CURVE