Nodes/Dream Video Batches/πŸ‘‰ Sine Camera Pan
ComfyUI Node

πŸ‘‰ Sine Camera Pan

A Pan That Sways, Swings Back, and Loops Clean

By alt-key-projectΒ·Created 3 years agoΒ·Updated 7 months agoΒ· 95
πŸ‘‰ Sine Camera Pan
  • frames
  • frames
β—„output_width512β–Ί
β—„output_height512β–Ί
β—„direction_x1.00β–Ί
β—„direction_y-1.00β–Ί
β—„period_seconds1.0β–Ί
β—„phase_seconds0.00β–Ί
β—„pan_modeβ–Ύβ–Ί

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 - the FRAME_SET in.
  • output_width / output_height (both default 512) - the crop window and output size. Smaller than the input, always.
  • direction_x / direction_y - the pan axis as a vector (defaults 1, -1).
  • period_seconds (default 1, min 0.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 (default 0) - 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.

Category🎭 DVB/πŸŽ₯ camera

Inputs (8)

NameTypeDefaultDescription
framesFRAME_SETβ€”
output_widthINT512β€”
output_heightINT512β€”
direction_xFLOAT1.00β€”
direction_yFLOAT-1.00β€”
period_secondsFLOAT1.0β€”
phase_secondsFLOAT0.00β€”
pan_modeCOMBO2 options: edge to edge, edge to center

Outputs (1)

NameTypeDescription
framesFRAME_SETβ€”