[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6BXWRS6GH4V26XSA7AJRPE9":3,"skill-same:01M6BXWRS6GH4V26XSA7AJRPE9":100},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":48,"linkOnly":49,"markdownContent":50,"markdownBody":51,"frontMatter":52,"refName":53,"commitSha":54,"skillDirectory":55,"forksCount":56,"repositoryHtmlUrl":57,"repositoryHomepageUrl":58,"ownerHtmlUrl":59,"ownerBlogUrl":13,"ownerDescription":60,"updatedAt":61,"install":62,"resources":75},"01M6BXWRS6GH4V26XSA7AJRPE9","sandbox-timeline","动态图形时间轴代码编写","Author a motion-graphics timeline as code — scenes, layout containers, motion primitives and transitions, saved in one call","以代码形式编写动态图形时间轴——包括场景、布局容器、运动原语和过渡效果，并通过一次调用即可保存。","nodetool-ai\u002Fnodetool","nodetool-ai","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F164873569?v=4","01M6BXPFDW36K9K1MR8ZH63HG2","nodetool.ai","01M6BXPFJ893XM219GQN60B0WK",635,"AGPL-3.0",null,"https:\u002F\u002Fgithub.com\u002Fnodetool-ai\u002Fnodetool\u002Fblob\u002Fmain\u002Fpackages\u002Fsandbox-packs\u002Fsandbox-timeline\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BR5V816HPKFXP1YV56C07K","多媒体工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BZ46FYV5AM3SZCCPTV85Y2","视频生成与制作","SCENARIO","使用场景",[31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47],"sandbox","timeline","sandbox timeline","call","author","saved","motion-graphics","as","layout","transitions","scenes","motion primitives","graphics","motion","primitives","code","containers","2026-11-10 10:12:30",false,"---\nname: sandbox-timeline\ndescription: Author a motion-graphics timeline as code — scenes, layout containers, motion primitives and transitions, saved in one call\n---\n\n# Timelines as code\n\nSpecifier: `@nodetool-ai\u002Fsandbox-timeline`. One module. It builds a whole\ntimeline document in plain JavaScript and saves it through\n`nodetool.timelines`, so a cut with hundreds of keyframed clips costs a\nhandful of API calls instead of one `edit` op per clip. NodeTool's shipped\nexample timelines (Cadence, Kite, Prism, Voltra, Tidewater, T minus 30) are built with\nit.\n\nUse it for authored motion graphics: kinetic type, shapes, charts, placed\nstills, transitions between scenes. For a few changes to a cut that already\nexists, `nodetool.timelines.edit(id, ops)` is still the better tool.\n\n**Units are seconds, everywhere, local to the scope that created them.** A\nscene's own clock starts at 0. There is no absolute-time option — `v.series()`\nis the only place a scene's position in the whole video is decided, and it is\nthe only function that ever shifts a time. Author a moment once, at the time\nit happens in its own scene, and it is correct wherever that scene lands.\n\n## A two-scene piece\n\n```js\nimport { video } from \"@nodetool-ai\u002Fsandbox-timeline\";\n\nconst v = video({\n  width: 1920, height: 1080, fps: 30,\n  palette: { ink: \"#06110e\", ink2: \"#0c2a21\", text: \"#f4fbf8\", accent: \"#34d399\" },\n  fonts: { display: \"Space Grotesk\", body: \"Inter\" }\n});\n\nconst hello = v.scene(\"Hello\", 2.5, (s) => {\n  s.backdrop();\n  const title = s.text(\"Hello, timeline\", { size: 120, weight: 700, font: \"display\" });\n  const sub = s.text(\"built from code\", { size: 40, color: \"#8fb3a6\" });\n  s.stack([title, sub], { gap: 20 });\n  title.enter({ from: { scale: 1.2, opacity: 0 }, at: 0, dur: 0.3, ease: \"outExpo\" });\n  sub.enter({ from: { offsetY: 24, opacity: 0 }, at: 0.15, dur: 0.25 });\n  title.exit({ to: { opacity: 0 }, dur: 0.2 });\n});\n\nconst outro = v.scene(\"Outro\", 1.5, (s) => {\n  s.backdrop({ colors: [\"#0f3b2e\", \"#06110e\"] });\n  const cta = s.pill(\"Try it\", { fillColor: \"#f4fbf8\", color: \"#06110e\" });\n  cta.enter({ from: { scale: 0.6, opacity: 0 }, dur: 0.25 });\n});\n\nv.series([hello, v.transition(\"wipe\", 0.3, { direction: \"left\" }), outro]);\nv.adjust([{ type: \"vignette\", amount: 0.2 }], { name: \"finish\", trackId: \"t_finish\" });\n\nconst saved = await v.save(nodetool.timelines, { name: \"Hello\", showcase: true });\nawait output(\"timeline\", saved);   \u002F\u002F { timeline_id, errors, warnings }\n```\n\nThen look at it: `nodetool.timelines.preview(saved.timeline_id, {count: 3})`\nreturns composited frames, and `render(id, {preview_scale: 0.5})` a draft\nvideo.\n\n## Study a reference and reuse scene helpers\n\n`nodetool.timelines.examples.list()` lists shipped cuts with structural stats.\n`nodetool.timelines.examples.get(\"kite\", {clip_limit: 12})` returns its scene\ncatalog and a bounded scene excerpt. Select another `scene_id` or page with\n`clip_offset` to read more layers. Inspect the clip hierarchy, curve windows\nand effects before choosing your own scene structure.\n\n`nodetool.timelines.examples.source(\"kite\")` returns the script that made\nthat excerpt: full JavaScript, imports included.\n\n## `video({width, height, fps, palette, fonts})`\n\nThe entry point. `palette` supplies colours the craft helpers fall back to:\n`ink`, `ink2`, `text`, `dim`, `accent`. `fonts` maps short keys (`display`,\n`body`) to real family names; a text element's `font` option takes either a\nkey or a literal family string.\n\n## Scenes and series\n\n`v.scene(name, seconds, fn)` builds one scene at its own local clock, `fn(s)`\nreceiving the scene's authoring object. It returns a scene descriptor — nothing\nis placed in the document yet.\n\n`v.series([scene, transition?, scene, transition?, scene, ...])` lays scenes\nend to end and assigns every clip's absolute position. A `v.transition(type,\nseconds, opts)` item between two scenes overlaps them by its own duration and\nsets `transitionIn` on the incoming scene's group; omitting one between a pair\nmakes a hard cut. `type` is one of the document's transition types (`\"wipe\"`,\n`\"whip\"`, `\"iris\"`, `\"gradientWipe\"`, `\"crossfade\"`, `\"push\"`, `\"slide\"`,\n`\"zoom\"`, `\"zoomBlur\"`, `\"glitch\"`, `\"dipToColor\"`, `\"lightLeak\"`); `opts`\ncarries that type's own fields (`direction`, `easing`, `color`, `softness`,\n`map`, `seed`, …). Scenes are banked onto two alternating track sets so an\noverlapping pair never shares a track — you never see or name a track.\n\n`v.series` must run before `v.adjust`, `v.document` or `v.save`.\n\n## Local time nests\n\nEverything inside a scene builder is measured from that scene's own start.\n`s.seq(atSec, durSec, fn)` opens a nested local clock: `fn(q)` receives a\nscoped authoring object whose own `atSec`\u002F`durationSec` for elements and\nmotion are relative to `atSec` *inside the enclosing scope*, not to the whole\nvideo. Nest as deep as you like — the shift out to absolute time happens once,\nin `v.series()`.\n\n```js\n\u002F\u002F fragment\nv.scene(\"Beat\", 4, (s) => {\n  s.seq(1.2, 1.0, (q) => {\n    const chip = q.text(\"+$0.60\", {});\n    chip.enter({ from: { offsetY: 20, opacity: 0 }, at: 0, dur: 0.2 }); \u002F\u002F 1.2s into the scene\n  });\n});\n```\n\n## Elements\n\nEvery element is a scene method returning a clip object with motion methods\nattached. `at`\u002F`dur` (seconds, defaulting to the whole enclosing scope) narrow\nwhere in that scope the clip lives; everything else is the clip's own fields.\n\n| Call | Makes |\n|---|---|\n| `s.text(str, o)` | a text clip. `o.size`, `o.weight`, `o.color`, `o.font` (a `fonts` key or a literal family), `o.tracking` (em, a fraction of size: `-0.04` tight, `0.2` wide caps), `o.italic`, `o.anchor` `\"left\"`\u002F`\"right\"`\u002F`\"center\"`, `o.mw` max width as a frame fraction, `o.path` (text-on-path: the same point commands `s.path()` takes), `o.fill` a colour or a gradient (same as `style.fill`, below), `o.style` — passthrough for any other `textStyle` field (`lineHeight`, `verticalAlign`, `stroke`, `shadow`, `background`) — an unrecognized top-level option throws, naming it and pointing at `style` |\n| `s.rect(w, h, fill, o)`, `s.ellipse(d, fill, o)` | shape clips; `fill` a colour or a gradient `{type, angle\\|stops, ...}`; `o.r` corner radius, `o.stroke`, `o.sw` |\n| `s.path(points, o)` | an SVG path from `[[\"M\", x, y], [\"L\", x, y], …]` in px from the frame centre. `H x`\u002F`V y` take one coordinate on their own axis; `A rx ry xRotDeg largeArc sweep x y` scales the two radii as sizes and passes the angle and the two flags through unscaled |\n| `s.image(assetId, o)` | a placed still. `assetId` takes what the asset tools print (`asset:\u002F\u002F\u003Cid>.\u003Cext>`, a 12-character id, or the full id); the clip stores the bare id and `v.save()` resolves it to the full one. `package:\u002F\u002F` and `https:\u002F\u002F` locators pass through |\n| `s.video(assetId, o)`, `s.audio(assetId, o)` | a placed video or audio clip. `o.in` (seconds into the source), `o.volume` (dB), `o.fadeIn`\u002F`o.fadeOut` (seconds), `o.speed` (playback rate), `o.mute`, `o.remap` (a time remap: `[{t, sourceAt, ease?}, …]`, `t` 0..1 across the clip, `sourceAt` **seconds into the source media**, not scene-local time) |\n| `s.group(o)` | a nested group; children reparent onto it with `{parent: g.id}` |\n| `s.adjust(effects, o)` | an adjustment layer scoped to this scene — its clip's parent is the scene's own group, so it treats that scene's surface and nothing outside it (an adjustment is group-scoped by construction). This is the way to grade one scene: a per-scene duotone, a vignette that only applies to one beat |\n| `s.fill(color, o)` | a full-frame rect, same as `s.rect(W, H, color, {x:0, y:0, ...o})` |\n\n`x`\u002F`y` are px from the frame centre, or from the parent's own position when\nthe clip is reparented into a group. `rotation` (degrees) and `anchor` ({x, y}\npivot fraction, default `{0.5, 0.5}`) are friendly options for the two\n`transform` fields authored most; `tx: {extra fields}` is the raw escape\nhatch for the rest (`rotationX`\u002F`rotationY`, `perspective`, `depthPx`, …), and\na full `transform: {position, scale, rotation, anchor, depthPx, ...}` override\nstill works when nothing else fits. Every element option also takes clip\nfields as-is: `effects` (an `id`\u002F`enabled: true` an entry leaves out is filled\nin — write `{type: \"glow\", radius: 30, ...}`, not `{id: \"...\", enabled: true,\ntype: \"glow\", ...}`), `opacity`, `blendMode`, `mask` (a static crop mask —\n`ClipMask`, `{kind: \"rect\"|..., ...}` — not the wipe mask `enter()`\u002F`animate()`\ntake, below), `matte`, `crop`, `motionBlur`, `steppedTime`, `repeater`,\n`inPointMs`, `outPointMs`, `speedBaked`, `fadeInShape`, `fadeOutShape`. There\nis no field a clip carries that needs mutating after creation — anything\n`video`\u002F`audio`\u002F`text` don't name a friendly option for still passes through\nby its own document field name.\n\n## Layout containers\n\n`s.stack(children, o)` and `s.row(children, o)` build a real CSS\u002FYoga flex\ncontainer (`layout: {display: \"flex\", flexDirection: \"column\" | \"row\", gap,\nalignItems, justifyContent, padding, width, height}`) and reparent `children`\nonto it (`child.parentId = container.id`) — real nesting, not a sibling list.\nNest freely: a container can be a child of another container (a `row` of\n`stack`s, a `stack` holding a nested `row`), and the renderer's Yoga resolver\nlays out the whole tree.\n\nThe container's own placement in the frame is `o.at` (`{x, y}`, default the\nframe centre) plus `o.anchor` (default `\"center\"`). `at` is canvas-centre-relative\n— the same coordinate space every clip's own position already is: `{x: 0, y: 0}`\nis frame centre, negative `x` is left of centre, negative `y` is above it.\n`anchor` names the point of the container's own *computed* box that lands at\n`at` — `{x: 0, y: 0.5}` or the name `\"left\"` put that box's left edge at\n`at.x`, no measuring a sibling's width required. Example: on a 1920-wide\nframe, `anchor: \"left\"` with `at: {x: -860, y: -212}` puts that left edge\nnear the frame's own left margin (-860 is 960px left of centre, i.e. near\nx=100 on screen); `at: {x: 110, ...}` would instead land it just right of\ncentre. Named anchors: `\"top-left\"`, `\"top\"`, `\"top-right\"`, `\"left\"`,\n`\"center\"`, `\"right\"`, `\"bottom-left\"`, `\"bottom\"`, `\"bottom-right\"`, or pass\n`{x, y}` fractions directly. A container's own *time* window is `o.start`\u002F\n`o.dur` (seconds) — the one place in this API `at` doesn't mean seconds,\nbecause the container's placement already claims it.\n\n`o.gap` (px), `o.padding` (px, or `{top, right, bottom, left}`), `o.width`\u002F\n`o.height` (px or `\"N%\"`) size the container. `o.parent` nests it inside\nanother clip (e.g. a phone mockup) instead of the scene root. `o.wrap` turns\non `flexWrap`.\n\n`o.align` is `\"start\"` (default), `\"center\"`, `\"end\"`, `\"stretch\"` or\n`\"baseline\"` — the cross axis (`alignItems`): a row's shared y, a stack's\nshared x. `o.justify` is `\"start\"`, `\"center\"`, `\"end\"`, `\"between\"`,\n`\"around\"` or `\"evenly\"` — the main axis (`justifyContent`), unset by default\n(children pack at the start with the authored gap). A `stack`\u002F`row` call with\nan unknown `align`\u002F`justify` throws, naming the value.\n\nA child's own flex sizing\u002Fplacement is `o.flexItem` on that child's own call\n(`grow`, `shrink`, `basis`, `alignSelf`, `width`, `height`, `margin`,\n`position: \"absolute\"`, `inset`) — pass it through any element's own options,\ne.g. `s.rect(..., { flexItem: { grow: 1 } })`. `s.rect`\u002F`s.ellipse` also take\n`absolute: true` as sugar for `flexItem: {position: \"absolute\", inset: 0}` —\ntaken out of flow and resized to fill its flex parent's box exactly, which is\nhow a pill's plate or a card's backdrop sits behind its content: create the\nbackground *before* the foreground children (so its `_z` draws below), then\nreparent it onto the container.\n\n**A leaf's flex-measured size is its own content, never a guessed line\nheight** — a text child reflows to whatever width Yoga offers, and a text's\nown `mw` does nothing once it sits inside a `stack`\u002F`row`: its width comes\nfrom the container, not from itself, so don't pass `mw` to a text child of a\ncontainer — leave it unset there. `mw` still matters on a standalone text (one\nplaced directly with `at`\u002F`x`\u002F`y`, no enclosing container); a shape\u002Fellipse's\nsize is its\nown `shapeStyle.width`\u002F`height` (unset defaults to 0, not the frame, so an\nundecorated plate doesn't force its siblings into a shrink negotiation); a\n**plain (non-flex) group nested as a leaf measures as its children's own union\nbox** — give a plain group wrapping e.g. an icon + a drawn path (each a leaf\nwith its own small authored size) an explicit `flexItem: {width, height}`\nwhen any of its children is a bare `path()` (no authored `shapeStyle.width`\u002F\n`height` of its own — `path()` never sets one), since that child's\nun-measured intrinsic size falls back to the whole frame and the group would\nmeasure as canvas-sized.\n\n`s.center(child, o)` repositions `child` directly at `o.at` (default the frame\ncentre) — for a single element, no container needed.\n\n## Motion primitives\n\nAll local to the clip's own start (`at: 0` is the moment the clip appears),\nunless `stagger()` set a default `at` for it.\n\n| Call | Does |\n|---|---|\n| `el.enter({from, at, dur, ease, mask})` | animates from `from`'s values to each property's rest pose (`opacity`\u002F`scale`\u002F`scaleX`\u002F`scaleY`\u002F`trimEnd`\u002F`wipeProgress` rest at `1`, everything else at `0`). Always an \"in\" — there is no flip to solve, because the end value is always rest. |\n| `el.exit({to, at, dur, ease})` | animates from each property's rest pose to `to`'s values. `at` defaults to the clip's own end minus `dur`. Always an \"out\". |\n| `el.animate(props, {at, dur, ease, role, mask})` | a general keyframed animation. Each `props` value is `[from, to]`, `[from, to, easing]`, or a waypoint list `[[t, value], [t, value, easing], …]` with `t` from 0 to 1 across the window. |\n| `el.loop(props, periodSec, {ease})` | a looping animation with a cycle of `periodSec`; `ease` defaults `\"linear\"` (a spin or a scroll needs constant speed). |\n| `el.count({from, to, at, dur, prefix, suffix, decimals, padTo, groupSeparator, ease})` | a ticker text animator; `padTo` zero-pads the digit count (`padTo: 2` → `\"09\"`) |\n| `el.scramble({at, dur, charset, seed, ease})` | a scramble-in text reveal (the ticker's sibling `textAnimator`) |\n| `el.tween(target, keyframes, {at, dur, by, staggerMs})` | a style track, `target` like `\"shape.fill\"`, `\"effect.\u003Cid>.amount\"` or a `glyph.*` field (`glyph.color`, `glyph.blurPx`, `glyph.trackingPx`, …); `keyframes` like `animate`'s waypoint list |\n| `el.draw({at, dur, ease})` | draw a path or stroke on, via `trimEnd` — `enter({from: {trimEnd: 0}, ...})` |\n| `el.typewriter({at, dur, caret})` | a typewriter reveal; `set_timeline_document` resolves `dur` to one reveal per character. **Replaces** the clip's animations — a typewriter is the whole entrance. `caret`: `{color, widthPx, blinkPeriodMs}` |\n| `el.preset(name, {at, dur, ease, role, ...params})` | a catalog animation baked server-side from its own curve generator, not hand-authored keyframes: `\"fade\"`, `\"slide\"`, `\"pop\"`, `\"spin\"`, `\"wipe\"`, `\"blur\"`, `\"colorFade\"`, `\"pulse\"`, `\"flash\"`, `\"shake\"`, `\"bounce\"`, `\"squash\"`, `\"kenBurns\"`, `\"float\"`, `\"breathe\"`, `\"rotate\"`, `\"hueShift\"`, `\"orbit\"`, `\"followPath\"`, `\"typewriter\"`. Every key in `o` besides `at`\u002F`dur`\u002F`ease`\u002F`role`\u002F`by`\u002F`staggerMs` is a preset param — see `PresetParamSpec[]` per preset in `packages\u002Ftimeline\u002Fsrc\u002Fanimation\u002Fpresets.ts` for names, defaults and ranges |\n\n`enter`\u002F`animate`\u002F`count`\u002F`tween` take `by` (`\"word\"`\u002F`\"character\"`\u002F`\"line\"`)\nand `staggerMs` to stagger across the units of one text clip — a headline that\nrises in word by word, a wordmark that types in letter by letter. **A\n`glyph.*` `tween()` target needs a stagger** — the document validator refuses\none without a unit, since animating per-glyph style with no split is the\nun-staggered block case `enter`\u002F`animate` already cover. `tween()` left with\nno `by` of its own inherits the stagger of the last `enter()`\u002F`animate()` call\non the *same* clip, so a `glyph.color` tween riding the same word-by-word\nreveal as its `enter()` needs no repeated `by`:\n\n```js\n\u002F\u002F fragment\nconst title = s.text(\"Every purchase\", { anchor: \"left\" });\ntitle.enter({ from: { offsetY: 40, opacity: 0 }, by: \"word\", staggerMs: 90 });\ntitle.tween(\"glyph.color\", [[0, \"#8fb3a6\"], [1, \"#f4fbf8\"]]); \u002F\u002F inherits by: \"word\"\n```\n\n**A `wipeProgress` animation needs `mask: {direction, softness}`** — a wipe\nreveal has nowhere else to say which edge it sweeps from. Pass it on the same\n`enter()`\u002F`animate()` call that drives `wipeProgress`, not as a follow-up\nmutation:\n\n```js\n\u002F\u002F fragment\narea.animate({ wipeProgress: [0, 1] }, { at: 0.4, dur: 1.3, mask: { direction: \"left\", softness: 0.02 } });\n```\n\n`s.stagger(items, offsetSec, fn)` offsets several **already-created**\nelements' default motion `at` by `index * offsetSec`, then calls `fn(item,\nindex)`:\n\n```js\n\u002F\u002F fragment\nconst words = [\"Round-ups\", \"on\", \"every\", \"card\"].map((w) => s.text(w, { anchor: \"left\" }));\ns.stagger(words, 0.06, (w) => w.enter({ from: { offsetY: 40, opacity: 0 } }));\n```\n\n`ease` names: `\"in\"`, `\"out\"`, `\"inOut\"`, `\"outExpo\"`, `\"inExpo\"`, `\"linear\"`,\nor a raw curve string such as `\"spring(170,16,1)\"` or\n`\"cubic-bezier(0.65,0,0.35,1)\"`.\n\n## Craft\n\nScene methods for the recurring structural moves. Every helper takes seconds\nand px like everything else, and every option has a default, so\n`s.backdrop()` alone renders a full bleed. `palette` supplies the colours a\ncall does not override.\n\n| Helper | Signature | Makes |\n|---|---|---|\n| `s.backdrop(o?)` | `{colors: [a, b], opacity, seed}` | full-frame ink base + an animated `gradientField` wash |\n| `s.glow(o?)` | `{size, alpha, color, ...}` | radial glow fading to transparent |\n| `s.flash(o?)` | `{at, dur, peak, color}` | full-frame screen-blend flash, peak to 0 |\n| `s.kicker(str, o?)` | `{x, y, at, dur, size, weight, color, font}` | uppercase label, left-wipe entrance |\n| `s.pill(label, o?)` | `{size, weight, color, fillColor, stroke, dot, shadow, padX, padY, x, y, anchor, at, dur, font}` | a flex row (optional leading dot + label) over an absolute inset-0 background plate, optional leading dot |\n| `s.streaks(o?)` | `{count, colors, rotationDeg, opacity}` | phase-shifted repeater bars racing off frame |\n| `s.finish(o?)` | `{vignette, softness, grain, seed, saturation, contrast}` | scene-scoped grain + vignette adjustment |\n\n**`s.backdrop({colors: [a, b]})` uses `a` twice** — as the solid base rect\nunderneath, and as the first stop of the animated `gradientField` wash on top\nof it. There is no separate base colour: pass `colors: [a, b]` to mean \"base\nand wash both start at `a`, wash drifts toward `b`\", not \"a solid `a` behind a\n`b`-to-something wash\".\n\nA slam, a rise, or a grow are `el.enter()`\u002F`el.animate()` calls with the right\n`from`\u002Fprops — there is no separate name for them:\n\n```js\n\u002F\u002F fragment\ntitle.enter({ from: { scale: 1.35, blur: 26, opacity: 0 }, dur: 0.27, ease: \"outExpo\" }); \u002F\u002F slam\nsub.enter({ from: { offsetY: 24, opacity: 0 }, dur: 0.3 });                                     \u002F\u002F rise\nbar.animate({ scaleY: [0, 1], offsetY: [h \u002F 2, 0] }, { dur: 0.4, ease: \"out\" });           \u002F\u002F grow from its base\n```\n\n## Components\n\n`component(name, {props, duration}, (s, props) => {...})` — a reusable piece\n(a lower third, a stat card, a CTA end card) with typed props, used inside a\nscene with `s.use(Comp, {...props}, {at, dur})`. `props` maps a name to\n`{type: \"string\"|\"number\"|\"color\"|\"boolean\", default, description?}`;\n`duration` (seconds) is the piece's own natural length, used when `use()`\ngets no `dur`. `build(s, props)` is a scene builder exactly like `scene()`'s\nown — it adds clips with `s.text`\u002F`s.rect`\u002Fcraft helpers\u002Fnested `use()` the\nusual way; `use()` folds everything the build left at the enclosing scope\ninto one group, the way `pill()` folds its own dot+label+plate.\n\n```js\n\u002F\u002F fragment\nconst Badge = component(\"Badge\", {\n  props: {\n    label: { type: \"string\", default: \"New\" },\n    tone: { type: \"color\", default: \"#34d399\" }\n  },\n  duration: 1\n}, (s, p) => {\n  s.pill(p.label, { fillColor: p.tone });\n});\n\nv.scene(\"Hero\", 3, (s) => {\n  s.use(Badge, { label: \"Live now\" }, { at: 0.5 });\n});\n```\n\n`use()` checks `propsIn` against `Comp.props` and fills defaults, throwing\nand naming the offending prop on a type mismatch or an unknown name — the\nsame failure a bad `caret`\u002F`align` value gets from the type declarations\nbelow.\n\n### Saving a component as a composition\n\n`Comp.saveAsComposition(nodetool.timelines, {width, height, fps, palette?,\nfonts?, name?, description?})` bridges a component into the editor's\ncomposition system (`list_compositions`\u002F`get_composition`\u002F\n`insert_composition`): it builds `Comp` at its prop defaults into a scratch\ntimeline, then rebuilds it once per prop with a value distinct from that\ndefault and diffs the two builds to find the one JSON pointer\n(`packages\u002Ftimeline\u002Fsrc\u002Fcomposition.ts`'s `path`) that prop reaches — the\nsame field a hand-written `save_composition` call would have to name. It\nrequires `{width, height, fps}` because a bare `component()` descriptor\ncarries none of its own; a call with no matching field found (unused,\nreaching more than one field, or the prop only toggles whether a field\nexists at all rather than setting its value) leaves that prop out of the\nsaved composition and lists it in `skippedParams` rather than saving a\npointer that would write the wrong thing.\n\n**A nested `stack`\u002F`row` inside a component round-trips too.** A composition\ncaptures the group's whole descendant subtree, not just its direct\nchildren, so a card holding a row of icons saves and re-inserts with the\nrow's own children intact and correctly nested. `saveAsComposition`'s prop\nprobing walks the same subtree, so a prop reaching into a nested container's\nfield still gets a pointer — only a prop with no single-field effect\n(unused, structural, or toggling whether a field exists rather than setting\nit) ends up in `skippedParams`.\n\n## Charts\n\nMotion graphics are often data. Every chart is built from the same shapes\nand text everything else uses — bars, a line, a filled area, a ring — with\ngrowth, staggering, and a value that counts up baked in, so it composes with\n`s.stack`\u002F`s.row`\u002Fparenting like any other element. Each returns `{group,\n...pieces}`: move\u002Fparent `group` like any other clip; the pieces (`bars`,\n`line`, `segments`, …) are the real shapes and labels for anything you want\nto touch individually.\n\n| Call | Makes |\n|---|---|\n| `s.barChart(data, o?)` | bars that grow from the baseline (staggered), each with a value label that counts up and finishes inside its own bar's growth window. `data`: `[number, ...]` or `[{value, label}, ...]`. `o`: `w`, `h`, `orientation` `\"vertical\"\\|\"horizontal\"`, `gap`, `rounded`, `labels`\u002F`axisLabels` (on\u002Foff), `stagger`, `at`, `dur`, `ease`, `highlight` (index), `color`, `palette`, `format` |\n| `s.lineChart(series, o?)` | a line that draws on (`trimEnd`), points scaled into a `w`×`h` box, optional dot markers, an end value that counts from the first point to the last. `series`: `[number, ...]` or `[{x, y}, ...]` |\n| `s.areaChart(series, o?)` | `lineChart`'s filled sibling — the same points close into a baseline-filled shape that grows up from the bottom, with an optional stroked line drawn on top |\n| `s.donut(data, o?)` | a ring, one stroked arc per datum sweeping in from 12 o'clock, staggered; a center label counts up to the total. `o`: `d` (diameter), `thickness`, `gap` (degrees between segments), `highlight`, `palette` |\n| `s.statCounter(value, o?)` | a single number that counts up — `barChart`'s value-label building block, standalone for a callout number that isn't part of a chart |\n\n```js\n\u002F\u002F fragment\ns.barChart([420, 680, 1150], { at: 0.2, stagger: 0.08, highlight: 2, format: { prefix: \"$\" } });\ns.donut([{ value: 62, label: \"Rent\" }, { value: 38, label: \"Everything else\" }], { highlight: 0 });\n```\n\n## Top-level adjustments and audio\n\n`v.adjust(effects, o)` runs after `v.series()`. It places a timed adjustment\nlayer in absolute video seconds (`o.at`, `o.dur`, default the whole video) on\nits own track above every scene bank, so it always sees the full composite —\na whole-video finish (grain\u002Fvignette), or a short local burst at a cut (a\nglitch spanning both sides of a hard cut). Give two calls that can overlap in\ntime distinct `o.trackId` values; one video track cannot hold two overlapping\nclips.\n\n`v.audio(assetId, o)` places an audio clip in absolute video seconds (`o.at`,\n`o.dur`, default the whole video) on its own audio track (default `t_audio`)\n— a score, a countdown, a narration bed spanning (part of) the series. Same\nfriendly fields as a scene's `s.audio()`: `o.volume`, `o.fadeIn`, `o.fadeOut`,\n`o.mute`. `v.music(assetId, o)` is `v.audio` on its own `t_music` track, so a\nscore and a narration bed placed separately never collide; give either call\n`o.trackId` to land somewhere else. Both also run after `v.series()`.\n\n`v.document({camera2d, trackFolders, tempo})` sets extra top-level document\nfields verbatim, applied before save.\n\n`v.durationMs` is the video's total duration in ms, set by `v.series()` —\nread it instead of computing your own total from scene durations.\n\n## Audio-reactive motion\n\n`el.react(audioClip, o)` drives one property from a piece of audio, with no\nper-frame JS: it records the request, and `v.save()` bakes it onto the clip\nright after the document is written, through `bake_audio_animation` (the\nsame op `nodetool.timelines.bakeAudioAnimation` exposes directly). It\ncomposes with a hand-picked entrance the way two animations on the same\nproperty always do (they multiply), never replacing it. `audioClip` is the\nclip `s.audio()`\u002F`v.audio()` returned — pass the element, not an asset id.\n\n```js\n\u002F\u002F fragment\nconst kick = s.audio(kickAssetId, { name: \"kick\" });\nconst title = s.text(\"DROP\", { size: 120 });\ntitle.react(kick, { prop: \"scale\", mode: \"beats\", range: [1, 1.3], smooth: 0.05 });\n```\n\n`o.prop`: `\"scale\"|\"opacity\"|\"offsetX\"|\"offsetY\"`. `o.mode`: `\"envelope\"`\n(follows loudness continuously, the default) or `\"beats\"` (one pulse per\ndetected onset). `o.range`: `[quiet, loud]`, defaulted per property.\n`o.gain` (sensitivity), `o.smooth` (seconds, sets both `attack`\u002F`release`),\n`o.offset` (seconds, shifts the whole curve), `o.replace` (default true).\n\n**No frequency band.** `bake_audio_animation` measures the full mix\n(`envelope`) or its onsets (`beats`) — there is no band-pass filter behind\nit, so `o.band` throws rather than silently reacting to the wrong thing.\nIsolate that range in the source audio first if a cut needs it.\n\n## Hand-written motion and shape morphs\n\n`el.expr(fn, {at, dur, role})` bakes a hand-written motion function to a\nkeyframe-per-frame custom animation at authoring time — nothing runs at\nrender time. `fn(t, {p, frame, fps})` is sampled once per frame across the\nwindow: `t` is seconds local to the window, `p` its 0..1 progress. `fn`\nreturns an object of animatable properties (`opacity`, `offsetX`, `scale`,\n…) and\u002For style-track targets (any key with a `.`, e.g. `\"text.color\"`,\n`\"shape.fill\"`). A property whose samples never change emits no curve;\na curve that does change is reduced to the fewest keyframes a straight-line\ninterpolation still reproduces within a small tolerance — a linear ramp\ncollapses to two keyframes, a sine keeps enough to stay recognizably a sine.\n\n```js\n\u002F\u002F fragment\nbar.expr((t) => ({ offsetY: Math.sin(t * Math.PI * 2) * 12 }), { at: 0, dur: 2 }); \u002F\u002F a gentle bob\n```\n\n`s.noise(seed)` returns a deterministic 1D value-noise function — no\n`Math.random`, so the same script produces the same motion every run.\n`s.noise(seed)(x)` is a smooth 0..1 value; feed it an increasing `x` (`t`, or\n`frame`) inside an `expr()` for organic jitter that never repeats:\n\n```js\n\u002F\u002F fragment\nconst jitter = s.noise(7);\nleaf.expr((t) => ({ rotation: (jitter(t * 4) - 0.5) * 0.2 }), { dur: 3 });\n```\n\n`el.morph(toPoints, {at, dur, ease})` morphs a path shape's outline toward\n`toPoints` (the same point commands `s.path()` takes) via a `shape.d` style\ntrack. Only straight (`M`\u002F`L`\u002F`Z`) paths morph — the document only\ninterpolates a style track when both paths share the same command sequence\nand token count, so `morph()` resamples the clip's own current outline and\nthe target to the same vertex count by even arc length first, then rewrites\nthe clip's own `shapeStyle.d` to that resampled start shape so the morph's\nfirst frame matches what was already on screen. A curved path (`C`\u002F`A`\u002F…)\nthrows rather than authoring an incompatible morph — approximate it with more\n`L` segments first:\n\n```js\n\u002F\u002F fragment\nconst mark = s.path([[\"M\", -50, -50], [\"L\", 50, -50], [\"L\", 0, 50], [\"Z\"]], { fill: MINT }); \u002F\u002F a triangle\nmark.morph(starPoints, { at: 0.2, dur: 0.5, ease: \"out\" }); \u002F\u002F -> a six-point star\n```\n\n## Midi and a beat grid\n\n`v.midi(trackId, notes, o)` places a midi clip in absolute video seconds\n(`o.at`, `o.dur`, default the whole video) on its own midi track, creating\nthat track the first time `trackId` is seen. `o.instrument` is a preset id\n(`\"bl1-acid\"`, `\"dr1-tr-void\"`) or a full instrument object;\n`set_timeline_document` resolves the shorthand. `notes` is\n`[beat, pitch, lenBeats?, velocity?]` tuples — musical time, the way a score\nis written, independent of where the clip itself sits:\n\n```js\n\u002F\u002F fragment\nv.midi(\"t_drums\", [[0, 36, 0.25, 110], [1, 39, 0.25, 90]], { instrument: \"dr1-tr-void\" });\nv.midi(\"t_bass\", bassNotes, { instrument: \"bl1-acid\" });\n```\n\n`v.beats({bpm, offset, count, snap, timeSignature})` sets the document's\n`tempo` (so midi and beat-driven motion play at `bpm`) and returns edit ops\nfor `v.save`'s `ops`: a marker per beat, then — only when `snap` names clip\nids — those clips' starts snapped onto the grid:\n\n```js\n\u002F\u002F fragment\nconst saved = await v.save(nodetool.timelines, { name: \"Cut\", ops: v.beats({ bpm: 120, snap: [\"t_drums\"] }) });\n```\n\n**`v._document` is not part of this API.** It is the assembled document\n`v.series()` builds and `v.save()` sends — read-only bookkeeping, not an\nextension point. `v.adjust()`\u002F`v.audio()`\u002F`v.music()`\u002F`v.document()` are the\nonly sanctioned ways to add anything after `v.series()`; mutating `v._document`\ndirectly (pushing a clip, editing a track) skips the field-filling and\nvalidation the rest of this API relies on, and the field can be renamed or\nremoved without notice.\n\n## Saving\n\n`v.save(timelines, {name, showcase, ops, timeline_id})` writes the document\nwith one `setDocument` (which snapshots the prior state first, so the write\nis undoable), runs `ops` with one `edit`, validates (with `tier: \"showcase\"`\nwhen `showcase: true`), and returns `{timeline_id, errors, warnings}`. It\nthrows on a refused write, a failed op, or a hard validation error; once the\ntimeline row exists, the thrown message names its id — repair that timeline\nwith `setDocument`\u002F`edit` instead of calling `save()` again, which would leave\na duplicate row behind. Pass the script's own `nodetool.timelines` as\n`timelines`: a module cannot see the belt the script body has.\n\nPass `timeline_id` to write into a timeline that already exists instead of\nmaking another — the way to revise a cut without duplicating it.\n\n## Revise by editing the script\n\n`v.save()` stores the code that rebuilds the timeline on its\n`document.source`, whatever else the action called. It is not the script as\nwritten: it is the **retained program** — the scene callbacks and the\ndeclarations they use, as source, and every value they read from anything\nelse (a research result, a generated asset id, a loop variable) as a literal.\nA fetch, a generation or a memory write ran once, in your action; the stored\nprogram holds only its result, so a rebake never repeats it. `v.save()`\nattaches the program only when baking it gives exactly the saved document,\nand answers `saved.code: {embedded, warnings}`.\n\nThe program is not attached, and `saved.code.warnings` says why, when a scene\ncallback:\n\n- calls a capability (`nodetool.*`). Call it at the top level, before the\n  scene, and use its result.\n- uses `Math.random()` or `Date.now()`. Use `hash(n)` or `noise(seed)`, or\n  compute the value at the top level.\n- reads a value that cannot be written as data (a class instance, a\n  function declared inside another function).\n\nKeep helpers at the top level as `function` or `const` declarations; a\nhelper can read and change a `let` counter, and each scene gets the value the\ncounter had when it was built. When the program is not attached, or to attach\ncode after the fact, call `nodetool.timelines.code.set(timeline_id, code)`;\nthat code must build the timeline without calling a capability.\n\nRevise it by editing that stored code, not by resending the whole body:\n`code.get(id)` reads it back, `code.edit(id, edits)` applies a few small exact\nstring replacements (each `old` must match exactly once) and re-merges.\nA rebake runs no capability: to use a new research result or a new asset,\nmake the call in an action and edit the value into the code. Read the\n`conflicts` and\n`warnings` a rebake answers, then look at frames. `api-timelines` owns the\nfull call contract; `code.rebake` reruns the stored code unchanged, and\n`code.detach` stops tracking scenes.\n\n**Scene names are the identity the merge keys on.** A rebake matches this\nbuild's scenes against the timeline's current ones by `v.scene()`'s own\n`name`, not by position or content — renaming a scene is a remove of the old\nname plus an add of the new one, so anything hand-edited under the old name is\ngone and the new one reflows in as an ordinary addition. Every clip's id is\ndeterministic from its scene's name plus its order of creation in the script\n(`${sceneName}_${prefix}${n}`, `nid()` in this pack's own source) — never from\nits screen position — so two bakes of unchanged code mint identical ids and a\nchange confined to one scene never shifts another's. That is what lets a\nrebake survive without breaking the editor's selection.\n\nA hand edit — in the editor, or through `edit_timeline` — inside a scene the\ncode tracks marks that scene \"edited\": the next `code.set`\u002F`code.edit`\u002F\n`code.rebake` keeps it and reports it in `conflicts` rather than silently\noverwriting it, unless `force` (`true`, or that scene's name in an array)\nsays otherwise.\n\nShowcase warnings ride the successful return, not an exception — check\n`saved.warnings`, or a `code.*` call's own `warnings`, and render frames to\njudge what they flag.\n\n## Types\n\nThe pack ships `sandbox\u002Findex.d.ts` (its `package.json` `types` field points\nat it) — precise option types for `video`\u002F`scene`\u002F`series`\u002F`transition`,\nevery element and craft helper, the motion primitives (`typewriter`'s\n`caret` is an object, `stack`\u002F`row`'s `align` a union), and `component`\u002F`use`.\n`nodetool jsscript validate` type-checks a script against it when the pack is\ninstalled, so `typewriter({ caret: true })` fails validation naming `caret`\nbefore the script ever runs.\n\n## Gotchas\n\n- **Every time value is seconds, local to the scope that created it.** There\n  is no absolute-time option and nothing to convert by hand; `v.series()` is\n  the one place a time is ever shifted.\n- **`enter` and `exit` are always \"in\"\u002F\"out\"; there is no flip to reason\n  about.** `enter`'s target is always the property's rest pose, `exit`'s start\n  is always rest — declare the one you mean.\n- **`animate()`'s `at`\u002F`dur` are always clip-local seconds from the clip's own\n  start, whatever role it ends up with.** A curve shaped like an exit\n  (trailing away from every property's rest pose) auto-picks `role: \"out\"`,\n  the same as passing it explicitly; either way, `at`\u002F`dur` still mean \"starts\n  `at` seconds in, plays for `dur`\" — the pack converts that to the\n  backward-from-the-clip's-end delay the document format wants, the same\n  conversion `exit()` already does. Author it exactly like `enter()`; don't\n  count backward by hand.\n- **A `rotation` curve is degrees, the same unit as the friendly `rotation`\n  option on element creation.** `enter({from: {rotation: 90}})`,\n  `exit({to: {rotation: -20}})`, `animate({rotation: [0, 180]})` and\n  `loop({rotation: [0, 360]}, period)` all take degrees; the pack converts to\n  the document's radians internally. `rotationX`\u002F`rotationY` curves are\n  already degrees and need no conversion. `tx: {rotation: ...}` — the raw\n  escape hatch — stays radians, since it writes the document field directly.\n- **`stack`\u002F`row` take `align`\u002F`justify`** (Yoga `alignItems`\u002F`justifyContent`;\n  default `align: \"start\"`, `justify` unset) and place their own box in the\n  frame via `at`\u002F`anchor`, not a sibling's measured size; an unknown\n  `align`\u002F`justify` throws.\n- **`setDocument` keeps the whole document, including a field this API\n  didn't name.** Render settings such as motion blur are the exception —\n  those belong on `render(id, {…})`, not in the document.\n- **`save()` creates a new timeline only the first time.** Pass `timeline_id`\n  to write into one that already exists — or, for a code-backed timeline, run\n  the change through `code.edit`\u002F`code.rebake` instead of calling `save()`\n  again (below). Without either, every call still makes a new row; it never\n  overwrites a cut the user has open uninvited.\n","# Timelines as code\n\nSpecifier: `@nodetool-ai\u002Fsandbox-timeline`. One module. It builds a whole\ntimeline document in plain JavaScript and saves it through\n`nodetool.timelines`, so a cut with hundreds of keyframed clips costs a\nhandful of API calls instead of one `edit` op per clip. NodeTool's shipped\nexample timelines (Cadence, Kite, Prism, Voltra, Tidewater, T minus 30) are built with\nit.\n\nUse it for authored motion graphics: kinetic type, shapes, charts, placed\nstills, transitions between scenes. For a few changes to a cut that already\nexists, `nodetool.timelines.edit(id, ops)` is still the better tool.\n\n**Units are seconds, everywhere, local to the scope that created them.** A\nscene's own clock starts at 0. There is no absolute-time option — `v.series()`\nis the only place a scene's position in the whole video is decided, and it is\nthe only function that ever shifts a time. Author a moment once, at the time\nit happens in its own scene, and it is correct wherever that scene lands.\n\n## A two-scene piece\n\n```js\nimport { video } from \"@nodetool-ai\u002Fsandbox-timeline\";\n\nconst v = video({\n  width: 1920, height: 1080, fps: 30,\n  palette: { ink: \"#06110e\", ink2: \"#0c2a21\", text: \"#f4fbf8\", accent: \"#34d399\" },\n  fonts: { display: \"Space Grotesk\", body: \"Inter\" }\n});\n\nconst hello = v.scene(\"Hello\", 2.5, (s) => {\n  s.backdrop();\n  const title = s.text(\"Hello, timeline\", { size: 120, weight: 700, font: \"display\" });\n  const sub = s.text(\"built from code\", { size: 40, color: \"#8fb3a6\" });\n  s.stack([title, sub], { gap: 20 });\n  title.enter({ from: { scale: 1.2, opacity: 0 }, at: 0, dur: 0.3, ease: \"outExpo\" });\n  sub.enter({ from: { offsetY: 24, opacity: 0 }, at: 0.15, dur: 0.25 });\n  title.exit({ to: { opacity: 0 }, dur: 0.2 });\n});\n\nconst outro = v.scene(\"Outro\", 1.5, (s) => {\n  s.backdrop({ colors: [\"#0f3b2e\", \"#06110e\"] });\n  const cta = s.pill(\"Try it\", { fillColor: \"#f4fbf8\", color: \"#06110e\" });\n  cta.enter({ from: { scale: 0.6, opacity: 0 }, dur: 0.25 });\n});\n\nv.series([hello, v.transition(\"wipe\", 0.3, { direction: \"left\" }), outro]);\nv.adjust([{ type: \"vignette\", amount: 0.2 }], { name: \"finish\", trackId: \"t_finish\" });\n\nconst saved = await v.save(nodetool.timelines, { name: \"Hello\", showcase: true });\nawait output(\"timeline\", saved);   \u002F\u002F { timeline_id, errors, warnings }\n```\n\nThen look at it: `nodetool.timelines.preview(saved.timeline_id, {count: 3})`\nreturns composited frames, and `render(id, {preview_scale: 0.5})` a draft\nvideo.\n\n## Study a reference and reuse scene helpers\n\n`nodetool.timelines.examples.list()` lists shipped cuts with structural stats.\n`nodetool.timelines.examples.get(\"kite\", {clip_limit: 12})` returns its scene\ncatalog and a bounded scene excerpt. Select another `scene_id` or page with\n`clip_offset` to read more layers. Inspect the clip hierarchy, curve windows\nand effects before choosing your own scene structure.\n\n`nodetool.timelines.examples.source(\"kite\")` returns the script that made\nthat excerpt: full JavaScript, imports included.\n\n## `video({width, height, fps, palette, fonts})`\n\nThe entry point. `palette` supplies colours the craft helpers fall back to:\n`ink`, `ink2`, `text`, `dim`, `accent`. `fonts` maps short keys (`display`,\n`body`) to real family names; a text element's `font` option takes either a\nkey or a literal family string.\n\n## Scenes and series\n\n`v.scene(name, seconds, fn)` builds one scene at its own local clock, `fn(s)`\nreceiving the scene's authoring object. It returns a scene descriptor — nothing\nis placed in the document yet.\n\n`v.series([scene, transition?, scene, transition?, scene, ...])` lays scenes\nend to end and assigns every clip's absolute position. A `v.transition(type,\nseconds, opts)` item between two scenes overlaps them by its own duration and\nsets `transitionIn` on the incoming scene's group; omitting one between a pair\nmakes a hard cut. `type` is one of the document's transition types (`\"wipe\"`,\n`\"whip\"`, `\"iris\"`, `\"gradientWipe\"`, `\"crossfade\"`, `\"push\"`, `\"slide\"`,\n`\"zoom\"`, `\"zoomBlur\"`, `\"glitch\"`, `\"dipToColor\"`, `\"lightLeak\"`); `opts`\ncarries that type's own fields (`direction`, `easing`, `color`, `softness`,\n`map`, `seed`, …). Scenes are banked onto two alternating track sets so an\noverlapping pair never shares a track — you never see or name a track.\n\n`v.series` must run before `v.adjust`, `v.document` or `v.save`.\n\n## Local time nests\n\nEverything inside a scene builder is measured from that scene's own start.\n`s.seq(atSec, durSec, fn)` opens a nested local clock: `fn(q)` receives a\nscoped authoring object whose own `atSec`\u002F`durationSec` for elements and\nmotion are relative to `atSec` *inside the enclosing scope*, not to the whole\nvideo. Nest as deep as you like — the shift out to absolute time happens once,\nin `v.series()`.\n\n```js\n\u002F\u002F fragment\nv.scene(\"Beat\", 4, (s) => {\n  s.seq(1.2, 1.0, (q) => {\n    const chip = q.text(\"+$0.60\", {});\n    chip.enter({ from: { offsetY: 20, opacity: 0 }, at: 0, dur: 0.2 }); \u002F\u002F 1.2s into the scene\n  });\n});\n```\n\n## Elements\n\nEvery element is a scene method returning a clip object with motion methods\nattached. `at`\u002F`dur` (seconds, defaulting to the whole enclosing scope) narrow\nwhere in that scope the clip lives; everything else is the clip's own fields.\n\n| Call | Makes |\n|---|---|\n| `s.text(str, o)` | a text clip. `o.size`, `o.weight`, `o.color`, `o.font` (a `fonts` key or a literal family), `o.tracking` (em, a fraction of size: `-0.04` tight, `0.2` wide caps), `o.italic`, `o.anchor` `\"left\"`\u002F`\"right\"`\u002F`\"center\"`, `o.mw` max width as a frame fraction, `o.path` (text-on-path: the same point commands `s.path()` takes), `o.fill` a colour or a gradient (same as `style.fill`, below), `o.style` — passthrough for any other `textStyle` field (`lineHeight`, `verticalAlign`, `stroke`, `shadow`, `background`) — an unrecognized top-level option throws, naming it and pointing at `style` |\n| `s.rect(w, h, fill, o)`, `s.ellipse(d, fill, o)` | shape clips; `fill` a colour or a gradient `{type, angle\\|stops, ...}`; `o.r` corner radius, `o.stroke`, `o.sw` |\n| `s.path(points, o)` | an SVG path from `[[\"M\", x, y], [\"L\", x, y], …]` in px from the frame centre. `H x`\u002F`V y` take one coordinate on their own axis; `A rx ry xRotDeg largeArc sweep x y` scales the two radii as sizes and passes the angle and the two flags through unscaled |\n| `s.image(assetId, o)` | a placed still. `assetId` takes what the asset tools print (`asset:\u002F\u002F\u003Cid>.\u003Cext>`, a 12-character id, or the full id); the clip stores the bare id and `v.save()` resolves it to the full one. `package:\u002F\u002F` and `https:\u002F\u002F` locators pass through |\n| `s.video(assetId, o)`, `s.audio(assetId, o)` | a placed video or audio clip. `o.in` (seconds into the source), `o.volume` (dB), `o.fadeIn`\u002F`o.fadeOut` (seconds), `o.speed` (playback rate), `o.mute`, `o.remap` (a time remap: `[{t, sourceAt, ease?}, …]`, `t` 0..1 across the clip, `sourceAt` **seconds into the source media**, not scene-local time) |\n| `s.group(o)` | a nested group; children reparent onto it with `{parent: g.id}` |\n| `s.adjust(effects, o)` | an adjustment layer scoped to this scene — its clip's parent is the scene's own group, so it treats that scene's surface and nothing outside it (an adjustment is group-scoped by construction). This is the way to grade one scene: a per-scene duotone, a vignette that only applies to one beat |\n| `s.fill(color, o)` | a full-frame rect, same as `s.rect(W, H, color, {x:0, y:0, ...o})` |\n\n`x`\u002F`y` are px from the frame centre, or from the parent's own position when\nthe clip is reparented into a group. `rotation` (degrees) and `anchor` ({x, y}\npivot fraction, default `{0.5, 0.5}`) are friendly options for the two\n`transform` fields authored most; `tx: {extra fields}` is the raw escape\nhatch for the rest (`rotationX`\u002F`rotationY`, `perspective`, `depthPx`, …), and\na full `transform: {position, scale, rotation, anchor, depthPx, ...}` override\nstill works when nothing else fits. Every element option also takes clip\nfields as-is: `effects` (an `id`\u002F`enabled: true` an entry leaves out is filled\nin — write `{type: \"glow\", radius: 30, ...}`, not `{id: \"...\", enabled: true,\ntype: \"glow\", ...}`), `opacity`, `blendMode`, `mask` (a static crop mask —\n`ClipMask`, `{kind: \"rect\"|..., ...}` — not the wipe mask `enter()`\u002F`animate()`\ntake, below), `matte`, `crop`, `motionBlur`, `steppedTime`, `repeater`,\n`inPointMs`, `outPointMs`, `speedBaked`, `fadeInShape`, `fadeOutShape`. There\nis no field a clip carries that needs mutating after creation — anything\n`video`\u002F`audio`\u002F`text` don't name a friendly option for still passes through\nby its own document field name.\n\n## Layout containers\n\n`s.stack(children, o)` and `s.row(children, o)` build a real CSS\u002FYoga flex\ncontainer (`layout: {display: \"flex\", flexDirection: \"column\" | \"row\", gap,\nalignItems, justifyContent, padding, width, height}`) and reparent `children`\nonto it (`child.parentId = container.id`) — real nesting, not a sibling list.\nNest freely: a container can be a child of another container (a `row` of\n`stack`s, a `stack` holding a nested `row`), and the renderer's Yoga resolver\nlays out the whole tree.\n\nThe container's own placement in the frame is `o.at` (`{x, y}`, default the\nframe centre) plus `o.anchor` (default `\"center\"`). `at` is canvas-centre-relative\n— the same coordinate space every clip's own position already is: `{x: 0, y: 0}`\nis frame centre, negative `x` is left of centre, negative `y` is above it.\n`anchor` names the point of the container's own *computed* box that lands at\n`at` — `{x: 0, y: 0.5}` or the name `\"left\"` put that box's left edge at\n`at.x`, no measuring a sibling's width required. Example: on a 1920-wide\nframe, `anchor: \"left\"` with `at: {x: -860, y: -212}` puts that left edge\nnear the frame's own left margin (-860 is 960px left of centre, i.e. near\nx=100 on screen); `at: {x: 110, ...}` would instead land it just right of\ncentre. Named anchors: `\"top-left\"`, `\"top\"`, `\"top-right\"`, `\"left\"`,\n`\"center\"`, `\"right\"`, `\"bottom-left\"`, `\"bottom\"`, `\"bottom-right\"`, or pass\n`{x, y}` fractions directly. A container's own *time* window is `o.start`\u002F\n`o.dur` (seconds) — the one place in this API `at` doesn't mean seconds,\nbecause the container's placement already claims it.\n\n`o.gap` (px), `o.padding` (px, or `{top, right, bottom, left}`), `o.width`\u002F\n`o.height` (px or `\"N%\"`) size the container. `o.parent` nests it inside\nanother clip (e.g. a phone mockup) instead of the scene root. `o.wrap` turns\non `flexWrap`.\n\n`o.align` is `\"start\"` (default), `\"center\"`, `\"end\"`, `\"stretch\"` or\n`\"baseline\"` — the cross axis (`alignItems`): a row's shared y, a stack's\nshared x. `o.justify` is `\"start\"`, `\"center\"`, `\"end\"`, `\"between\"`,\n`\"around\"` or `\"evenly\"` — the main axis (`justifyContent`), unset by default\n(children pack at the start with the authored gap). A `stack`\u002F`row` call with\nan unknown `align`\u002F`justify` throws, naming the value.\n\nA child's own flex sizing\u002Fplacement is `o.flexItem` on that child's own call\n(`grow`, `shrink`, `basis`, `alignSelf`, `width`, `height`, `margin`,\n`position: \"absolute\"`, `inset`) — pass it through any element's own options,\ne.g. `s.rect(..., { flexItem: { grow: 1 } })`. `s.rect`\u002F`s.ellipse` also take\n`absolute: true` as sugar for `flexItem: {position: \"absolute\", inset: 0}` —\ntaken out of flow and resized to fill its flex parent's box exactly, which is\nhow a pill's plate or a card's backdrop sits behind its content: create the\nbackground *before* the foreground children (so its `_z` draws below), then\nreparent it onto the container.\n\n**A leaf's flex-measured size is its own content, never a guessed line\nheight** — a text child reflows to whatever width Yoga offers, and a text's\nown `mw` does nothing once it sits inside a `stack`\u002F`row`: its width comes\nfrom the container, not from itself, so don't pass `mw` to a text child of a\ncontainer — leave it unset there. `mw` still matters on a standalone text (one\nplaced directly with `at`\u002F`x`\u002F`y`, no enclosing container); a shape\u002Fellipse's\nsize is its\nown `shapeStyle.width`\u002F`height` (unset defaults to 0, not the frame, so an\nundecorated plate doesn't force its siblings into a shrink negotiation); a\n**plain (non-flex) group nested as a leaf measures as its children's own union\nbox** — give a plain group wrapping e.g. an icon + a drawn path (each a leaf\nwith its own small authored size) an explicit `flexItem: {width, height}`\nwhen any of its children is a bare `path()` (no authored `shapeStyle.width`\u002F\n`height` of its own — `path()` never sets one), since that child's\nun-measured intrinsic size falls back to the whole frame and the group would\nmeasure as canvas-sized.\n\n`s.center(child, o)` repositions `child` directly at `o.at` (default the frame\ncentre) — for a single element, no container needed.\n\n## Motion primitives\n\nAll local to the clip's own start (`at: 0` is the moment the clip appears),\nunless `stagger()` set a default `at` for it.\n\n| Call | Does |\n|---|---|\n| `el.enter({from, at, dur, ease, mask})` | animates from `from`'s values to each property's rest pose (`opacity`\u002F`scale`\u002F`scaleX`\u002F`scaleY`\u002F`trimEnd`\u002F`wipeProgress` rest at `1`, everything else at `0`). Always an \"in\" — there is no flip to solve, because the end value is always rest. |\n| `el.exit({to, at, dur, ease})` | animates from each property's rest pose to `to`'s values. `at` defaults to the clip's own end minus `dur`. Always an \"out\". |\n| `el.animate(props, {at, dur, ease, role, mask})` | a general keyframed animation. Each `props` value is `[from, to]`, `[from, to, easing]`, or a waypoint list `[[t, value], [t, value, easing], …]` with `t` from 0 to 1 across the window. |\n| `el.loop(props, periodSec, {ease})` | a looping animation with a cycle of `periodSec`; `ease` defaults `\"linear\"` (a spin or a scroll needs constant speed). |\n| `el.count({from, to, at, dur, prefix, suffix, decimals, padTo, groupSeparator, ease})` | a ticker text animator; `padTo` zero-pads the digit count (`padTo: 2` → `\"09\"`) |\n| `el.scramble({at, dur, charset, seed, ease})` | a scramble-in text reveal (the ticker's sibling `textAnimator`) |\n| `el.tween(target, keyframes, {at, dur, by, staggerMs})` | a style track, `target` like `\"shape.fill\"`, `\"effect.\u003Cid>.amount\"` or a `glyph.*` field (`glyph.color`, `glyph.blurPx`, `glyph.trackingPx`, …); `keyframes` like `animate`'s waypoint list |\n| `el.draw({at, dur, ease})` | draw a path or stroke on, via `trimEnd` — `enter({from: {trimEnd: 0}, ...})` |\n| `el.typewriter({at, dur, caret})` | a typewriter reveal; `set_timeline_document` resolves `dur` to one reveal per character. **Replaces** the clip's animations — a typewriter is the whole entrance. `caret`: `{color, widthPx, blinkPeriodMs}` |\n| `el.preset(name, {at, dur, ease, role, ...params})` | a catalog animation baked server-side from its own curve generator, not hand-authored keyframes: `\"fade\"`, `\"slide\"`, `\"pop\"`, `\"spin\"`, `\"wipe\"`, `\"blur\"`, `\"colorFade\"`, `\"pulse\"`, `\"flash\"`, `\"shake\"`, `\"bounce\"`, `\"squash\"`, `\"kenBurns\"`, `\"float\"`, `\"breathe\"`, `\"rotate\"`, `\"hueShift\"`, `\"orbit\"`, `\"followPath\"`, `\"typewriter\"`. Every key in `o` besides `at`\u002F`dur`\u002F`ease`\u002F`role`\u002F`by`\u002F`staggerMs` is a preset param — see `PresetParamSpec[]` per preset in `packages\u002Ftimeline\u002Fsrc\u002Fanimation\u002Fpresets.ts` for names, defaults and ranges |\n\n`enter`\u002F`animate`\u002F`count`\u002F`tween` take `by` (`\"word\"`\u002F`\"character\"`\u002F`\"line\"`)\nand `staggerMs` to stagger across the units of one text clip — a headline that\nrises in word by word, a wordmark that types in letter by letter. **A\n`glyph.*` `tween()` target needs a stagger** — the document validator refuses\none without a unit, since animating per-glyph style with no split is the\nun-staggered block case `enter`\u002F`animate` already cover. `tween()` left with\nno `by` of its own inherits the stagger of the last `enter()`\u002F`animate()` call\non the *same* clip, so a `glyph.color` tween riding the same word-by-word\nreveal as its `enter()` needs no repeated `by`:\n\n```js\n\u002F\u002F fragment\nconst title = s.text(\"Every purchase\", { anchor: \"left\" });\ntitle.enter({ from: { offsetY: 40, opacity: 0 }, by: \"word\", staggerMs: 90 });\ntitle.tween(\"glyph.color\", [[0, \"#8fb3a6\"], [1, \"#f4fbf8\"]]); \u002F\u002F inherits by: \"word\"\n```\n\n**A `wipeProgress` animation needs `mask: {direction, softness}`** — a wipe\nreveal has nowhere else to say which edge it sweeps from. Pass it on the same\n`enter()`\u002F`animate()` call that drives `wipeProgress`, not as a follow-up\nmutation:\n\n```js\n\u002F\u002F fragment\narea.animate({ wipeProgress: [0, 1] }, { at: 0.4, dur: 1.3, mask: { direction: \"left\", softness: 0.02 } });\n```\n\n`s.stagger(items, offsetSec, fn)` offsets several **already-created**\nelements' default motion `at` by `index * offsetSec`, then calls `fn(item,\nindex)`:\n\n```js\n\u002F\u002F fragment\nconst words = [\"Round-ups\", \"on\", \"every\", \"card\"].map((w) => s.text(w, { anchor: \"left\" }));\ns.stagger(words, 0.06, (w) => w.enter({ from: { offsetY: 40, opacity: 0 } }));\n```\n\n`ease` names: `\"in\"`, `\"out\"`, `\"inOut\"`, `\"outExpo\"`, `\"inExpo\"`, `\"linear\"`,\nor a raw curve string such as `\"spring(170,16,1)\"` or\n`\"cubic-bezier(0.65,0,0.35,1)\"`.\n\n## Craft\n\nScene methods for the recurring structural moves. Every helper takes seconds\nand px like everything else, and every option has a default, so\n`s.backdrop()` alone renders a full bleed. `palette` supplies the colours a\ncall does not override.\n\n| Helper | Signature | Makes |\n|---|---|---|\n| `s.backdrop(o?)` | `{colors: [a, b], opacity, seed}` | full-frame ink base + an animated `gradientField` wash |\n| `s.glow(o?)` | `{size, alpha, color, ...}` | radial glow fading to transparent |\n| `s.flash(o?)` | `{at, dur, peak, color}` | full-frame screen-blend flash, peak to 0 |\n| `s.kicker(str, o?)` | `{x, y, at, dur, size, weight, color, font}` | uppercase label, left-wipe entrance |\n| `s.pill(label, o?)` | `{size, weight, color, fillColor, stroke, dot, shadow, padX, padY, x, y, anchor, at, dur, font}` | a flex row (optional leading dot + label) over an absolute inset-0 background plate, optional leading dot |\n| `s.streaks(o?)` | `{count, colors, rotationDeg, opacity}` | phase-shifted repeater bars racing off frame |\n| `s.finish(o?)` | `{vignette, softness, grain, seed, saturation, contrast}` | scene-scoped grain + vignette adjustment |\n\n**`s.backdrop({colors: [a, b]})` uses `a` twice** — as the solid base rect\nunderneath, and as the first stop of the animated `gradientField` wash on top\nof it. There is no separate base colour: pass `colors: [a, b]` to mean \"base\nand wash both start at `a`, wash drifts toward `b`\", not \"a solid `a` behind a\n`b`-to-something wash\".\n\nA slam, a rise, or a grow are `el.enter()`\u002F`el.animate()` calls with the right\n`from`\u002Fprops — there is no separate name for them:\n\n```js\n\u002F\u002F fragment\ntitle.enter({ from: { scale: 1.35, blur: 26, opacity: 0 }, dur: 0.27, ease: \"outExpo\" }); \u002F\u002F slam\nsub.enter({ from: { offsetY: 24, opacity: 0 }, dur: 0.3 });                                     \u002F\u002F rise\nbar.animate({ scaleY: [0, 1], offsetY: [h \u002F 2, 0] }, { dur: 0.4, ease: \"out\" });           \u002F\u002F grow from its base\n```\n\n## Components\n\n`component(name, {props, duration}, (s, props) => {...})` — a reusable piece\n(a lower third, a stat card, a CTA end card) with typed props, used inside a\nscene with `s.use(Comp, {...props}, {at, dur})`. `props` maps a name to\n`{type: \"string\"|\"number\"|\"color\"|\"boolean\", default, description?}`;\n`duration` (seconds) is the piece's own natural length, used when `use()`\ngets no `dur`. `build(s, props)` is a scene builder exactly like `scene()`'s\nown — it adds clips with `s.text`\u002F`s.rect`\u002Fcraft helpers\u002Fnested `use()` the\nusual way; `use()` folds everything the build left at the enclosing scope\ninto one group, the way `pill()` folds its own dot+label+plate.\n\n```js\n\u002F\u002F fragment\nconst Badge = component(\"Badge\", {\n  props: {\n    label: { type: \"string\", default: \"New\" },\n    tone: { type: \"color\", default: \"#34d399\" }\n  },\n  duration: 1\n}, (s, p) => {\n  s.pill(p.label, { fillColor: p.tone });\n});\n\nv.scene(\"Hero\", 3, (s) => {\n  s.use(Badge, { label: \"Live now\" }, { at: 0.5 });\n});\n```\n\n`use()` checks `propsIn` against `Comp.props` and fills defaults, throwing\nand naming the offending prop on a type mismatch or an unknown name — the\nsame failure a bad `caret`\u002F`align` value gets from the type declarations\nbelow.\n\n### Saving a component as a composition\n\n`Comp.saveAsComposition(nodetool.timelines, {width, height, fps, palette?,\nfonts?, name?, description?})` bridges a component into the editor's\ncomposition system (`list_compositions`\u002F`get_composition`\u002F\n`insert_composition`): it builds `Comp` at its prop defaults into a scratch\ntimeline, then rebuilds it once per prop with a value distinct from that\ndefault and diffs the two builds to find the one JSON pointer\n(`packages\u002Ftimeline\u002Fsrc\u002Fcomposition.ts`'s `path`) that prop reaches — the\nsame field a hand-written `save_composition` call would have to name. It\nrequires `{width, height, fps}` because a bare `component()` descriptor\ncarries none of its own; a call with no matching field found (unused,\nreaching more than one field, or the prop only toggles whether a field\nexists at all rather than setting its value) leaves that prop out of the\nsaved composition and lists it in `skippedParams` rather than saving a\npointer that would write the wrong thing.\n\n**A nested `stack`\u002F`row` inside a component round-trips too.** A composition\ncaptures the group's whole descendant subtree, not just its direct\nchildren, so a card holding a row of icons saves and re-inserts with the\nrow's own children intact and correctly nested. `saveAsComposition`'s prop\nprobing walks the same subtree, so a prop reaching into a nested container's\nfield still gets a pointer — only a prop with no single-field effect\n(unused, structural, or toggling whether a field exists rather than setting\nit) ends up in `skippedParams`.\n\n## Charts\n\nMotion graphics are often data. Every chart is built from the same shapes\nand text everything else uses — bars, a line, a filled area, a ring — with\ngrowth, staggering, and a value that counts up baked in, so it composes with\n`s.stack`\u002F`s.row`\u002Fparenting like any other element. Each returns `{group,\n...pieces}`: move\u002Fparent `group` like any other clip; the pieces (`bars`,\n`line`, `segments`, …) are the real shapes and labels for anything you want\nto touch individually.\n\n| Call | Makes |\n|---|---|\n| `s.barChart(data, o?)` | bars that grow from the baseline (staggered), each with a value label that counts up and finishes inside its own bar's growth window. `data`: `[number, ...]` or `[{value, label}, ...]`. `o`: `w`, `h`, `orientation` `\"vertical\"\\|\"horizontal\"`, `gap`, `rounded`, `labels`\u002F`axisLabels` (on\u002Foff), `stagger`, `at`, `dur`, `ease`, `highlight` (index), `color`, `palette`, `format` |\n| `s.lineChart(series, o?)` | a line that draws on (`trimEnd`), points scaled into a `w`×`h` box, optional dot markers, an end value that counts from the first point to the last. `series`: `[number, ...]` or `[{x, y}, ...]` |\n| `s.areaChart(series, o?)` | `lineChart`'s filled sibling — the same points close into a baseline-filled shape that grows up from the bottom, with an optional stroked line drawn on top |\n| `s.donut(data, o?)` | a ring, one stroked arc per datum sweeping in from 12 o'clock, staggered; a center label counts up to the total. `o`: `d` (diameter), `thickness`, `gap` (degrees between segments), `highlight`, `palette` |\n| `s.statCounter(value, o?)` | a single number that counts up — `barChart`'s value-label building block, standalone for a callout number that isn't part of a chart |\n\n```js\n\u002F\u002F fragment\ns.barChart([420, 680, 1150], { at: 0.2, stagger: 0.08, highlight: 2, format: { prefix: \"$\" } });\ns.donut([{ value: 62, label: \"Rent\" }, { value: 38, label: \"Everything else\" }], { highlight: 0 });\n```\n\n## Top-level adjustments and audio\n\n`v.adjust(effects, o)` runs after `v.series()`. It places a timed adjustment\nlayer in absolute video seconds (`o.at`, `o.dur`, default the whole video) on\nits own track above every scene bank, so it always sees the full composite —\na whole-video finish (grain\u002Fvignette), or a short local burst at a cut (a\nglitch spanning both sides of a hard cut). Give two calls that can overlap in\ntime distinct `o.trackId` values; one video track cannot hold two overlapping\nclips.\n\n`v.audio(assetId, o)` places an audio clip in absolute video seconds (`o.at`,\n`o.dur`, default the whole video) on its own audio track (default `t_audio`)\n— a score, a countdown, a narration bed spanning (part of) the series. Same\nfriendly fields as a scene's `s.audio()`: `o.volume`, `o.fadeIn`, `o.fadeOut`,\n`o.mute`. `v.music(assetId, o)` is `v.audio` on its own `t_music` track, so a\nscore and a narration bed placed separately never collide; give either call\n`o.trackId` to land somewhere else. Both also run after `v.series()`.\n\n`v.document({camera2d, trackFolders, tempo})` sets extra top-level document\nfields verbatim, applied before save.\n\n`v.durationMs` is the video's total duration in ms, set by `v.series()` —\nread it instead of computing your own total from scene durations.\n\n## Audio-reactive motion\n\n`el.react(audioClip, o)` drives one property from a piece of audio, with no\nper-frame JS: it records the request, and `v.save()` bakes it onto the clip\nright after the document is written, through `bake_audio_animation` (the\nsame op `nodetool.timelines.bakeAudioAnimation` exposes directly). It\ncomposes with a hand-picked entrance the way two animations on the same\nproperty always do (they multiply), never replacing it. `audioClip` is the\nclip `s.audio()`\u002F`v.audio()` returned — pass the element, not an asset id.\n\n```js\n\u002F\u002F fragment\nconst kick = s.audio(kickAssetId, { name: \"kick\" });\nconst title = s.text(\"DROP\", { size: 120 });\ntitle.react(kick, { prop: \"scale\", mode: \"beats\", range: [1, 1.3], smooth: 0.05 });\n```\n\n`o.prop`: `\"scale\"|\"opacity\"|\"offsetX\"|\"offsetY\"`. `o.mode`: `\"envelope\"`\n(follows loudness continuously, the default) or `\"beats\"` (one pulse per\ndetected onset). `o.range`: `[quiet, loud]`, defaulted per property.\n`o.gain` (sensitivity), `o.smooth` (seconds, sets both `attack`\u002F`release`),\n`o.offset` (seconds, shifts the whole curve), `o.replace` (default true).\n\n**No frequency band.** `bake_audio_animation` measures the full mix\n(`envelope`) or its onsets (`beats`) — there is no band-pass filter behind\nit, so `o.band` throws rather than silently reacting to the wrong thing.\nIsolate that range in the source audio first if a cut needs it.\n\n## Hand-written motion and shape morphs\n\n`el.expr(fn, {at, dur, role})` bakes a hand-written motion function to a\nkeyframe-per-frame custom animation at authoring time — nothing runs at\nrender time. `fn(t, {p, frame, fps})` is sampled once per frame across the\nwindow: `t` is seconds local to the window, `p` its 0..1 progress. `fn`\nreturns an object of animatable properties (`opacity`, `offsetX`, `scale`,\n…) and\u002For style-track targets (any key with a `.`, e.g. `\"text.color\"`,\n`\"shape.fill\"`). A property whose samples never change emits no curve;\na curve that does change is reduced to the fewest keyframes a straight-line\ninterpolation still reproduces within a small tolerance — a linear ramp\ncollapses to two keyframes, a sine keeps enough to stay recognizably a sine.\n\n```js\n\u002F\u002F fragment\nbar.expr((t) => ({ offsetY: Math.sin(t * Math.PI * 2) * 12 }), { at: 0, dur: 2 }); \u002F\u002F a gentle bob\n```\n\n`s.noise(seed)` returns a deterministic 1D value-noise function — no\n`Math.random`, so the same script produces the same motion every run.\n`s.noise(seed)(x)` is a smooth 0..1 value; feed it an increasing `x` (`t`, or\n`frame`) inside an `expr()` for organic jitter that never repeats:\n\n```js\n\u002F\u002F fragment\nconst jitter = s.noise(7);\nleaf.expr((t) => ({ rotation: (jitter(t * 4) - 0.5) * 0.2 }), { dur: 3 });\n```\n\n`el.morph(toPoints, {at, dur, ease})` morphs a path shape's outline toward\n`toPoints` (the same point commands `s.path()` takes) via a `shape.d` style\ntrack. Only straight (`M`\u002F`L`\u002F`Z`) paths morph — the document only\ninterpolates a style track when both paths share the same command sequence\nand token count, so `morph()` resamples the clip's own current outline and\nthe target to the same vertex count by even arc length first, then rewrites\nthe clip's own `shapeStyle.d` to that resampled start shape so the morph's\nfirst frame matches what was already on screen. A curved path (`C`\u002F`A`\u002F…)\nthrows rather than authoring an incompatible morph — approximate it with more\n`L` segments first:\n\n```js\n\u002F\u002F fragment\nconst mark = s.path([[\"M\", -50, -50], [\"L\", 50, -50], [\"L\", 0, 50], [\"Z\"]], { fill: MINT }); \u002F\u002F a triangle\nmark.morph(starPoints, { at: 0.2, dur: 0.5, ease: \"out\" }); \u002F\u002F -> a six-point star\n```\n\n## Midi and a beat grid\n\n`v.midi(trackId, notes, o)` places a midi clip in absolute video seconds\n(`o.at`, `o.dur`, default the whole video) on its own midi track, creating\nthat track the first time `trackId` is seen. `o.instrument` is a preset id\n(`\"bl1-acid\"`, `\"dr1-tr-void\"`) or a full instrument object;\n`set_timeline_document` resolves the shorthand. `notes` is\n`[beat, pitch, lenBeats?, velocity?]` tuples — musical time, the way a score\nis written, independent of where the clip itself sits:\n\n```js\n\u002F\u002F fragment\nv.midi(\"t_drums\", [[0, 36, 0.25, 110], [1, 39, 0.25, 90]], { instrument: \"dr1-tr-void\" });\nv.midi(\"t_bass\", bassNotes, { instrument: \"bl1-acid\" });\n```\n\n`v.beats({bpm, offset, count, snap, timeSignature})` sets the document's\n`tempo` (so midi and beat-driven motion play at `bpm`) and returns edit ops\nfor `v.save`'s `ops`: a marker per beat, then — only when `snap` names clip\nids — those clips' starts snapped onto the grid:\n\n```js\n\u002F\u002F fragment\nconst saved = await v.save(nodetool.timelines, { name: \"Cut\", ops: v.beats({ bpm: 120, snap: [\"t_drums\"] }) });\n```\n\n**`v._document` is not part of this API.** It is the assembled document\n`v.series()` builds and `v.save()` sends — read-only bookkeeping, not an\nextension point. `v.adjust()`\u002F`v.audio()`\u002F`v.music()`\u002F`v.document()` are the\nonly sanctioned ways to add anything after `v.series()`; mutating `v._document`\ndirectly (pushing a clip, editing a track) skips the field-filling and\nvalidation the rest of this API relies on, and the field can be renamed or\nremoved without notice.\n\n## Saving\n\n`v.save(timelines, {name, showcase, ops, timeline_id})` writes the document\nwith one `setDocument` (which snapshots the prior state first, so the write\nis undoable), runs `ops` with one `edit`, validates (with `tier: \"showcase\"`\nwhen `showcase: true`), and returns `{timeline_id, errors, warnings}`. It\nthrows on a refused write, a failed op, or a hard validation error; once the\ntimeline row exists, the thrown message names its id — repair that timeline\nwith `setDocument`\u002F`edit` instead of calling `save()` again, which would leave\na duplicate row behind. Pass the script's own `nodetool.timelines` as\n`timelines`: a module cannot see the belt the script body has.\n\nPass `timeline_id` to write into a timeline that already exists instead of\nmaking another — the way to revise a cut without duplicating it.\n\n## Revise by editing the script\n\n`v.save()` stores the code that rebuilds the timeline on its\n`document.source`, whatever else the action called. It is not the script as\nwritten: it is the **retained program** — the scene callbacks and the\ndeclarations they use, as source, and every value they read from anything\nelse (a research result, a generated asset id, a loop variable) as a literal.\nA fetch, a generation or a memory write ran once, in your action; the stored\nprogram holds only its result, so a rebake never repeats it. `v.save()`\nattaches the program only when baking it gives exactly the saved document,\nand answers `saved.code: {embedded, warnings}`.\n\nThe program is not attached, and `saved.code.warnings` says why, when a scene\ncallback:\n\n- calls a capability (`nodetool.*`). Call it at the top level, before the\n  scene, and use its result.\n- uses `Math.random()` or `Date.now()`. Use `hash(n)` or `noise(seed)`, or\n  compute the value at the top level.\n- reads a value that cannot be written as data (a class instance, a\n  function declared inside another function).\n\nKeep helpers at the top level as `function` or `const` declarations; a\nhelper can read and change a `let` counter, and each scene gets the value the\ncounter had when it was built. When the program is not attached, or to attach\ncode after the fact, call `nodetool.timelines.code.set(timeline_id, code)`;\nthat code must build the timeline without calling a capability.\n\nRevise it by editing that stored code, not by resending the whole body:\n`code.get(id)` reads it back, `code.edit(id, edits)` applies a few small exact\nstring replacements (each `old` must match exactly once) and re-merges.\nA rebake runs no capability: to use a new research result or a new asset,\nmake the call in an action and edit the value into the code. Read the\n`conflicts` and\n`warnings` a rebake answers, then look at frames. `api-timelines` owns the\nfull call contract; `code.rebake` reruns the stored code unchanged, and\n`code.detach` stops tracking scenes.\n\n**Scene names are the identity the merge keys on.** A rebake matches this\nbuild's scenes against the timeline's current ones by `v.scene()`'s own\n`name`, not by position or content — renaming a scene is a remove of the old\nname plus an add of the new one, so anything hand-edited under the old name is\ngone and the new one reflows in as an ordinary addition. Every clip's id is\ndeterministic from its scene's name plus its order of creation in the script\n(`${sceneName}_${prefix}${n}`, `nid()` in this pack's own source) — never from\nits screen position — so two bakes of unchanged code mint identical ids and a\nchange confined to one scene never shifts another's. That is what lets a\nrebake survive without breaking the editor's selection.\n\nA hand edit — in the editor, or through `edit_timeline` — inside a scene the\ncode tracks marks that scene \"edited\": the next `code.set`\u002F`code.edit`\u002F\n`code.rebake` keeps it and reports it in `conflicts` rather than silently\noverwriting it, unless `force` (`true`, or that scene's name in an array)\nsays otherwise.\n\nShowcase warnings ride the successful return, not an exception — check\n`saved.warnings`, or a `code.*` call's own `warnings`, and render frames to\njudge what they flag.\n\n## Types\n\nThe pack ships `sandbox\u002Findex.d.ts` (its `package.json` `types` field points\nat it) — precise option types for `video`\u002F`scene`\u002F`series`\u002F`transition`,\nevery element and craft helper, the motion primitives (`typewriter`'s\n`caret` is an object, `stack`\u002F`row`'s `align` a union), and `component`\u002F`use`.\n`nodetool jsscript validate` type-checks a script against it when the pack is\ninstalled, so `typewriter({ caret: true })` fails validation naming `caret`\nbefore the script ever runs.\n\n## Gotchas\n\n- **Every time value is seconds, local to the scope that created it.** There\n  is no absolute-time option and nothing to convert by hand; `v.series()` is\n  the one place a time is ever shifted.\n- **`enter` and `exit` are always \"in\"\u002F\"out\"; there is no flip to reason\n  about.** `enter`'s target is always the property's rest pose, `exit`'s start\n  is always rest — declare the one you mean.\n- **`animate()`'s `at`\u002F`dur` are always clip-local seconds from the clip's own\n  start, whatever role it ends up with.** A curve shaped like an exit\n  (trailing away from every property's rest pose) auto-picks `role: \"out\"`,\n  the same as passing it explicitly; either way, `at`\u002F`dur` still mean \"starts\n  `at` seconds in, plays for `dur`\" — the pack converts that to the\n  backward-from-the-clip's-end delay the document format wants, the same\n  conversion `exit()` already does. Author it exactly like `enter()`; don't\n  count backward by hand.\n- **A `rotation` curve is degrees, the same unit as the friendly `rotation`\n  option on element creation.** `enter({from: {rotation: 90}})`,\n  `exit({to: {rotation: -20}})`, `animate({rotation: [0, 180]})` and\n  `loop({rotation: [0, 360]}, period)` all take degrees; the pack converts to\n  the document's radians internally. `rotationX`\u002F`rotationY` curves are\n  already degrees and need no conversion. `tx: {rotation: ...}` — the raw\n  escape hatch — stays radians, since it writes the document field directly.\n- **`stack`\u002F`row` take `align`\u002F`justify`** (Yoga `alignItems`\u002F`justifyContent`;\n  default `align: \"start\"`, `justify` unset) and place their own box in the\n  frame via `at`\u002F`anchor`, not a sibling's measured size; an unknown\n  `align`\u002F`justify` throws.\n- **`setDocument` keeps the whole document, including a field this API\n  didn't name.** Render settings such as motion blur are the exception —\n  those belong on `render(id, {…})`, not in the document.\n- **`save()` creates a new timeline only the first time.** Pass `timeline_id`\n  to write into one that already exists — or, for a code-backed timeline, run\n  the change through `code.edit`\u002F`code.rebake` instead of calling `save()`\n  again (below). Without either, every call still makes a new row; it never\n  overwrites a cut the user has open uninvited.\n",{"name":5,"description":7},"main","c7226baa82daca42a19a5855c116544f97aa8bac","packages\u002Fsandbox-packs\u002Fsandbox-timeline",91,"https:\u002F\u002Fgithub.com\u002Fnodetool-ai\u002Fnodetool","https:\u002F\u002Fnodetool.ai\u002F","https:\u002F\u002Fgithub.com\u002Fnodetool-ai","No-code AI development","2026-11-15 03:27:49",{"source":9,"skillName":5,"commands":63,"prompt":73,"zipAvailable":74},[64,67,70],{"tool":65,"command":66},"npx","npx skills add nodetool-ai\u002Fnodetool --skill sandbox-timeline",{"tool":68,"command":69},"bunx","bunx skills add nodetool-ai\u002Fnodetool --skill sandbox-timeline",{"tool":71,"command":72},"pnpm","pnpm dlx skills add nodetool-ai\u002Fnodetool --skill sandbox-timeline","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fnodetool-ai\u002Fnodetool\u002Fblob\u002Fmain\u002Fpackages\u002Fsandbox-packs\u002Fsandbox-timeline\u002FSKILL.md",true,[76,82,88,92,96],{"path":77,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":80,"sourceHtmlUrl":81},"package.json","REFERENCE","参考文档",1037,"https:\u002F\u002Fgithub.com\u002Fnodetool-ai\u002Fnodetool\u002Fblob\u002Fmain\u002Fpackages\u002Fsandbox-packs\u002Fsandbox-timeline\u002Fpackage.json",{"path":83,"resourceType":84,"resourceTypeDesc":85,"sizeBytes":86,"sourceHtmlUrl":87},"sandbox\u002Fcharts.js","SCRIPT","脚本",14323,"https:\u002F\u002Fgithub.com\u002Fnodetool-ai\u002Fnodetool\u002Fblob\u002Fmain\u002Fpackages\u002Fsandbox-packs\u002Fsandbox-timeline\u002Fsandbox\u002Fcharts.js",{"path":89,"resourceType":84,"resourceTypeDesc":85,"sizeBytes":90,"sourceHtmlUrl":91},"sandbox\u002Fcomponents.js",7801,"https:\u002F\u002Fgithub.com\u002Fnodetool-ai\u002Fnodetool\u002Fblob\u002Fmain\u002Fpackages\u002Fsandbox-packs\u002Fsandbox-timeline\u002Fsandbox\u002Fcomponents.js",{"path":93,"resourceType":84,"resourceTypeDesc":85,"sizeBytes":94,"sourceHtmlUrl":95},"sandbox\u002Findex.d.ts",22636,"https:\u002F\u002Fgithub.com\u002Fnodetool-ai\u002Fnodetool\u002Fblob\u002Fmain\u002Fpackages\u002Fsandbox-packs\u002Fsandbox-timeline\u002Fsandbox\u002Findex.d.ts",{"path":97,"resourceType":84,"resourceTypeDesc":85,"sizeBytes":98,"sourceHtmlUrl":99},"sandbox\u002Findex.js",84910,"https:\u002F\u002Fgithub.com\u002Fnodetool-ai\u002Fnodetool\u002Fblob\u002Fmain\u002Fpackages\u002Fsandbox-packs\u002Fsandbox-timeline\u002Fsandbox\u002Findex.js",[101,110,146,177,194,213],{"skillNo":102,"name":103,"nameZh":17,"description":104,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":105,"licenseFileUrl":17,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":109},"01M742MX3Y2ZYK884ZXTRFKB9P","humanizer","Rewrite AI-sounding text so it reads like the writer without changing what it says.\nUse when editing or reviewing prose for AI tells: not-X-but-Y contrasts, one-line\nclosers, staged openers, forced triads, dashes everywhere, inflated claims, sales\nlanguage, stock AI words, bold labels, or filler.","MIT","https:\u002F\u002Fgithub.com\u002Fnodetool-ai\u002Fnodetool\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fhumanizer\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":111,"name":112,"nameZh":113,"description":114,"descriptionZh":115,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":116,"categories":117,"keywords":124,"publishedAt":48},"01M6BY4D93R0Q9400ZHJ04DXP1","nodetool","NodeTool可视化AI工作流构建","Use the NodeTool MCP server to build, validate, run, and debug visual AI workflows, and to work with assets, collections, and jobs. Use when the user mentions NodeTool or asks for a workflow graph, a node, or a media generation run on their NodeTool server.","使用 NodeTool MCP 服务器构建、验证、运行和调试可视化 AI 工作流，并处理资产、集合和任务。当用户提及 NodeTool，或要求在其 NodeTool 服务器上创建工作流图、节点或运行媒体生成时使用。","https:\u002F\u002Fgithub.com\u002Fnodetool-ai\u002Fnodetool\u002Fblob\u002Fmain\u002Fplugins\u002Fchatgpt\u002Fnodetool\u002Fskills\u002Fnodetool\u002FSKILL.md",[118,121],{"categoryNo":119,"categoryName":120,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BRZZF9D7PVFN5MXSPWWD61","AI 工程师",{"categoryNo":122,"categoryName":123,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BSAA4FBTWZP6X98STEHG99","智能体开发",[112,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145],"MCP","Media","workflows","when","generation","media generation","with","visual","use","collections","for","node","work","debug","graph","validate","assets","run","server","mcp server","workflow",{"skillNo":147,"name":148,"nameZh":149,"description":150,"descriptionZh":151,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":152,"categories":153,"keywords":156,"publishedAt":48},"01M6BY4AEB05ZPBRVD078ATR2H","wan-2-6-prompting","Wan 2.6 视频提示词编写","Prompt Alibaba's Wan 2.6 video — text-to-video with a global style line plus timing-bracketed shots, and image-to-video that describes only what changes over time. Covers the shot-mode switch per provider, the prompt budget, negative prompts, motion intensity wording, audio input and prompt expansion. Use whenever the model id names a Wan 2.6 video route (alibaba\u002Fwan-2.6\u002Ftext-to-video, alibaba\u002Fwan-2.6\u002Fimage-to-video, wan-video\u002Fwan-2.6-t2v, wan-video\u002Fwan-2.6-i2v, wan-video\u002Fwan2.6-i2v-flash) on generate_video, animate_image or a TextToVideo node. Not for Wan 2.5 or 2.7, or the Wan 2.6 image routes.","为阿里的 Wan 2.6 视频模型编写提示词——文生视频采用全局风格描述行加上按时间用括号标记的分镜，图生视频只描述随时间变化的内容。涵盖各服务商的镜头模式切换、提示词预算、负面提示词、运动强度措辞、音频输入和提示词扩展。当模型 ID 指定 Wan 2.6 视频路由（alibaba\u002Fwan-2.6\u002Ftext-to-video、alibaba\u002Fwan-2.6\u002Fimage-to-video、wan-video\u002Fwan-2.6-t2v、wan-video\u002Fwan-2.6-i2v、wan-video\u002Fwan2.6-i2v-flash）用于 generate_video、animate_image 或 TextToVideo 节点时使用。不适用于 Wan 2.5 或 2.7，也不适用于 Wan 2.6 图像路由。","https:\u002F\u002Fgithub.com\u002Fnodetool-ai\u002Fnodetool\u002Fblob\u002Fmain\u002Fpackages\u002Fsystem-skills\u002Fwan-2-6-prompting\u002FSKILL.md",[154,155],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},[157,158,159,160,161,162,163,136,164,165,166,167,168,169,170,171,172,173,174,175,176],"prompting","wan 2 6 prompting","line","expansion","input","image-to-video","text-to-video","route","only","mode","time","flash","Budget","generate","text","image","animate","model","Audio","Video",{"skillNo":178,"name":179,"nameZh":180,"description":181,"descriptionZh":182,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":183,"categories":184,"keywords":187,"publishedAt":48},"01M6BY47T4748ZG5ZMTAR97ZWZ","video-workflow","可复用视频工作流搭建","Build a reusable NodeTool video workflow for batches or repeated inputs. For a single finished piece, use a storyboard skill.","构建可复用的 NodeTool 视频工作流，用于批量处理或重复输入。若只需制作单个成品，请使用 storyboard（分镜）技能。","https:\u002F\u002Fgithub.com\u002Fnodetool-ai\u002Fnodetool\u002Fblob\u002Fmain\u002Fpackages\u002Fsystem-skills\u002Fvideo-workflow\u002FSKILL.md",[185,186],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},[145,188,176,189,190,191,192,133,193,112,135],"video workflow","reusable","storyboard","build","batches","single",{"skillNo":195,"name":196,"nameZh":197,"description":198,"descriptionZh":199,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":200,"categories":201,"keywords":204,"publishedAt":48},"01M6BY4587N2SYN315SXGEMZC3","video-clone","参考视频镜头结构复刻","Analyze a reference video and recreate its shot structure with a new product or cast in NodeTool.","分析参考视频，并在 NodeTool 中使用新产品或新演员重现其镜头结构。","https:\u002F\u002Fgithub.com\u002Fnodetool-ai\u002Fnodetool\u002Fblob\u002Fmain\u002Fpackages\u002Fsystem-skills\u002Fvideo-clone\u002FSKILL.md",[202,203],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},[205,206,176,131,207,208,112,209,210,211,212],"clone","video clone","cast","new","analyze","product","structure","reference",{"skillNo":214,"name":215,"nameZh":216,"description":217,"descriptionZh":218,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":219,"categories":220,"keywords":223,"publishedAt":48},"01M6BY4257C2KQYYMD9EK6DK8E","video-audio-continuity","多场景视频音频连续性处理","Keep sound continuous across a multi-scene piece cut from generated video — why one clip per scene hard-cuts the audio at every boundary, when to write all the scenes into a single generation instead, the sound-design vocabulary that survives a provider's copyright filter, and how to check the length, the aspect ratio and the mix of what came back. Use when a piece has more than one scene and the video model writes its own audio (Seedance 2, Veo 3, MiniMax H3, Kling 2.6 and later), or when a cut's sound drops out at the shot changes.","让由生成视频剪辑而成的多场景作品中的声音保持连续——为什么每个场景各生成一段片段会在每处边界硬切音频、何时改为把所有场景写入同一次生成、能在服务商版权过滤下保留下来的声音设计词汇，以及如何检查返回内容的时长、宽高比和混音效果。当作品包含多个场景且视频模型会自行生成音频（Seedance 2、Veo 3、MiniMax H3、Kling 2.6 及更高版本），或剪辑的声音在镜头切换处中断时使用。","https:\u002F\u002Fgithub.com\u002Fnodetool-ai\u002Fnodetool\u002Fblob\u002Fmain\u002Fpackages\u002Fsystem-skills\u002Fvideo-audio-continuity\u002FSKILL.md",[221,222],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},[224,176,175,225,226,227,228,229,230,231,232,233,234,128,235,236,174,237,238,239,240],"video audio continuity","continuity","write","why","back","veo 3","at","cut","later","across","filter","generated","how to","mix","design","boundary","how"]