Nodes/ComfyUI S4Motion/đź’€Motion Mask
ComfyUI Node

đź’€Motion Mask

A Photoshop-style clipping mask that moves with your layer

By S4MUEL-404·Created about a year ago·Updated 11 months ago· 4
đź’€Motion Mask
  • mask
  • Mask
â—„duration1.00â–ş
â—„delay0.00â–ş
â—„motion_curvelinearâ–ş
â—„inversefalseâ–ş
â—„loopfalseâ–ş
â—„x_default0â–ş
â—„x_target0â–ş
â—„y_default0â–ş
â—„y_target0â–ş
â—„rotation_default0â–ş
â—„rotation_target0â–ş
â—„scale_default1.00â–ş
â—„scale_target1.00â–ş
â—„opacity_default1.00â–ş
â—„opacity_target1.00â–ş

A layer that fades or slides is one thing; a layer that only shows through a shape - like a logo emerging from a circle, or text revealed by a sweeping window - is another. đź’€Motion Mask is the S4Motion effector that clips your layer to a mask, and it can animate the mask's transform over time. The pack describes it as a "Photoshop-like clipping mask," and that's exactly the right mental model.

It's an effector, so its Mask output (an S4_MASK_EFFECTOR) plugs into the mask_effector socket on đź’€Motion Config. When Config composites, the mask multiplies the layer's alpha - pixels outside the mask vanish, and the layer's own transforms (position, rotation, scale, opacity) still apply on top. Combine a moving mask with the layer's own motion and you get reveal effects that feel like real motion graphics.

The inputs split into two groups:

  • mask - the mask image itself (a MASK type, e.g. from a mask-painting node or a generated mask). White areas show the layer, black hides it.
  • The transform pair, each with _default/_target: x and y (move the mask), rotation (spin it), scale (shrink/grow the reveal window), and opacity (fade the mask's influence). Plus the shared duration, delay, motion_curve, inverse, loop timing controls.

So a classic use: give the mask a small scale_target and animate it up to 1 over a second with ease_out, and the layer "expands" into view through the mask shape. Animate x/y for a wipe that travels across the frame. The _default/_target pattern is the same as every other effect - frame one vs. end of the move - so once you've used one S4Motion effector, you know this one.

Install

cd ComfyUI/custom_nodes/
git clone https://github.com/S4MUEL-404/ComfyUI-S4Motion.git
pip install -r ComfyUI-S4Motion/requirements.txt

or ComfyUI Manager → "S4Motion" → install → restart.

Gotchas

  • The mask needs an alpha context to show off. If your layer is a flat RGB image, a mask just crops it; the "clipping" is only visible because Config composites the layer over a background. Feed Config a background_image and the reveal becomes obvious.
  • Mask geometry and layer geometry are independent. The mask is transformed in its own coordinate space, then applied to the layer - so a mask that's bigger than the layer still clips correctly, but a small mask will need its scale or position animated to cover what you want to reveal.
  • The mask applies to the layer, not the background. If you want the background masked too, that's not this node's job.

There's no reddit discussion of S4Motion at all, so the examples/Mask.json workflow is the reference wiring. One tip from the examples: pair a moving mask with a static background and let the layer + mask do all the work - that's where this node shines.

Categoryđź’€S4Motion

Inputs (16)

NameTypeDefaultDescription
maskMASK—
durationFLOAT1.000–30—
delayFLOAT0.000–30—
motion_curveCOMBOlinear4 options: linear, ease_in_out, ease_in, ease_out
inverseBOOLEANfalse—
loopBOOLEANfalse—
x_defaultFLOAT0-4096–4096—
x_targetFLOAT0-4096–4096—
y_defaultFLOAT0-4096–4096—
y_targetFLOAT0-4096–4096—
rotation_defaultFLOAT0-360–360—
rotation_targetFLOAT0-360–360—
scale_defaultFLOAT1.000.01–10—
scale_targetFLOAT1.000.01–10—
opacity_defaultFLOAT1.000–1—
opacity_targetFLOAT1.000–1—

Outputs (1)

NameTypeDescription
MaskS4_MASK_EFFECTOR—