Frame Mask Generator
Loops, ping-pongs, and fades on tap
- schedule
- total_frames
ComfyUI-KJNodes' Create Fade Mask Advanced node is powerful and, let's be honest, picky - it consumes keyframe schedules in a specific 0:(1.0),15:(0.0),... format, and hand-writing those for every fade you want is where video workflows go to waste time. Frame Mask Generator is the shortcut: pick a pattern, set the frame count, and it writes the schedule for you. It's the general-purpose sibling of MoonPack's VACE Looper Frame Mask node - same output language, but for everyday fades instead of just loops.
The niche it fills is real. Video work in ComfyUI is full of moments where you want a fade in, a fade out, a loop that eases, or a ping-pong bounce, and each one is a different hand-typed keyframe string. This node turns that into a mode selector.
The inputs that matter
mode- the whole point. Six patterns:linear_loop- 1→0 then 0→1 with a held middle (the default).ping_pong- 1→0→1, a full bounce.ease_in_out- 0→1→0 with mid-fade stops, softer than a hard cut.fade_in- 0→1 then hold.fade_out- hold then 1→0.custom- passes your owncustom_keyframesthrough untouched (a trailing comma is added for you if it's missing, keeping the parser happy).
total_frames- the total length in frames. Default 81.fade_frames- the length of each fade ramp. Default 15, and auto-clamped tototal_frames / 2so a fade can't eat the whole clip.custom_keyframes- used only whenmode = custom.
The outputs
schedule (STRING) - the keyframe schedule in kjnodes format, ready to feed into Create Fade Mask Advanced. And total_frames (INT), which just echoes your frame count back - handy when you're wiring the same count into several nodes and want one source of truth. For the custom mode, the output is your keyframes, normalized with the trailing comma.
The use case that makes it click
The nicest setup is composing it with other MoonPack video nodes: a VACE loop gives you total_frames; Frame Mask Generator gives you a matching fade schedule; the two feed the kjnodes mask node together. It also just makes exploration cheap - want to see what ping-pong looks like on this clip? Flip the mode, rerun. No syntax, no googling the format, no off-by-one comma errors.
Installing it
Part of MoonPack:
cd ComfyUI/custom_nodes
git clone https://github.com/moonwhaler/comfyui-moonpack.git
or ComfyUI Manager → MoonPack → install, restart. Under MoonPack/video. No models, no extra Python dependencies - though the output is only useful if you have ComfyUI-KJNodes installed to consume it.
Verdict
A small, honest utility that removes a recurring bit of video grunt work. If you already hand-type kjnodes schedules, it'll feel like cheating (in the good way). If you're new to fades, it teaches you the format by generating it for you - copy a schedule from the output once and you'll finally know what those numbers mean.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | linear_loop | linear_loop: 1→0 then 0→1 with held middle. ping_pong: 1→0→1. ease_in_out: 0→1→0 with mid-fade stops. fade_in: 0→1 then hold. fade_out: hold then 1→0. custom: pass custom_keyframes through. |
| total_frames | INT | 811–100000 | Total length in frames. |
| fade_frames | INT | 150–10000 | Length of each fade ramp (auto-clamped to total_frames/2). |
| custom_keyframesopt | STRING | Used only when mode='custom'. A trailing comma is added if missing. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| schedule | STRING | — |
| total_frames | INT | — |