2. Time and motion

Time and sampling

Frame.time() is the mapped local sample time, not always output index divided by frame rate. Placement maps parent time into a clip; retiming maps destination time into source time. Source duration metadata stays with that source. Output index is separate delivery metadata.

Use rational Time/Rate for boundaries and signed subframe offsets for shutter sampling. Editorial spans are half-open. Legacy integer-index callbacks remain frame-quantized through an explicit adapter; retiming cannot manufacture continuous motion from integer-only branches.

Provide trim, speed, reverse, freeze, loop and ping-pong as destination-to-source maps. Integrate a speed curve to obtain source time; multiplying current time by current speed is wrong. Non-invertible maps such as freezes and loops cannot promise a unique inverse for captions or events.

Prepare speech/media durations before video assembly and lock their results. series duration is the sum minus explicit overlaps; parallel is the maximum child end. Missing source samples use a declared transparent/hold/loop/error policy. Resolve cyclic duration dependencies before rendering.

Animation

Keep direct progress, tween and analytical spring helpers. Add optional immutable Track[T] curves with per-segment easing, cubic Bézier curves, step/hold, explicit extrapolation and pure derived values. Springs need a fixed duration or a named settling tolerance; they do not have an automatic exact physical finish.

Stagger maps stable element order to local time offsets. Path motion distinguishes parameter progress from arc-length progress and specifies orientation/cusp behavior. Prepared audio envelopes can drive values. Two treatments writing the same property need defined replace/add/multiply/transform-composition rules.

An optional sequential Score builder records tracks and markers once, then yields immutable data. It can read like to; wait; to without replaying a coroutine to every requested frame. Basic components never require a Score. Motion Canvas's flow and Theatre's typed properties are useful references, not runtime models Nippo must adopt. Motion Canvas flow, Theatre core.

Easing: .Linear, .EaseOut, .EaseInOut and Ease::bezier(x1, y1, x2, y2). progress clamps to 0 and 1 outside a validated increasing interval. last_sample_time() is meaningful only on a uniform local grid. Retimed clips keep the frame grid for whole-frame offsets, loops and ping-pongs; speed changes and freezes drop it, and then last_sample_time() refuses rather than guessing.

Editorial intervals are half-open. An animation ending at the exclusive video duration need not reach 1 on its last visible sample: finish earlier and hold, or target the grid's last sample. Export rounds the frame count up and pads the audio; the report separates declared from delivered duration.

Clips

A clip is data, not a closure of closures: a tree with a view function at each leaf, plus retime, look, echo, motion-blur and placement nodes. It can be inspected and cached by its structure. clip.look(look) applies a look to every sample. clip.look_over_time(fn(node) -> Node $ Frame) does the same with the clip's clock, so a grade, camera move or beat hit can run over a whole sequence. It keeps the sequence's transition spans, so checks still see the transitions underneath.

A Node cannot reconstruct its generating function

Glow, a mask or an ordinary warp can consume a Node. Echo and motion blur require the retained timed source. This distinction should appear in signatures and useful diagnostics, without creating two competing beginner effect catalogues.

For example, a look lifts pointwise over a clip with clip.look(...), while echo is a Clip method. Applying echo to an already sampled Node should suggest wrapping the original view and duration.

For speed factor 2 and echo spacing Δ, order is observable:

Motion blur samples its input scope over that scope's shutter interval. blur(translate(freeze(C))) can blur the translation; translate(blur(freeze(C))) cannot. Temporal effects never depend on whichever output frame rendered previously.

Echo is clip.echo(count, spacing, decay, tail): count delayed copies in addition to the current image. Copy k samples t − k×spacing with weight decay^k, composited source-over from oldest to newest with the current image on top. Out-of-range samples are transparent. Duration is preserved by default; tail=.Include adds count × spacing. Repeated translucent edges need not equal the source, so an exact final hold belongs outside the echo.

A trail is clip.trail(length, samples=12, tail): an echo of samples copies spaced length / samples apart, with a decay that leaves the oldest at 5%. Apply a glow or blur over the trail clip, not to each copy.

Duration, holds and transitions

Extending a lower third should ordinarily extend its hold rather than stretch the entrance. Word stagger contributes to natural completion time. Prepared declarations can report this exactly; arbitrary callbacks receive sampled checks unless they declare timing expectations.

Effects report natural tails but preserve declared duration by default. Explicit inclusion/padding may extend it. A particle effect ends after its final birth plus lifetime. Silent duration changes would move later shots.

A transition combines two already sampled images and progress; the composition chooses both source times. For a 5-second A and 4-second B with 1-second overlap, B starts at 4 seconds and total duration is 8 seconds. At output 4 + u, sample A at 4 + u, B at u, and progress u / 1s. Endpoint short-circuiting must avoid requesting an exclusive-end source when it contributes nothing.

Keep core picture clips and audio signals separately typed. A footage convenience can pair them for trim/speed with explicit pitch policy. J/L cuts are different audio/picture spans. Ripple editing can be a pure list transformation when needed; a full NLE or interchange layer is unnecessary.

Transitions

A transition is Transition::Cut, .Fade, or .With(fn(Node, Node, f64) -> Node), which takes the outgoing samples, the incoming sample and the progress. Wipes, slides, film burns and whips are .With functions in pkg.looks, and a project writes its own the same way. In a placement, everything already showing is the outgoing side.

This page’s source on GitHub