Nodes/KJNodes for ComfyUI/Create Fade Mask Advanced
ComfyUI Node Runs on cloud

Create Fade Mask Advanced

Keyframe a mask's value over a batch of frames

By kijai·Created 3 years ago·Updated about 7 hours ago· 2,930
Create Fade Mask Advanced
    • MASK
    points_string0:(0.0), 7:(1.0), 15:(0.0)
    invertfalse
    frames16
    width512
    height512
    interpolation

    When you're animating something in ComfyUI, you constantly need a value that ramps over time - a mask that fades in, an effect strength that rises and falls, a transition that eases from black to white and back. CreateFadeMaskAdvanced builds exactly that: a batch of solid-value masks interpolated between keyframes you type in. Set "frame 0 is black, frame 7 is white, frame 15 is black" and it fills in every frame between with a smooth curve.

    The neat part is the syntax - it borrows Fizz Nodes' BatchValueSchedule format, frame:(value), so if you've done any AnimateDiff scheduling it's already muscle memory. It's part of the masking/generate family in Kijai's KJNodes, and it's one of the more genuinely handy scheduling tools once you're doing timed effects rather than single stills.

    How it works

    You write a list of keyframes, each index:(value) where value is 0.0–1.0. The node interpolates between them across the frame count using the curve you pick, producing one flat, full-frame mask per frame. Per the node's own docs: 0:(0.0), 7:(1.0), 15:(0.0) over 16 frames starts fully black, eases up to fully white by the 8th frame, and eases back to black by the 16th. Note the index is 0-based - the first frame is 0, not 1.

    The inputs and outputs that matter

    • points_string (multiline) - your keyframes, one index:(value) per line. This is the heart of the node.
    • frames (INT, default 16) - total length of the batch. Your last keyframe index should sit inside this.
    • interpolation - the easing curve between keyframes: linear, ease_in, ease_out, ease_in_out, none, or default_to_black. ease_in_out gives the smooth, natural fade most people want.
    • invert (BOOLEAN) - flips the whole schedule's polarity.
    • width / height (default 512) - mask resolution.

    The single output is a MASK batch. Feed it wherever a per-frame mask or strength schedule belongs - a masked latent blend, an effect's strength input, an AnimateDiff mask slot.

    How to install it

    ComfyUI Manager: search KJNodes for ComfyUI, install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kijai/ComfyUI-KJNodes
    pip install -r ComfyUI-KJNodes/requirements.txt
    

    then restart (portable: pip via python_embeded\python.exe). No downloads.

    Common issues & troubleshooting

    Syntax has to be exact. It's frame:(value) - the parentheses matter, and value is a float between 0.0 and 1.0. A missing paren, a value above 1.0, or a stray character breaks the parse. When it errors, it's almost always a typo in points_string.

    Off-by-one on frame indices. Indices start at 0. 15:(0.0) is the sixteenth frame in a 16-frame batch, not the fifteenth. Keep your last keyframe at frames - 1 or below, or it lands outside the batch and gets ignored.

    It's a flat mask, not a shape. This node makes uniform full-frame masks - the whole frame is one value at a time. If you wanted a shape that fades in (a circle appearing, text dissolving), generate the shape separately and multiply it by this fade schedule. On its own it's a brightness ramp, not a region.

    The fade feels robotic. Switch interpolation off linear. Linear ramps look mechanical; ease_in_out is what gives you the soft, filmic transition. none holds each keyframe value flat until the next (steps, not ramps) - useful, but not what you want if you're chasing a smooth fade.

    CategoryKJNodes/masking/generate

    Inputs (6)

    NameTypeDefaultDescription
    points_stringSTRING0:(0.0), 7:(1.0), 15:(0.0)
    invertBOOLEANfalse
    framesINT162–10000
    widthINT5121–4096
    heightINT5121–4096
    interpolationCOMBO6 options: linear, ease_in, ease_out, ease_in_out, none, default_to_black

    Outputs (1)

    NameTypeDescription
    MASKMASK