85453da49f
regression / regression-shards (style-16-prod style-9-prod style-17-prod iframe-render-compat variables-prod mp4-h265-sdr, shard-4) (push) Has been cancelled
regression / regression-shards (style-4-prod style-11-prod style-2-prod animejs-adapter typegpu-adapter parallel-capture-regression, shard-5) (push) Has been cancelled
regression / regression-shards (style-7-prod style-8-prod style-10-prod css-spinner-render-compat webm-transparency mp4-h264-sdr webm-vp9, shard-3) (push) Has been cancelled
regression / regression-shards (sub-composition-video style-18-prod raf-ball-render-compat font-variant-numeric sub-comp-t0 sub-comp-id-selector, shard-7) (push) Has been cancelled
Windows render verification / Detect changes (push) Has been cancelled
Windows render verification / Preflight (lint + format) (push) Has been cancelled
Windows render verification / Render on windows-latest (push) Has been cancelled
Windows render verification / Tests on windows-latest (push) Has been cancelled
CI / Detect changes (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Fallow audit (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Typecheck (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Producer: integration tests (push) Has been cancelled
CI / Producer: unit tests (push) Has been cancelled
CI / File size check (push) Has been cancelled
CI / Test: skills (push) Has been cancelled
CI / Skills: manifest in sync (push) Has been cancelled
CI / CLI: npx shim (macos-latest) (push) Has been cancelled
CI / CLI: npx shim (ubuntu-latest) (push) Has been cancelled
CI / CLI: npx shim (windows-latest) (push) Has been cancelled
CI / SDK: unit + contract + smoke (push) Has been cancelled
CI / Test: runtime contract (push) Has been cancelled
CI / Studio: load smoke (push) Has been cancelled
CI / Smoke: global install (push) Has been cancelled
CI / CLI smoke (required) (push) Has been cancelled
CI / Semantic PR title (push) Has been cancelled
Player perf / Detect changes (push) Has been cancelled
Player perf / Preflight (lint + format) (push) Has been cancelled
Player perf / player-perf (push) Has been cancelled
Player perf / Perf: drift (push) Has been cancelled
Player perf / Perf: fps (push) Has been cancelled
Player perf / Perf: parity (push) Has been cancelled
Player perf / Perf: scrub (push) Has been cancelled
Player perf / Perf: load (push) Has been cancelled
preview-regression / Detect changes (push) Has been cancelled
preview-regression / Preflight (lint + format) (push) Has been cancelled
preview-regression / Preview parity (push) Has been cancelled
preview-regression / preview-regression (push) Has been cancelled
regression / regression (push) Has been cancelled
regression / Detect changes (push) Has been cancelled
regression / Preflight (lint + format) (push) Has been cancelled
regression / regression-shards (hdr-regression style-5-prod style-3-prod mov-prores, shard-1) (push) Has been cancelled
regression / regression-shards (overlay-montage-prod style-12-prod chat missing-host-comp-id png-sequence portrait-edge-bleed, shard-6) (push) Has been cancelled
regression / regression-shards (style-13-prod style-6-prod vignelli-stacking gsap-letters-render-compat audio-mux-parity, shard-8) (push) Has been cancelled
regression / regression-shards (style-15-prod hdr-hlg-regression style-1-prod many-cuts vfr-screen-recording render-symlinked-assets, shard-2) (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Docs / Validate docs (push) Has been cancelled
Sync skills to ClawHub / Publish changed skills (push) Has been cancelled
77 lines
3.6 KiB
Markdown
77 lines
3.6 KiB
Markdown
# Tracks and Clips
|
|
|
|
Clips are timed children of the composition root. Tracks are a temporal-overlap concept, not a visual-stacking concept.
|
|
|
|
## What is a Clip
|
|
|
|
A clip is any DOM element with `data-start`, `data-duration` (where required), and `data-track-index`. Common kinds:
|
|
|
|
- **Visual `<div>` clips** — scenes, cards, overlays. Always require `data-duration`.
|
|
- **Sub-composition hosts** — `<div>` with `data-composition-src`. Always require `data-duration`.
|
|
- **Video clips** — `<video>` with `muted` and `playsinline`. Duration can default to media length.
|
|
- **Audio clips** — `<audio>`. Duration can default to media length.
|
|
- **Image clips** — `<img>`. Always require `data-duration`.
|
|
|
|
Add `class="clip"` to authored visual clips so tooling and examples can find them.
|
|
|
|
## Tracks Are Temporal, Not Visual
|
|
|
|
`data-track-index` controls **temporal overlap**, not paint order:
|
|
|
|
- **Two clips on the same `data-track-index`** must NOT overlap in time. `hyperframes lint` flags this.
|
|
- **Visual layering (front/back)** is controlled by CSS `z-index`, not by track index.
|
|
|
|
A clip on track `5` is not "above" a clip on track `1` — it's just on a different audio/visual lane in time. Use CSS for layering, tracks for sequencing.
|
|
|
|
## Picking a Track Index
|
|
|
|
There's no fixed convention, but common patterns:
|
|
|
|
- **Track 0** — base video (e.g. an A-roll).
|
|
- **Track 1+** — visual scenes, overlays, captions.
|
|
- **Higher tracks (e.g. 10+)** — audio clips, separated from visual tracks to keep linting clear.
|
|
|
|
When adding a new clip to an existing composition:
|
|
|
|
1. Find an existing track that has no overlap with your new clip's `[data-start, data-start + data-duration)` range.
|
|
2. Or pick a fresh track index.
|
|
3. Never overlap two clips on the same track — the linter will fail and the render is undefined.
|
|
|
|
## Clip Time Inside the Composition
|
|
|
|
`data-start` is in seconds, measured from the start of the _composition_. For sub-compositions, the sub-composition's internal timeline (its own `data-duration` and child clips) runs from `data-start` to `data-start + data-duration` of the host.
|
|
|
|
`data-media-start` (on `<video>`/`<audio>`) is an offset _into the source media_. Use it to skip the first few seconds of a media file without trimming the file itself.
|
|
|
|
## Relative Timing
|
|
|
|
`data-start` accepts a clip ID instead of a number, meaning "start when that clip ends". Add `+ N` / `- N` to offset; negative produces overlap (useful for crossfades).
|
|
|
|
```html
|
|
<video id="intro" data-start="0" data-duration="10" data-track-index="0" src="..."></video>
|
|
<video id="main" data-start="intro" data-duration="20" data-track-index="0" src="..."></video>
|
|
<video
|
|
id="scene-a"
|
|
data-start="intro + 2"
|
|
data-duration="20"
|
|
data-track-index="0"
|
|
src="..."
|
|
></video>
|
|
<video
|
|
id="scene-b"
|
|
data-start="intro - 0.5"
|
|
data-duration="20"
|
|
data-track-index="1"
|
|
src="..."
|
|
></video>
|
|
```
|
|
|
|
Rules:
|
|
|
|
- References resolve **inside the same composition only** — cannot reach into a parent or sibling sub-composition.
|
|
- The referenced clip must have a **known duration** (explicit `data-duration` or inferred from media). Otherwise the reference cannot resolve.
|
|
- **No circular references** — `A → B → A` is rejected. Cycles are detected and error out.
|
|
- A value that parses as a number is always treated as absolute seconds. Otherwise the resolver expects `<id>`, `<id> + <number>`, or `<id> - <number>` (whitespace optional).
|
|
- References can chain (`A → B → C`). Keep chains under 3-4 levels for readability.
|
|
- Negative offsets create overlap; overlapping clips must be on **different tracks**, same-track overlap is rejected.
|