Motion Graphics from HTML: Stats, Stings, Lower Thirds
skillBuild motion graphics with HyperFrames: animated charts, logo animation, lower thirds, kinetic text; render from HTML to MP4, GIF or transparent video.
agents that use this skill
instructions
Overview
This skill makes short motion graphics from plain HTML and CSS: a stat that counts up, an animated chart, a logo sting, a lower third, kinetic type, an end card, a looping social clip. The renderer is HyperFrames (Apache-2.0, free to render locally, no account, no watermark). It writes MP4, WebM, GIF, ProRes MOV or a PNG sequence, including transparent overlays for real footage.
Pick it over Remotion when the piece is a graphic, not an app: HyperFrames compositions are one HTML file with no React and no per-seat licence. Remotion stays the composer inside video-explainers.
Not for this skill: cinematic generated footage (video-ad-production), cutting or grading existing footage (video-editing), full explainers with screen capture and voiceover (video-explainers), captions (video-captions), thumbnails (video-thumbnails).
Mental model
A frame-exact renderer does not play the page. For frame N it sets the time to N divided by fps, moves every animation to that time, captures one picture, and moves on. A slow frame costs wall time, never a dropped frame. So every visible value must be a function of timeline time, and anything that reads the real clock breaks it. From the HyperFrames determinism page, these break a render:
Date.now(),requestAnimationFrame,setTimeout,setInterval.Math.random()without a seed.- Fetching anything during the render; assets must load before frame 0.
- Changing fps, width or height after frame 0, or a composition with no end.
Timing lives in HTML attributes, motion in one paused GSAP timeline. Each timed element has class="clip", data-start and data-duration in seconds; the root has data-composition-id, data-width, data-height, data-duration; the timeline is registered as window.__timelines["<composition id>"], with the same id.
Rules
Method
- Write a beat sheet before any code: one line per beat with start, duration, what enters, what leaves, and the one thing the viewer must read. Show it to the user when the brief is loose.
- Create the project and install nothing else:
npx [email protected] init video-out/<slug>/motion --resolution portrait --non-interactive --skip-skills --skip-transcribePresets:portrait1080x1920,landscape1920x1080,square1080x1080 (init --help). It writesindex.html,hyperframes.json,package.json,meta.jsonand notes for coding agents (AGENTS.md,CLAUDE.md). Keep exactly one rootindex.html: a second HTML file with a composition id is a lint error. Run every command below from the project folder (cd video-out/<slug>/motion), so snapshots and renders stay inside it. - Write
index.htmlfrom the beat sheet (example below). Animate transforms and opacity on children of a clip, never the clip itself. PreferfromTo(), which stays correct when the renderer seeks backwards. Give each tween an explicit start time. - Fonts: bundled names such as Inter and Poppins resolve, but the compiler fetches other weights from Google Fonts. For a brand look, put the font file in
assets/fonts/and declare it with@font-faceand a relativeurl(...). An undeclared family can fall back to a default face and lint reports it. - Check:
npx [email protected] lint, thennpx [email protected] check.checkalso reports layout overflow, contrast, motion and social safe-zone problems. Fix errors; read each warning and keep only the ones that are intended. A render continues past lint errors unless you pass--strict. - Look before the full render:
npx [email protected] snapshot --at 0.5,2,6 --output snaps, then open the PNGs and the contact sheet and look at them. Check frame 0 (it becomes the thumbnail), the counted value at its end, and the last frame. - Render the master:
npx [email protected] render --output out/master.mp4. Use--quality draftwhile iterating. Details and every flag used here: the command reference. - Cuts: other sizes are separate compositions or
--resolutionpresets of the same aspect ratio; GIF isrender --format gif --fps 15; overlays are WebM or MOV (reference). - Verify the file:
ffprobe -v error -show_entries stream=codec_name,profile,pix_fmt,r_frame_rate,color_space:format=duration -of default=nw=1 out/master.mp4.
Motion defaults
Defaults to apply when the user gives no direction; a reference from the user wins. Items marked HF come from HyperFrames' own motion notes, measured on its launch films; the rest are working defaults without a source.
- Moves: an entrance takes 0.3 to 0.6 s on a long-tailed ease such as
power4.outorexpo.out; an exit is 40 to 50% shorter and accelerates (power3.in). HF. - Overlap: start the next element when the previous is 30 to 50% done; stagger words 60 to 120 ms apart, list items 40 to 80 ms. HF.
- Number count-up: 1.5 to 2 s on
power2.out, then hold the final value at least 2 s before anything covers it. UsetoLocaleStringfor separators and a fixed font size so the width does not jump. - Reading time: a line the viewer must read holds about 0.5 s plus 0.3 s per word; the last line at least 2 s (
checkwarnsline_unreadbelow that). HF. - Cards and lower thirds: fade in about 0.4 s, out about 0.35 s; a static card goes dead after about 8 s.
- Titles: 4 to 9% of frame height, one or two lines, one accent color, dead still once landed. HF.
- Loops: a social loop ends on the state it starts from, with no
repeat: -1(HyperFrames' own contract bans it); build the loop inside the clip length and set the GIF to repeat (--gif-loop 0). - Vertical safe zone on 1080x1920: keep text inside 120 to 888 px across and 288 to 1248 px down, the area TikTok, Reels and Shorts all leave clear (HyperFrames vertical-clip notes;
check --safe-zone tiktok|reels|shorts|standard). - Frame 0 shows the key text or image, not black.
Delivery encode
HyperFrames 0.10.1 writes MP4 as H.264 High, yuv420p, 30 fps, BT.709 tags, limited range, with the moov atom before the media data, and AAC 48 kHz stereo when the composition has audio. That meets YouTube's published upload spec for those fields. For a platform cut, re-encode once with the recipe in the reference (+faststart, High profile, AAC 48 kHz). For Instagram and TikTok use 1080x1920, MP4, H.264, AAC and follow video-spec-sheet.
Limits
- HyperFrames is pre-1.0 and changes fast. Pin the exact version in every command and recheck with
npm view hyperframes versionbefore changing the pin. - Headless WebGL falls back to software rendering where no GPU is reachable (for example WSL2), which is slower; compositions flagged
data-requires-webgpufail without a hardware adapter. - Renders can differ by a pixel between machines (fonts, Chrome).
render --dockerpins Chromium, fonts and the encoder; it needs Docker. initwrites a scaffold that loads GSAP from a CDN, so a render needs network access.- The CLI sends anonymous usage data (command names, render timings) until
telemetry disable; leave that setting to the user. - A transparent WebM shows alpha only in browsers; video editors render it black. Use MOV for editors.
Examples
Example 1: counter on the real clock
Bad: the number follows the wall clock, so each frame the renderer asks for shows whatever time the machine had reached.
const t0 = Date.now();
function tick() {
const v = Math.min(128400, ((Date.now() - t0) / 1600) * 128400);
numberEl.textContent = Math.round(v).toLocaleString("en-US");
requestAnimationFrame(tick);
}
requestAnimationFrame(tick);lint reports non_deterministic_code and requestanimationframe_in_composition as errors for this.
Good: the value is a tween on the paused timeline, so seeking to any time gives one answer.
const counter = { value: 0 };
tl.fromTo(counter, { value: 0 },
{ value: 128400, duration: 1.6, ease: "power2.out",
onUpdate: () => { numberEl.textContent = Math.round(counter.value).toLocaleString("en-US"); } }, 1.0);Example 2: minimal composition
A 1080x1920, 8 s stat reveal with an end card. Rendered and checked with HyperFrames 0.10.1: lint 0 errors, check no layout, motion or contrast issues; lint also gives two nested_structure_needs_subcomposition warnings, which are expected for a single-file piece.
<!doctype html>
<html lang="en" data-resolution="portrait">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=1080, height=1920" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js"></script>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 1080px; height: 1920px; overflow: hidden; background: #0b1020; color: #fff; font-family: "Inter", sans-serif; font-weight: 900; }
.beat { position: absolute; left: 120px; width: 768px; text-align: center; }
#stat-beat { top: 560px; } #end-beat { top: 700px; }
#label { font-size: 64px; } #number { font-size: 120px; color: #ffd23f; margin-top: 40px; }
#cta { font-size: 84px; }
</style>
</head>
<body>
<div id="root" data-composition-id="main" data-start="0" data-duration="8" data-width="1080" data-height="1920">
<div id="stat-beat" class="beat clip" data-start="0" data-duration="5.2" data-track-index="0">
<div id="label">MONTHLY READERS</div><div id="number">0</div>
</div>
<div id="end-beat" class="beat clip" data-start="5.2" data-duration="2.8" data-track-index="0">
<div id="cta">Follow for more</div>
</div>
</div>
<script>
const tl = gsap.timeline({ paused: true });
const counter = { value: 0 };
const numberEl = document.getElementById("number");
tl.fromTo("#label", { opacity: 1, y: 40 }, { opacity: 1, y: 0, duration: 0.6, ease: "power4.out" }, 0);
tl.fromTo("#number", { opacity: 0 }, { opacity: 1, duration: 0.2, ease: "none" }, 1.0);
tl.fromTo(counter, { value: 0 }, { value: 128400, duration: 1.6, ease: "power2.out",
onUpdate: () => { numberEl.textContent = Math.round(counter.value).toLocaleString("en-US"); } }, 1.0);
tl.to("#stat-beat", { opacity: 0, duration: 0.25, ease: "power3.in" }, 4.9);
tl.fromTo("#cta", { opacity: 0, y: 40 }, { opacity: 1, y: 0, duration: 0.5, ease: "expo.out" }, 5.3);
window.__timelines = window.__timelines || {};
window.__timelines["main"] = tl;
</script>
</body>
</html>Checklist
- Beat sheet written; each beat has a start, a duration and one thing to read.
- Project under
./video-out/<slug>/motion/, one rootindex.html, version pinned in every command. - No wall clock, no unseeded random, no
repeat: -1, no fetch at render time; fonts declared from local files. linthas no errors; everycheckwarning is fixed or deliberate.- Snapshots opened and read: frame 0, the final counted value, the last frame, text inside the safe zone.
- Final number held 2 s or more; last line held 2 s or more.
- Master probed with
ffprobe(codec, pixel format, fps, duration) and matches the delivery target. - Overlay checked over a contrasting background, not a player that shows black behind alpha.
- Output paths and the pinned version reported to the user.
Composition / References
references/commands.md— render flags, transparent overlay onto footage, delivery re-encode, audio, 4K, tested command output.video-explainers— longer explainers that use Remotion as the composer.video-editing— cutting and mixing footage that the overlay is laid on.video-captions— burned captions.video-spec-sheet— platform safe zones, export presets, disclosure rules.- HyperFrames docs:
guides/rendering.md,concepts/determinism.md,guides/gsap-animation.md,help.md - HyperFrames repository — its
skills/hyperframes/references/motion.mdholds the measured motion notes cited above. - YouTube recommended upload encoding