Nodes/AnimoFlow/Draw Trajectory (AnimoFlow)
ComfyUI Node

Draw Trajectory (AnimoFlow)

Sketching the path your character will walk

By AnimoFlow·Created 2 months ago·Updated about a month ago· 1
Draw Trajectory (AnimoFlow)
    • curve_2d_json
    • root2d_json
    • traj_restore_json
    • duration
    points_json[[0.5, 0.5], [0.5, 1.5], [1.0, 2.2], [1.8, 2.6], [2.6, 2.6]]
    duration4.0

    Most text-to-motion tools stop at the prompt. AnimoFlow_DrawTrajectory is the node that lets you draw the path: an in-canvas top-down pad where you sketch a freehand curve, and the generated character follows it. It's the ComfyUI graph's version of the trajectory feature in the hosted AnimoFlow webUI, and it's what turns "a person walks forward" from a dice roll into "a person walks a loop around this point." Pair it with AnimoFlow_PriorMDM for a soft trajectory prior, or with AnimoFlow_Kimodo for a hard root constraint - it feeds both.

    The canvas widget is an 8m × 8m ground plane with the origin at center and up-the-page = +Z, the same mapping as the webUI pad. What you draw gets serialized into the hidden points_json STRING widget, and the Python side canonicalizes it exactly the way the API server does - the pack's stage library is single-sourced, so the hosted webUI and this node can't drift. That canonicalization is the key concept: the curve gets normalized into the model's canonical frame, the motion is generated against it, and then the export stage (via traj_restore_json) places the character back on your drawing. Draw anywhere; it lands where you drew.

    Outputs - this is the wiring

    The node emits four outputs, and which ones you use depends on which generator you're driving:

    • curve_2d_json → wire to AnimoFlow_PriorMDM's curve_2d_json input (canonical curve).
    • root2d_json → wire to AnimoFlow_Kimodo's root2d_json input (dense root constraint).
    • traj_restore_json → wire to AnimoFlow_GLBExport's traj_restore_json so the final export restores the drawn path.
    • duration → wire to the generator's duration input. The pad is the single source of truth for length: it fixes the frame indices of the root constraint (Kimodo generates at 30 fps) and re-emits the number so your generator node is wired from here - one knob, no conflict between pad and generator.

    The two inputs are points_json (the raw drawn polyline as [[x,z],...]; edit as text only in headless use - the canvas overwrites it) and duration (1–30s, default 4).

    Getting it working

    It's a GUI-interactive node, so install is the standard two-part AnimoFlow thing - Manager or git clone https://github.com/AnimoFlow/comfyui-animoflow.git, then the Docker backend for whatever generator you're feeding (./install.sh doctor, ./install.sh up; add --gpu if it's Kimodo). The draw pad itself is pure frontend; the node only needs numpy/scipy from requirements.txt.

    The curated trajectory_priormdm workflow is the fastest way to see it in action - drag the JSON in, draw, queue. One caveat that affects both draw nodes in this pack: there's a known ComfyUI frontend bug where interactive-widget nodes shrink when you click or drag them under the Nodes 2.0 (Modern Node Design) rendering, and it hits core nodes like KSampler too, so it's not this pack's fault. The workaround the pack documents: just enlarge the node manually and keep going; toggling Nodes 2.0/Classic in Settings doesn't currently fix it. And if you edit points_json by hand, it needs at least 2 points or the node errors with "draw a curve first."

    CategoryAnimoFlow/Input

    Inputs (2)

    NameTypeDefaultDescription
    points_jsonSTRING[[0.5, 0.5], [0.5, 1.5], [1.0, 2.2], [1.8, 2.6], [2.6, 2.6]]
    durationFLOAT4.01–30

    Outputs (4)

    NameTypeDescription
    curve_2d_jsonSTRING
    root2d_jsonSTRING
    traj_restore_jsonSTRING
    durationFLOAT