KJNodes/masking/generategenerated

Create Fade Mask Advanced(CreateFadeMaskAdvanced)

This node parses the user-input `points_string` string, which defines the target mask value (0。

Create Fade Mask Advanced

MASK
points_string
0:(0.0), 7:(1.0), 15:(0.0)
invert
frames
16
width
512
height
512
interpolation
COMBO
KJNodes

The Create Fade Mask Advanced node is used to generate a series of masks that change over time (frames). It allows users to create mask animation sequences with smooth transitions or specific variations by defining keyframes and their corresponding mask grayscale values.

Node Functionality

This node parses the user-input points_string, which defines the target mask value (between 0.0 and 1.0) at specific frame indices (starting from 0). Based on the specified interpolation method, the node automatically calculates the mask values for all intermediate frames and ultimately generates a mask batch containing the specified number of frames. Its syntax is compatible with Fizz's BatchValueSchedule node.

Node Parameter Description - Create Fade Mask Advanced

Control Parameters (Parameters)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
interpolationCOMBOYeslinear"linear", "ease_in", "ease_out", "ease_in_out", "none", "default_to_black""ease_in", "ease_out", "ease_in_out", "none" (no interpolation, direct jump), or "default_to_black" (undefined frames default to black).
points_stringSTRINGYes0:(0.0),\n7:(1.0),\n15:(0.0)-String defining keyframes and their corresponding mask grayscale values. Format is "frame_index:(mask_value),", e.g., "0:(0.0), 7:(1.0), 15:(0.0)". Frame indices start from 0.
invertBOOLEANYesFalse-Boolean value determining whether to invert the generated mask. When True, black and white areas are swapped.
framesINTYes162 - 10000 (step: 1)Specifies the total number of mask frames to generate. Valid range is 2 to 10000, with a step of 1.
widthINTYes5121 - 4096 (step: 1)Sets the width in pixels for the generated masks. Valid range is 1 to 4096, with a step of 1.
heightINTYes5121 - 4096 (step: 1)Sets the height in pixels for the generated masks. Valid range is 1 to 4096, with a step of 1.

Output

Parameter NameData TypeDescription
MASKMASKOutputs the generated mask batch, which can be used by subsequent image composition or processing nodes.

Use Cases

In video generation or image sequence processing workflows, this node can be used to create dynamic fade-in/fade-out, flickering, or complex light effect masks. For example, you can define a mask that starts as black (fully transparent) at the beginning of a video, becomes white (fully opaque) in the middle, and returns to black at the end, thereby controlling the appearance and disappearance of another layer in the sequence.

Notes

Please note that the input frame index cannot exceed the total number of frames minus one, and the mask value should remain within the range of 0.0 to 1.0. The size of the generated masks is fixed by the width and height parameters, and all frames have the same mask dimensions.

The Create Fade Mask Advanced node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…