Skip to main content

Module zoom_anim

Module zoom_anim 

Source
Expand description

The zoom engine — a ZoomSegment as a pure function of the frame.

On an animation stand, the rostrum camera pushes in by riding a screw drive toward the artwork — a slow, eased move from wide to tight and back. This module is that move in software: given a zoom region and a project frame, it returns the ZoomTransform (a scale about a focal point) the renderer applies to the composed frame. It is the heart of the editor’s signature look, and — because it is GPU-free arithmetic — it is exhaustively unit-testable. Preview and export call the same function, so what you scrub is what you ship.

The profile is three phases over a zoom’s [start, end) window: an eased ramp-in from no-zoom to full amount, a hold at full, and a symmetric eased ramp-out back to no-zoom. The ramp length is clamped to half the window so the two ramps never overlap — a short zoom degrades gracefully to a triangle (push-in straight into push-out, no hold) instead of fighting itself.

Structs§

ZoomKeyframe
A dopesheet keyframe for a zoom: a project frame and the scale at it.
ZoomTransform
A scale-about-a-focal-point transform for one composed frame.

Functions§

active_zoom_at
The active zoom transform at project frame across the whole project: the transform of the first zoom region whose window contains frame, or ZoomTransform::identity when none do. The ramp is derived from the project’s frame rate.
default_ramp_frames
A sensible ramp length for fps: about 0.6 s of ease-in / ease-out — the cinematic-but-snappy feel screen recorders converge on — floored at a single frame so even a 1 fps project still animates.
frac 🔒
num / den as f64, via a lossless u32 hop (frame counts are tiny; den is always > 0 at the call sites below).
zoom_at
The zoom transform at project frame for one segment.
zoom_keyframes
The keyframes of a zoom’s scale curve, for the dopesheet (ED.13): identity at both edges, full amount across the hold, eased between. Four keyframes when there’s a hold; three (a triangle peak) when the ramps fill the window. This is the dopesheet’s view of zoom_at — pass the same ramp_frames.