Nodes/ComfyUI-Keyframed/Curve From YAML
ComfyUI Node

Curve From YAML

The keyframed library's own notation, minus the Python

By dmarx·Created 3 years ago·Updated 2 years ago· 92
Curve From YAML
    • KEYFRAMED_CURVE
    yamlcurve: - - 0 - 0 - linear - - 1 - 1 loop: false bounce: false duration: 1 label: foo

    Every curve-building tool has its native serialization format, and for the keyframed library - the Python package this whole pack wraps - that format is YAML. Curve From YAML is the node that speaks it, so you can build or edit a curve in structured text and get a first-class KEYFRAMED_CURVE out the other side.

    If you've only ever used the visual nodes, this one feels like a step backwards - more text, more ceremony, why not just draw the curve? Fair. Where it earns its keep is round-tripping: the keyframed library can serialize curves to exactly this YAML, so anything you wrote in Python, saved, or generated from another tool can be dropped into ComfyUI verbatim. It's also the most precise way to describe a curve when you need per-keyframe interpolation methods and exact values, and the format supports options the string notation can't express.

    How it works

    The node parses your YAML with kf.serialization.from_yaml and returns the curve. The default text in the field is the format cheat-sheet, and it's worth reading twice because it's compact:

    curve:
    - - 0
      - 0
      - linear
    - - 1
      - 1
    loop: false
    bounce: false
    duration: 1
    label: foo
    

    Each entry under curve is a three-element list: [time, value, interpolation_method]. So - - 0 / - 0 / - linear is a keyframe at time 0, value 0, linear easing, and the second entry is time 1, value 1. The top-level fields set loop behavior, bounce behavior, an explicit duration, and a label - which matters more than you'd think, because when you collect curves into a Parameter Group, the labels are what show up in legends and what you use to pull a curve back out.

    The input

    • yaml (required, multiline) - the curve description above. Editing a value and re-running gives you a new curve instantly; this is very much a "tweak the text, look at the plot" workflow.

    The output

    KEYFRAMED_CURVE, ready for arithmetic, plotting, or grouping. Note there's no loop/bounce equivalent on the visual curve constructors, so if those matter to you, this is the only door into them.

    How to install it

    Part of ComfyUI-Keyframed, so one install serves the whole pack. ComfyUI Manager → search ComfyUI-Keyframed, or:

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

    then restart ComfyUI. No models to download; the only real dependency is the keyframed library (plus toolz), auto-installed by the pack on first import.

    Troubleshooting

    YAML is whitespace-sensitive and unforgiving, and the one thing that bites people is indentation - each - - entry must line up under curve:, and the sub-values must be indented under their dash. If the node throws a parse error, it's almost always that. Second: the interpolation method string is passed straight through to the library, so stick to the names it knows (linear, previous, next, sin, sin^2 and friends); a typo like Lineear fails at evaluation time, not parse time, which is harder to chase. When in doubt, reset the field to the default and edit it incrementally - it doubles as a living example.

    Categorykeyframed

    Inputs (1)

    NameTypeDefaultDescription
    yamlSTRINGcurve: - - 0 - 0 - linear - - 1 - 1 loop: false bounce: false duration: 1 label: foo

    Outputs (1)

    NameTypeDescription
    KEYFRAMED_CURVEKEYFRAMED_CURVE