--- name: animotion description: Add animated scenes to HTML assets — slideware decks, knowledgebase pages, standalone HTML — as isolated elements that play a scripted timeline (things entering, moving, multiplying, typing, counting, changing state) on one seekable clock, in a visual language derived from a brand or a reference. Activate ONLY when the user explicitly asks for animation in an HTML asset ("create an animated slide", "animate this scene/diagram/slide", "add an animated scene", "animotion"), or asks to change, check or capture an existing . Do NOT activate for a slide's ordinary entrance motion or click builds (slideware's data-a and data-step cover those), for PowerPoint, for video generation, or for CSS or JavaScript animation in an app's own codebase. --- # animotion Animated scenes for single-file HTML. A scene is one isolated element, ``, holding its markup and its timeline. The runtime renders the markup into the element's shadow root and evaluates the timeline as a pure function of time, so any moment can be shown exactly: the scene plays while it can be seen and otherwise rests on its **poster** frame, which is what print, PDF, PNG and PowerPoint exports, thumbnails and reduced-motion viewers get. Path convention: `$AM` is this plugin's root, two directories above this skill (`../../`). Commands: `node $AM/scripts/cli.js ` (Node 22+; `check --render`, `frames` and `list` also need Chrome, Edge, Brave or Chromium). ## When a scene is the right tool A scene earns its place when **motion carries the explanation**: a process unfolding, things multiplying, state changing over time, a before and after, a cause and its effect. Apply the test: with motion off, would the explanation feel broken? If not, use slideware's `data-a` (a short entrance) or `data-step` (click builds) instead, and say so. One scene per slide; most decks need two or three, not one per slide. ## Workflow 1. **Settle the visual language** before drawing anything ([references/visual-language.md](references/visual-language.md)). Look for an existing spec first: `animotion/language.md` beside the deck or page, then the brand's (`/animotion/language.md` in knowledgeware's brand registry, when installed). Without one, derive it: from the brand's tokens alone (the floor), from a named drawing idiom the user picks, or from a reference they point at (a site, screenshot, recording, PDF). For a new language, show a **specimen** (one scene of the kit's parts) and get a yes before building scenes on it. Write the result to `animotion/language.md` and its kit to `animotion/kit.html` (shared CSS, SVG symbols, sprite definitions). A scene that needs a different glyph, colour or part changes the kit and `language.md`, not its own CSS. **Never paste the kit into a scene**: `inline` copies it into the page once and the runtime stamps it into every scene, so scenes use its classes (`.am-badge`), tokens (`var(--am-tint-60)`) and sprites (``) directly. 2. **Write the beats** as plain sentences, one per moment ("the bot types a 10,000-character name; the field turns red; a finding appears"). Each beat becomes a label. Keep a scene under 20 s; a beat is a short motion followed by a hold long enough to read it. 3. **Build the static layout first**: the scene's markup in its ` ``` Attributes ([references/contract.md](references/contract.md)): `aria-label` (required: what the animation shows, in one sentence), `poster` (a label, seconds or `end`; required when it loops), `loop` (a count, or `infinite`, which only holds while a deck is presenting), `hold`, `reset` (`fade` | `cut`), `trigger` (`enter`, default: plays when it comes into view; `steps`: the presenter's clicks drive it through `` children; `manual`), `controls="none"`, `seed`, `data-am-overflow`. ## Rules - **Poster**: always set `poster` to the label of the last resolved beat (`.label("done", …)` and `poster="done"`), even when that's the end: the end moves when someone adds a hold or a beat. - **Isolation**: the scene's markup and CSS live in its template; brand tokens (`var(--color-*)`, `var(--font-*)`, and the language's `--am-*`) reach inside, page CSS doesn't. Give the element a size. - **Determinism**: every visible change comes from the timeline. No `Math.random` (use `s.rand()`), no timers, no `Date`, no network. No CSS transitions (they're turned off inside scenes); a CSS animation goes on its element from the start, with a finite count, never switched on by a state or class. - **Targets, not coordinates**: move to an anchor element (`s.move("#bot", "#qty")`), clone into a container the CSS lays out (`s.clone("#agent", 9, …, { into: "#grid" })`). Coordinates are for small nudges (`{ y: -8 }`). - **Motion language**: follow the spec's durations, easing roles and signature move ([references/motion.md](references/motion.md)). One lead per beat; enter from the cause; hold after every beat; never ease-in on an entrance. - **Legibility**: on a 1280 × 720 slide, text in a scene is at least 16 px (labels, captions) and 20 px for what the audience must read during the beat; on a page, 12 px. `check --render` warns below 14 px on a slide, 12 px elsewhere. - **Accessibility**: `aria-label` on every scene; loops longer than 5 s keep the pause control (don't set `controls="none"`); no element flashes more than 3 times a second; reduced motion shows the poster. - **Offline**: everything the scene draws is inline (SVG, CSS, data URIs). External assets from the source index are fetched once and embedded, with their credit in the page ([references/sources.md](references/sources.md)). - **Style, not content**: a reference teaches construction rules; never copy its logos, mascots or characters. - **Another engine**: if a scene truly needs one (anime.js, GSAP the user brings, a canvas), drive it from `s.custom(null, (el, p, t) => tl.seek(t * 1000), 0, { dur })` so it stays on animotion's clock. ## References | File | Read when | |---|---| | [references/contract.md](references/contract.md) | writing the element, its attributes, steps, the JS API, how it behaves in each viewing mode | | [references/verbs.md](references/verbs.md) | writing any timeline (always) | | [references/visual-language.md](references/visual-language.md) | starting a new deck or page, or deriving a style from a reference | | [references/motion.md](references/motion.md) | choosing durations, easing and choreography | | [references/sources.md](references/sources.md) | using icons, illustrations, characters or motion values from outside |