đź’€Motion Position On Path
Trace a drawn path and fly your layer along it
- path_image
- Position
Plain đź’€Motion Position moves a layer in a straight line between two points. đź’€Motion Position On Path is the fancier cousin: you give it a picture of a path - a drawn line, a curve, a scribble - and it traces that path, flying your layer along it with auto-orientation so the layer turns to face the direction of travel. It's the S4Motion node that turns "move it right" into "follow this swoopy trajectory."
It's still a position effector: its Position output is an S4_POSITION_EFFECTOR and it plugs into the exact same position_effector socket on đź’€Motion Config as Motion Position. (Note that - they share a socket, so swap them freely.) It's also the only effector in the pack where the mechanism is genuinely interesting. The node:
- Takes your path_image (any IMAGE) and finds the drawn stroke.
- Extracts the path's skeleton with scikit-image, then fits a spline through it with SciPy.
- Samples the spline per frame, and - here's the nice part - it also works out the path's tangent direction so it can return auto-orientation values. Motion Config sees the path mode flag and centers the layer on the path, rotating it to follow the curve. Your layer doesn't just translate; it steers like a car on a track.
The rest is the standard effector set: duration, delay, motion_curve (linear, ease_in, ease_out, ease_in_out), inverse (run the path and come back), loop (keep circling).
Install - and the big gotcha
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.
Here's the thing that will bite you: the pack's requirements.txt labels scikit-image, scipy, and opencv-python as optional - but this node imports cv2, scipy.ndimage, scipy.interpolate, and skimage unconditionally at the top of its module. Since ComfyUI loads every node class in the pack on startup, if those libraries are missing, the whole pack fails to load, not just this node. That "graceful fallback" the README promises does not exist for this module. If ComfyUI throws an import error after installing S4Motion, this is almost certainly why:
pip install opencv-python scikit-image scipy bezier
Then restart. The README's "core" three packages (torch, Pillow, numpy) are not enough for a clean boot.
Other gotchas
- The path must be clearly drawn. A faint or anti-aliased line can skeletonize poorly and give you a wobbly trajectory. A clean high-contrast stroke on a plain background traces best.
- It's the slowest node in the pack - skeletonization plus spline fitting on startup, then per-frame sampling. First run after changing the path will take a moment.
There's no community discussion of S4Motion anywhere (zero reddit hits), so the examples/Position_On_Path.json workflow is the reference. It's the pack's most impressive node when it works - set a loop, draw a circle, and watch your layer orbit.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| path_image | IMAGE | — | |
| duration | FLOAT | 1.000–30 | — |
| delay | FLOAT | 0.000–30 | — |
| motion_curve | COMBO | linear | 4 options: linear, ease_in_out, ease_in, ease_out |
| inverse | BOOLEAN | false | — |
| loop | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Position | S4_POSITION_EFFECTOR | — |