ComfyUI Node

Curve Formula Builder

Can't write math? Pick a shape, get a formula

By diffussy69·Created 11 months ago·Updated 9 months ago· 2
Curve Formula Builder
    • formula
    • preview_graph
    • description
    patternS-Curve (Smooth)
    strength50
    speed50
    num_points100
    flip_verticalfalse
    flip_horizontalfalse
    repeat_times1
    show_formulafalse

    The Advanced Curved ControlNet Scheduler has a custom_formula field that accepts raw math - sin(t*3.14), 1-exp(-5*t), that sort of thing. Powerful, sure, and a total wall for anyone who hasn't touched a function since school. This node is the ramp over that wall: pick a shape from a dropdown, tweak two sliders, and it hands you a ready-to-paste formula string plus a preview graph so you can see what you're getting before it ever touches a keyframe.

    How it works

    You choose a pattern - Straight Line, Ease In, Ease Out, S-Curve, Wave, Peak, Valley, Exponential Growth, or Exponential Decay - and the node generates the matching mathematical expression using t from 0 to 1. strength (0–100) controls how dramatic the effect is, speed (10–100) how fast the change happens, and num_points sets the resolution of the preview. Optional flip_vertical / flip_horizontal mirror the shape, and repeat_times stacks the pattern 1–10 times for multi-segment curves.

    The output formula is the STRING you drop into the Advanced scheduler's custom_formula input. preview_graph is the IMAGE you preview to check the shape, and description is a plain-text summary. show_formula toggles whether the generated math is displayed alongside the graph - turn it on if you want to learn what these formulas actually look like, since it'll happily teach you t**2 while you're at it.

    Why you'd bother

    Two reasons. First, the hand-written formula route punishes typos - one unbalanced paren and the scheduler's safe evaluator refuses to run, and debugging a blank keyframe group is miserable. This node generates syntactically valid output, which removes an entire class of failure. Second, repeat_times and the flip toggles let you build the kind of repeating pulse patterns that are genuinely fiddly to hand-write, with visual feedback the whole way.

    Installing it

    Part of the same pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/diffussy69/comfyui-curved_weight_schedule
    pip install matplotlib pillow numpy torch scipy
    

    No models, no special dependencies beyond matplotlib for the graph. Restart and hard-refresh.

    Where people get burned

    The formula this node outputs is only useful if you actually connect it to something that consumes formulas - the Advanced Curved ControlNet Scheduler's custom_formula field is the target. Newcomers sometimes wire the formula string into random text slots and wonder why nothing changes. And remember the receiving field expects t as the variable; the node uses t internally, so pasted output is compatible by construction - one of the nice things about it. Also worth knowing: num_points is purely preview resolution, it doesn't change the shape.

    Categoryconditioning/controlnet

    Inputs (8)

    NameTypeDefaultDescription
    patternCOMBOS-Curve (Smooth)Choose the basic shape of your curve
    strengthFLOAT500–100How dramatic the effect (0=gentle, 100=extreme)
    speedFLOAT5010–100How fast the change happens
    num_pointsINT10010–500Resolution of the curve preview
    flip_verticaloptBOOLEANfalseFlip the curve upside down
    flip_horizontaloptBOOLEANfalseReverse the curve direction
    repeat_timesoptINT11–10Repeat the pattern multiple times
    show_formulaoptBOOLEANfalseShow the generated math formula

    Outputs (3)

    NameTypeDescription
    formulaSTRING
    preview_graphIMAGE
    descriptionSTRING