--- name: system-diagram-animation description: Animated system and architecture diagrams that build node by node on one stage - boxes pop in, connectors draw on, data packets travel along edges, failures get a red cross, the camera reframes as the diagram grows - rendered to MP4 at 9:16 or 16:9 with HyperFrames, SVG and GSAP. Use whenever someone wants to explain how a system, API, pipeline, protocol, request flow, AI agent or architecture works as a video, or asks for an engineering or system-design explainer. Not for statistics and trends (use data-story-charts) or character stories (use hand-drawn-cartoon). license: MIT compatibility: HyperFrames (Node 22+, FFmpeg) with GSAP and inline SVG. Fonts from Google Fonts. --- # System Diagram Animation One dark stage. A diagram assembles itself in the order the story is told: a box lands, an arrow draws to the next box, a glowing packet travels along it, and the caption names what just happened. It never needs to cut, and it feels fast because something new lands every 1–2 seconds. ## Options | Option | Default | Notes | |---|---|---| | format | vertical 1080×1920 | or landscape 1920×1080 (diagrams fit landscape more naturally) | | duration | 20 s | 15–60 s; about 1 node per 1.5 s | | tone | clean | `clean` (default), `punchy` (faster reveals, more packets, a shake on errors), `calm` (longer holds, no shake) | | theme | dark | or light (paper white with navy lines) | ## Brief (answer before planning) 1. What system or flow, in one sentence? 2. What is the one path to follow (request → … → response)? List the nodes in order (at most 8 on screen at once). 3. Where is the interesting moment: a failure, a bottleneck, a cache hit, a retry? 4. What should the viewer remember at the end (one line)? Then write the beat list: for each beat, the node or connector that appears, the packet that moves, and the caption text. ## Reads sheet (write it with the beat list) For every beat, write the one thing the viewer must understand ("the robot can't fly", "the cache missed") and how long it stays readable. One read at a time. Text floors: a label stays at least 0.8 s, a sentence about 0.3 s per word once fully on screen. If the text won't fit the time, cut words rather than speed up. ## Motion discipline - Motion is causal: every move has a reason on screen (a click, a fall, a packet arriving), and the next move follows from it. - Pick one main direction of travel for the whole video and keep it. Use the other directions for meaning: up for success or conclusion, a zoom out for "here's the whole picture". - A scene's exit sets up the next entry: same axis, same direction, similar speed. Carry one object across the change instead of crossfading. - No idle filler motion (floating, breathing, wobbling) on diagrams, charts or text. If nothing should move, hold still; one deliberate camera drift is enough. - Easing: smooth ease-out for entries (`power2.out` to `power4.out`), quicker ease-in for exits (about 75% of the entry time). Entries at most 0.8 s. Total stagger for a group at most 0.5 s. Overshoot (`back.out`) only for small pops; no elastic or bounce. - One thing moves at a time when it matters; the eye can follow only one. - Add a 0.3–0.75 s beat of stillness right before the payoff. ## Style rules (always) 1. One stage, no cuts. The diagram grows; when it outgrows the frame, the camera reframes (scale and move the whole diagram group). 2. Reveal order is story order. Nothing appears before it is mentioned. 3. Connectors draw on (stroke-dashoffset) before anything travels along them. Arrowheads appear only when their line has finished drawing. 4. Every 1–2 s something new lands: a node, a connector, a packet or a caption change. 5. One highlight colour for the active path. One red for failures. Everything else is neutral. 6. Labels are short: a function name, a service name or a 2–4 word phrase. Monospace for code-like names. ## Defaults and overrides Precedence: the user's brand or spec, then the explicit request, then these defaults. - Dark: stage `#0f1724`, dot grid `#1f2b3d`, node fill `#1c2a3d`, lines `#8aa4c2`, active `#38d6e0`, highlight `#ffd166`, error `#ef476f`, text `#f2f5f9`. - Light: stage `#f7f8fb`, node fill `#ffffff`, lines `#5b6b82`, active `#0b7285`, highlight `#e8a100`, error `#d6336c`, text `#16213a`. - Fonts: Inter 700–800 for names and captions, JetBrains Mono 600 for code labels. Node labels 40–52 px, captions 56–64 px in 9:16. ## Setup (once) ```bash node -v && ffmpeg -version npx hyperframes init my-video --non-interactive --resolution portrait && cd my-video # landscape for 16:9 ``` ## Route | Need | SVG + GSAP in HyperFrames (default) | Remotion | |---|:-:|:-:| | Nodes, connectors, packets, camera | yes | yes | | Runs with only Node and FFmpeg | yes | yes | | Licence | free | free up to 3 people | ## Layout - **9:16:** the diagram flows top to bottom between y 290 and y 1080; captions sit at y 1110–1250. Use two columns at most (x 120–960). Node width 280–480 px. - **16:9:** the diagram flows left to right between x 120 and x 1800, y 150–850; captions sit along the bottom at y 880–1000. - Place nodes on a grid (multiples of 40 px) so connectors are straight or one smooth curve. Leave 80 px or more between nodes. - Failed branches: show the red cross and an error tag, hold for 1 s, then fade the failed branch fully out before the new path appears (dimmed text fails contrast checks). ## Move vocabulary | Move | How (GSAP + SVG) | |---|---| | Node in | `fromTo(node, {opacity:0, scale:0.6, transformOrigin:"50% 50%"}, {opacity:1, scale:1, duration:0.35, ease:"back.out(1.8)"})` | | Connector draw | set `strokeDasharray` and `strokeDashoffset` to the path length and `opacity:0`; at time t show it and tween the offset to 0 over 0.35–0.6 s, `power2.inOut`; add the `marker-end` arrowhead only when the draw finishes | | Packet | a glowing circle moved along the connector with `path.getPointAtLength(k * L)` in a tween's `onUpdate`, 0.4–0.7 s, linear | | Active path | connector stroke to the active colour, plus a 0.2 s pulse on the node | | Failure | a red cross scales in from 2.2 with `back.out(3)`, the source node shakes (`x` ±10 px, 3 times), an error tag pops | | Upgrade | the node border turns to the highlight colour with a soft glow filter; its sub-label changes text | | Success | the final node pops (scale 1.08 yoyo) and 2 rings expand and fade behind it | | Camera | tween a wrapper group's `scale` (with `transformOrigin` in px) by 0.04–0.2; never more than every 3 s | | Caption swap | old line out `y:-12, opacity:0` (0.15 s), new line in `y:14 → 0` (0.2 s) | ## Make it eye-catching - The hook frame already shows the first node, big and centred, plus a caption that asks the question. - Packets glow (a Gaussian-blur merge filter) and there are always one or two in motion during flow beats. - The failure moment is the most dramatic beat: the cross, the shake, the red tag. Don't skip it if the story has one. - The finale lights the whole working path in the active colour, with a burst behind the final node. - A subtle dot grid and a slow camera drift keep the background alive. - Every frozen frame should explain something on its own. ## Starter ```html