3. Content
Preserve meaning before pixels
Text retains source spans, words, shaped clusters and layout. Code retains token spans and correspondence. Charts retain keyed marks. Paths retain contours, arc length and tangents. These enable meaningful selection and attachment before image treatment.
AE separates text selection from the properties being animated; its
expression-selector default includes
selectorValue * textIndex/textTotal. This supports reusable
selection/treatment operations. AE
text animators.
reveal_words, style_words and
focus_source are Node methods that reach text
or code through layout and paint wrappers. Past a shader, mask or blend
they give an Invalid node, which preflight reports with a
fix. A recipe exposes its content stage through typed inputs or public
helpers:
fn neon_treatment(content: Node, color: Color) -> Node:
content.look(glow(20.0, 0.3, .Some(color)))
fn emphasized_headline(p: HeadlineProps) -> Node $ Frame:
accent := 1.0 + 0.12 * progress(ms(800), ms(1100), .EaseOut)
content := text(p.label, size=96.0, weight=700.0, max_width=p.width, color=p.color)
.reveal_words(ms(0), ms(90), ms(240))
.style_words(select=.Last, scale=accent)
neon_treatment(content, p.color)
style_words changes selected words' presentation after
layout, with scale around each word's center and no reflow. The text
remains meaningful until its conversion to Node. Dynamic selectors need
validation when static types cannot establish the selected
capability.
Identity and morphing
Use scoped data keys, source spans and prepared particle IDs. Reused components get distinct instance scopes. IDs support matching and diagnostics; every spacer does not need a name. Seeds depend on stable identities rather than traversal order.
| Operation | Correspondence and preparation | Failure policy |
|---|---|---|
| Layout/shared-element morph | Resolve keyed endpoint layouts in the same target | Explicit enter/leave for unmatched IDs |
| Text/code morph | Match source/token spans; shape both endpoints; deterministic tie-breaking | Fade unmatched parts and allow match overrides |
| Path morph | Align contours, winding, start points and compatible segments | Error or explicit crossfade when topology is incompatible |
Text morphs (built):
prepare_text_morph!(before, after) lays out two
text(...) nodes once, aligns them in a box as wide as the
wider by their own alignment, and pairs words with equal text (longest
common subsequence, then the nearest equal word left over).
sample(progress) draws both texts with word treatments:
matched words of the first shift_words toward their place
in the second; the first's other words fade out over the first half, the
second's fade in over the second half; the ends are the exact texts.
TextMorph.width is the shared box
(sentence).
FLIP-style animation resolves declared endpoints, not the previous rendered frame. Reflow across aspect ratios may require endpoint text-layout morphs; stretching glyphs is not an automatic substitute. Code matching is semantic token correspondence, not a claim of a general AST transformation. Math should expose named subexpressions alongside exported geometry. Shiki Magic Move, maintainer explanation, Manim matching TeX.
Typography, math and captions
Preserve font identity, language/direction, spans, features, variation axes, source-to-cluster mappings and logical/visual ordering. A Unicode scalar, grapheme, shaping cluster and glyph are not interchangeable. Default animation should preserve ligatures and combining sequences. Font metric/wrapping changes require explicit reshaping or endpoint morphing. HarfBuzz clusters.
Fonts are the project's: any font file, by path. A
Project names its fonts, a
FontSet of FontFace { family, path, hash }:
family is the name inside the file, which text names;
path is relative to the asset root or absolute;
hash (SHA-256) is optional and pins the file, so a changed
font fails to load instead of silently changing the render.
FontSet::of([...]) is exactly the faces given;
FontSet::bundled() is the defaults the library ships, Inter
(SANS, "Inter Variable") and JetBrains Mono
(MONO), which text and code use when they name no family,
and .with(face) adds a face to either. The CLI registers
the project's fonts with the shaper before preparation, so text measured
or outlined while preparing uses them, and a video's own set, if it
differs, before rendering. Report missing glyphs, substitutions and
fallback. Text takes tracking (units added between glyphs
after kerning; negative tightens) and leading (baseline to
baseline; 0 is 1.2× the font's height). Kinetic type should include
word/line reveals, staggered entrances, emphasis and counters with
stable number formatting/tabular figures.
Built: prepare_math!(source) asks the
Typesetter in the Preparing row for the SVG of
Typst math source. Renders use RetainedMath,
which reads math/<hash>.svg;
hd run typeset_math builds every project with a collecting
typesetter, then runs typst compile --format svg for
formulas not yet retained. The SVG is imported by pkg.svg
(Typst glyphs are <symbol>s drawn by
<use>), and Math.draw(size, color) draws
it with the text size units high. Formulas are outlines, so
looks, wipes, traces and particle assembly apply. Named subexpressions
are not exposed yet.
Use Typst as a preparation adapter for math and document fragments: source plus pinned compiler/packages/fonts produces vector geometry and bounds. CPU typesetting is compatible with GPU-only rasterization. Preserve named subexpressions for animation. Typst math is not LaTeX; a LaTeX adapter is a separate capability. Typst math, SVG export.
Captions consume prepared word timing, display text and optional confidence. Separate spoken/normalized text from presentation. Group by punctuation and dwell time, enforce configurable safe areas and line limits, and support both burned-in output and SRT/VTT export.
SVG
prepare_svg!(path) reads an SVG file once, in
preparation, into ordinary nodes (pkg.svg, all hd). It
imports paths (every command, arcs as cubics), rectangles, circles,
ellipses, lines, polylines, polygons, groups, use,
transforms, inherited presentation attributes and inline
style, and linear and radial gradients. Elements keep their
id as node names. Text, images, filters, masks, clip paths,
patterns and style sheets are skipped and listed in
Svg.skipped.
art := if drawn < 1.0: trace(a.drawing.node, drawn) else: a.drawing.draw(edit)
trace(node, fraction) draws strokes on by length
(Outline.trimmed) and fades fills in over the last third.
Svg.draw(edit) hands each named part, in its parent's
units, to edit(id, part) every frame. Labels stay nippo
text, so they are shaped, checked and inspected like any other text. The
diagram project shows both.
Data and diagrams
Provide typed tables/series, scales, axes, ticks, charts, counters and annotations. Keep values distinct from animated coordinates. Bar charts normally start at zero; logarithmic scales reject invalid values. Stable domains and labels are essential to honest comparisons. Store source-value metadata for checks without OCR.
Start diagram layout with trees/layered graphs, ports, routed edges and named groups. Prepare expensive constraint solutions, retain their seed/version/output, and animate matched endpoints. Do not rerun a nondeterministic optimizer during every frame. Penrose API, constraints.
Typed templates and aspect ratios
A template is typed props, optional effectful preparation and pure video construction for a target. Its schema drives input validation and batch rendering. Stable batch IDs determine seeds and output names; manifests retain inputs and asset/effect hashes.
16:9, 9:16 and 1:1 variants should share asset bytes but resolve different layouts. Reflow diagrams, labels and captions; reframe subjects. Scaling a finished landscape image is insufficient. Safe areas are named configurable presets, not a universal platform constant. Remotion parameterization, metadata calculation.
Generated media are prepared assets
Generation, TTS, transcription and analysis use explicit capabilities during preparation. They return immutable bytes plus metadata and timing. Their results are not reconstructed from a seed during rendering.
| Asset source | Verified interface in the research snapshot | Retained output |
|---|---|---|
| Generated images | BFL POST /v1/flux-2-pro |
Bytes, request/model record, dimensions and color/alpha metadata |
| Generated footage | Runway
client.imageToVideo.create(...).waitForTaskOutput() |
Downloaded media, duration/time base, reference inputs |
| Timed TTS | ElevenLabs
POST /v1/text-to-speech/{voice_id}/with-timestamps |
Audio and original/normalized alignment |
| Known-script alignment | ElevenLabs POST /v1/forced-alignment |
Audio/text correspondence and corrections |
| Music | ElevenLabs POST /v1/music |
Audio, actual duration and request/model metadata |
Sources: BFL quickstart, Runway SDK, TTS timing, forced alignment, music.
Provider adapters select verified current capabilities rather than hardcoding model policy into the core. Transcription is distinct from aligning known text; alignment is not diarization. A seed does not guarantee regenerated bytes, and temporary provider URLs are not durable assets. Download, hash and retain the results. Fake capabilities return the same typed fixtures for tests. No provider quality comparison was performed.
Prepared content used by the examples
Narration. voiceover! accepts a
configured voice and named SpeechSegment values.
VoiceTrack exposes .duration,
.cue(id) intervals, .words and
.audio(). Missing cue IDs are preparation/preflight errors,
not zero-time fallbacks. Generated bytes and alignment are locked.
captions(words,time,style,box) uses actual word intervals,
wraps inside its box and retains word/source correspondence. Caption
styles .explainer() and .social() choose
versioned typography; .gain_db changes audio gain without
shifting timing.
A score in code. pkg.synth writes sound
at preparation: a Track of mono samples with
kick, snare, noise (hats,
crashes), tone (partials, attack, decay, detune),
riser and midi(note).
Track.clip(name) normalizes it into a WAV
AudioClip, and Track.mono() feeds
analyze_samples, so the visuals react to the same notes.
Noise comes from a seeded hash, so a score is deterministic
(showcase).
Code morphs. prepare_code_morph! takes
both source strings, language, fonts, style, width, matching policy and
unmatched behavior. It prepares stable token correspondence and reserves
the union of endpoint bounds. .sample(progress) has exact
source endpoints; unmatched tokens fade.
.focus_source(.After,text="fold",amount,dim) selects the
prepared after-source range, with zero amount leaving appearance
unchanged. Focus changes presentation, not layout.
Charts and counters. Table::columns
combines equally sized text/numeric columns.
BarChart::new(... category,value,key) uses unique stable
category keys. .domain, .size,
.axis_titles, .value_labels,
.color, .reveal and .node produce
the chart. Size includes axes, labels and reserved margins. Reveal
changes presentation while preserving data/domain.
NumberFormat::integer and ::fixed(...suffix)
control display; number(...tabular=true) requests
equal-width digits.