Camera Motion
A still image on screen for five seconds looks like a slideshow. The same image with a slow push-in looks like footage. Camera motion is that slow movement: a zoom, a pan, or both, applied to whatever is on screen during an interval.
Adding motion
Motion is added to the timeline per interval, with add_motion. It is not attached to a specific image; it applies to whatever visual is showing during that interval.
from imaginaryarts import CameraMotion
video.add_image(images[0], interval=[0, 5000])
video.add_motion(CameraMotion.KenBurns(), interval=[0, 5000])The same motion object can be reused at many intervals. Intervals with no motion stay static.
If a motion interval covers only part of a visual's time on screen, the motion still runs correctly over the covered part. When two motion intervals overlap the same visual, the one with the larger overlap wins.
Presets
| Preset | Movement |
|---|---|
CameraMotion.Static() | No movement. The default when nothing is added. |
CameraMotion.KenBurns() | A slow, linear push-in from 1.0 to 1.12. The house look. |
CameraMotion.PushIn() | 1.0 to 1.12 with ease-in-out, so it starts and ends gently. |
CameraMotion.PullOut() | 1.12 to 1.0 with ease-in-out. |
CameraMotion.PanLeft() | Zoomed to 1.2 and held there while the frame drifts left. |
CameraMotion.PanRight() | Same, drifting right. |
CameraMotion.PanUp() | Same, drifting up. |
CameraMotion.PanDown() | Same, drifting down. |
CameraMotion.ZoomInPanUp() | Pushes in from 1.0 to 1.2 while the center drifts upward. |
Custom motion
Two factories build your own. Both take an easing of "linear" or "ease-in-out".
Zoom only, centered on the frame:
CameraMotion.zoom(start=1.0, end=1.25, easing="ease-in-out")Zoom and position. Each of start and end is a tuple of (zoom, center_x, center_y), where the centers are fractions of the frame from 0 to 1:
# Push in slightly while drifting from the lower-left toward the center.
CameraMotion.motion(
start=(1.1, 0.40, 0.60),
end=(1.2, 0.50, 0.50),
easing="linear",
)Zoom must be 1.0 or more; the frame is never scaled below its own size, so there are never empty edges.
Stills and clips
On a still image, motion is rendered with heavy supersampling so even a slow push-in moves in sub-pixel steps and stays smooth. On a video clip the same motion works, with less headroom, since every frame of a clip has to be processed. Subtle moves look best on clips; save the larger zooms for stills.