π Sine Camera Pan
A Pan That Sways, Swings Back, and Loops Clean
- frames
- frames
Linear Camera Pan [DVB] sweeps one way at constant speed and stops. Sine Camera Pan [DVB] is the version that sweeps, eases, reverses, and sweeps back - a pendulum instead of a slide. It's the same crop-window machinery, but the position factor follows a sine wave, so the camera glides to one edge, decelerates, and returns. That's the move you want for a swaying establishing shot, a "searching" camera, or anything you intend to loop.
The sine is where the interesting detail lives. The motion is a sine wave over the whole set, but it's been adjusted so the first and last frames land at the same spot - the source explicitly "recalcs" the motion factor to make it loopable. For a 24 fps clip with period_seconds of 1, the pan completes a full out-and-back cycle every second of footage. That looping behavior is the feature: it's why this node pairs so well with the AnimateDiff-style loop workflows the pack was built to support.
The inputs that matter
It's the linear pan plus timing:
frames- theFRAME_SETin.output_width/output_height(both default512) - the crop window and output size. Smaller than the input, always.direction_x/direction_y- the pan axis as a vector (defaults1,-1).period_seconds(default1, min0.1) - one full sine cycle, in seconds of footage. It's converted using the frame set's own frame rate, so a 12 fps set and a 24 fps set get different cycle lengths from the same value.phase_seconds(default0) - shifts where in the cycle the animation starts. Useful for staggering two panning layers.pan_mode- two choices here, not three: edge to edge (full travel) or edge to center (half travel, calmer).
Output is a single frames - a FRAME_SET at the requested size, smaller than the input.
Installing
It's in Dream Video Batches (Alt Key Project / Dream Project):
cd ComfyUI/custom_nodes
git clone https://github.com/alt-key-project/comfyui-dream-video-batches.git
cd comfyui-dream-video-batches
pip install -r requirements.txt
Or ComfyUI Manager β search "Dream Video Batches" β install β restart. No model downloads; the whole pack is frame math.
Where people get burned
Three things. First, the same headroom rule as every camera node: output must be smaller than the input or there's no room to sway, and the node will warn and pass frames through unchanged. Second, period_seconds is measured against the frame set's own fps - set the wrong framerate when you created the set (Create Frame Set [DVB] takes framerate_base and framerate_divisor) and your "one second" pan becomes a half-second or a two-second sway. Third, if your goal is a seamless loop, don't fight the loopable motion by changing phase_seconds mid-design - leave the phase at 0 for a clip you intend to cycle, and use it only when you're deliberately staggering layers. And the usual exit: a FRAME_SET won't connect to stock output nodes - unwrap it before Save Video.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| frames | FRAME_SET | β | |
| output_width | INT | 512 | β |
| output_height | INT | 512 | β |
| direction_x | FLOAT | 1.00 | β |
| direction_y | FLOAT | -1.00 | β |
| period_seconds | FLOAT | 1.0 | β |
| phase_seconds | FLOAT | 0.00 | β |
| pan_mode | COMBO | 2 options: edge to edge, edge to center |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| frames | FRAME_SET | β |