Motion graphics with code: HTML, SVG, GSAP, three.js
Motion graphics with code means you describe shapes, text and movement in HTML, SVG and JavaScript, and a renderer plays the page frame by frame into an MP4. GSAP does the timing, three.js adds 3D, and an engine like HyperFrames records the result. A coding agent such as Claude Code can write all of it for you, and ReelStyles kits give the agent a finished look to follow.
This page explains what each tool does and walks through one small example. I sell ReelStyles, so I mention it where it fits. Every fact about the other tools comes from their own pages, listed at the end.
The stack in one table
| Tool | Job in a motion graphics video | Licence as published |
|---|---|---|
| HTML and CSS | Layout, colour, type, the first frame | Web standards |
| SVG | Shapes, icons, charts and lines that stay sharp at any size | Web standard |
| GSAP | Timelines: what moves, when, and with which easing | Free for everyone, including commercial use, under GSAP's standard licence |
| three.js | 3D scenes in the browser | MIT |
| HyperFrames | Plays the page one exact frame at a time and writes the MP4 | Apache-2.0 |
GSAP's licence has one restriction worth knowing. You can't use it inside a no-code visual animation tool that competes with Webflow's own. Making your own videos is a permitted use, and GSAP's licence page says code written by AI tools is fine.
Why a renderer is needed
A browser plays animation in real time. If your computer is slow, it drops frames. HyperFrames avoids this by asking the page for each exact frame, so a slow machine only means a slower render. The video comes out the same every time.
This gives one rule for your animation code. It has to be seekable. HyperFrames' own docs say to build one finite GSAP timeline, create it paused, and to avoid wall-clock time, random numbers without a seed, and endless repeats.
Step 1: set up
You need Node.js 22.19 or newer and FFmpeg. Then:
npx hyperframes init my-video cd my-video npx hyperframes preview
init creates the project folder. preview opens a browser editor with a live view of your composition. If something is missing on your machine, npx hyperframes doctor checks the runtime, browser and FFmpeg.
Step 2: write one scene
This is a title card with a bar that grows under it. The structure follows HyperFrames' HTML schema: a root with an id, a size and a duration, one timed clip inside it, and one paused GSAP timeline registered under the same id.
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
<div id="root" data-composition-id="main" data-start="0" data-duration="5"
data-width="1920" data-height="1080"
style="position:relative;width:1920px;height:1080px;overflow:hidden;background:#0f1117">
<section id="title-card" class="clip" data-start="0" data-duration="5" data-track-index="1">
<div style="text-align:center;color:#fff;font:700 96px system-ui">
<h1 id="title" style="margin:0">Motion in code</h1>
<div id="bar" style="height:8px;width:420px;margin:24px auto 0;background:#ffb703;transform-origin:left"></div>
</div>
</section>
</div>
<script>
window.__timelines = window.__timelines || {};
const timeline = gsap.timeline({ paused: true });
timeline.fromTo("#title", { y: 48, opacity: 0 }, { y: 0, opacity: 1, duration: 0.6, ease: "power3.out" }, 0.2);
timeline.fromTo("#bar", { scaleX: 0 }, { scaleX: 1, duration: 0.8, ease: "power2.inOut" }, 0.6);
window.__timelines.main = timeline;
</script>
Put this in the project's index.html in place of the starter scene. In the preview you should see the title slide up and fade in, then the bar grow from the left. The registry key main has to match data-composition-id. A mismatch is the first thing to check when a scene shows nothing.
For layering, use CSS z-index. The data-track-index value only sets the editor lane.
Step 3: check and render
npx hyperframes lint npx hyperframes check npx hyperframes render --output title.mp4
lint and check catch problems before you spend time on a render. Use ffprobe title.mp4 afterwards to confirm the size and length are what you set.
Step 4: add SVG and three.js
SVG is the better choice for anything made of lines: a chart that draws itself, an icon that morphs, a path a dot follows. GSAP can animate SVG attributes directly.
three.js fits when the idea needs depth, like a spinning product or a camera move through a scene. The same rule applies: the scene has to follow the timeline position, not a free running loop. The ReelStyles Procedural 3D kit is built around that pattern.
Step 5: let the agent write it
You don't have to type the HTML yourself. Install the HyperFrames skills with npx skills add heygen-com/hyperframes, pick Core Skills, then ask your agent for the scene. Describe the motion in plain words: "slam the headline in from the left, hold, then wipe to the next line." Edit by talking to the agent in the same session.
Plain prompts give you whatever default look the model likes. A kit gives the agent a palette, scene templates and motion rules in advance. Kinetic type and Swiss motion are two kits for type driven motion graphics. The pricing page shows what the licence covers, and 10 styles are free.
Common problems
- The render waits about 45 seconds before it finishes. The composition never registered a timeline. Add
data-no-timelineto the root if it really has none.lintreports this case. - Nothing moves. The timeline was not registered, or the key does not match the composition id.
Questions
Do I need to know JavaScript?
No. The agent writes the code. It helps to read it, because you will tell the agent what to change by pointing at the timeline.
Is this the same as After Effects?
It covers the same kind of output: titles, shapes, charts and transitions. You work in code and prompts instead of a timeline panel, and local rendering costs nothing.
Can I make vertical video?
Yes. Set the width and height on the root to 1080 and 1920, or run npx hyperframes init my-video --resolution portrait.
Sources
- HyperFrames: repository, CLI reference, HTML schema, troubleshooting (checked 2 December 2026)
- GSAP: standard licence and pricing page (checked 2 December 2026)
- three.js: repository (checked 2 December 2026)