Nodes/S42 CutFlow/⬡ S42 CutFlow Shape Mask
ComfyUI Node

⬡ S42 CutFlow Shape Mask

Animated shape masks straight from a keyframe string — no external assets

By GeekyGhost·Created 6 months ago·Updated 4 months ago· 3
⬡ S42 CutFlow Shape Mask
    • mask
    • frame_count
    • info
    width512
    height512
    frames24
    shapeellipse
    center_x0.50
    center_y0.50
    size0.50
    feather0.05
    rotation_kf
    size_kf
    invertno

    Shape Mask is the primitive generator of the pack: it produces animated grayscale masks - rectangle, ellipse, star, or diamond - that you feed into anything with a mask input. Wire one into Mask Wipe for a custom transition, use it to drive a compositing matte, or keyframe its size and rotation for a growing/spinning reveal. Because the mask is generated procedurally from numbers, it's reproducible, resolution-independent, and needs no image assets or downloads.

    The inputs that matter

    The shape itself first: shape (rectangle / ellipse / star / diamond), center_x / center_y (0–1, both default 0.5), size (float, default 0.5 - relative to the frame, so 0.5 is a half-frame shape), feather (0–0.5, default 0.05 - edge softness), and invert (yes/no) to flip white↔black.

    Then the canvas: width and height (64–8192, default 512×512) and frames (int, default 24) - how many mask frames to generate. Set frames to match your target clip's length, or to 1 for a static mask.

    And then the animation, which is the part that makes this node more than a static-shape doodad:

    • rotation_kf - a keyframe string animating rotation in degrees. 0:0, 24:360 spins the shape one full turn over 24 frames.
    • size_kf - a keyframe string animating size. 0:0.2, 12:0.8, 24:0.2 grows the shape in and shrinks it back out - a pulse.

    The keyframe format is frame:value comma-separated pairs (same philosophy as the pack's Speed Ramp curve strings, just simpler - no easing suffix here).

    How it works

    Procedural generation, plain and simple: for each frame it evaluates the size and rotation keyframes at that time, draws the shape into a mask tensor at the requested resolution with the feather applied as a soft edge, and stacks the frames into a batch. The output mask is a standard MASK type, so it plugs directly into Mask Wipe's custom_mask, a Layer Composer layer mask, or any ComfyUI node that accepts masks. You also get frame_count and info outputs. It's CPU-only and instant - no models, no VRAM, nothing to download.

    Installing it

    The whole S42 CutFlow suite installs together:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/GeekyGhost/S42-CutFlow.git
    pip install -r S42-CutFlow/requirements.txt   # Windows portable: python_embeded\python.exe -m pip
    

    Or ComfyUI Manager, search S42 CutFlow, install, restart. It's under S42 CutFlow/Composition.

    Gotchas

    A few practical notes. First, width/height are the mask's own canvas, not automatically your clip's - if you generate a 512×512 mask and your clip is 1920×1080, you'll either need to resize the mask or set the dimensions to match. Most compositing nodes handle a size mismatch, but you'll get a softer, aliased edge if you do. Second, the default 24 frames is not a hint - if you want an animated mask over a 121-frame clip, set frames to 121 or your mask animation ends at frame 23 and holds. Third, keyframes past the frame count are ignored; keep them inside your range. And one nice-to-know: because feather is in normalized units, small values (0.05) give a clean hard-ish edge at any resolution while 0.3+ starts looking like a soft gradient blob - tune it to taste, since there's no "correct" setting. For a star or diamond, expect the classic stylized look rather than organic edges - that's the point.

    CategoryS42 CutFlow/Composition

    Inputs (11)

    NameTypeDefaultDescription
    widthINT51264–8192Mask width.
    heightINT51264–8192Mask height.
    framesINT241–9999Number of mask frames to generate.
    shapeCOMBOellipseMask shape type.
    center_xFLOAT0.500–1Shape center X (0-1).
    center_yFLOAT0.500–1Shape center Y (0-1).
    sizeFLOAT0.500.01–2Shape size relative to frame. 0.5 = half frame.
    featherFLOAT0.050–0.5Edge feathering/softness.
    rotation_kfSTRINGKeyframe string for rotation animation. E.g. '0:0, 24:360'. Degrees.
    size_kfSTRINGKeyframe string for size animation. E.g. '0:0.2, 12:0.8, 24:0.2'.
    invertCOMBOnoInvert the mask (white↔black).

    Outputs (3)

    NameTypeDescription
    maskMASK
    frame_countINT
    infoSTRING