mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
feat(skills): design.md integration, shared video references, Claude Design gaps (#549)
## What Major skill infrastructure update: design.md support, shared video-composition references, and creative direction patterns extracted from website-to-hyperframes into the base hyperframes skill. ## Changes ### design.md Integration (lightweight) - Step 0a reads any format design.md (YAML, prose, tables) — no format mandate - Brand colors/fonts are strict; video layout adapts per video-composition.md - Font warning gate: warns user if design.md names fonts without local .woff2 files - Design picker generates spec-compliant design.md with YAML frontmatter + prose - Picker generates contextual options from user's prompt (3-4 architectures, 5-6 palettes, 3 type pairings) ### Shared Video References (extracted from website-to-hyperframes) - `video-composition.md` — density, scale, color presence, frame composition rules. Light canvas guidance (don't override user palette). **Always read.** - `beat-direction.md` — per-beat planning (concept → mood → choreography verbs → transition), rhythm templates by video type - `techniques.md` — 11 visual techniques with code patterns (SVG drawing, Canvas 2D, kinetic type, Lottie, etc.) - `narration.md` — pacing, tone, script structure, number pronunciation, hooks - `motion-principles.md` — gained image motion treatment + load-bearing GSAP rules ### Claude Design Transfer Brief (6 gaps applied) 1. Discovery step for exploratory requests (audience, platform, priority, variations) 2. Anti-scope-creep: "build what was asked, every element earns its place" 3. Read-source discipline: "read actual files, don't guess" 4. Rhythm planning: declare scene rhythm before implementing 5. Variations as first-class output for exploratory requests 6. Two-phase verification: fast checks block, slow checks parallel ### Prompt Expansion Updated - Uses beat-direction format (concept → mood → verbs → depth layers) - Rhythm declaration before scene breakdown - References video-composition.md and beat-direction.md ### Key Design Decision **design.md = brand truth, not video layout spec.** Background color is strict from design.md (don't switch light to dark). Video-composition rules teach how to make any palette work cinematically. ## Files Changed (16) **New shared references:** - `skills/hyperframes/references/video-composition.md` - `skills/hyperframes/references/beat-direction.md` - `skills/hyperframes/references/techniques.md` - `skills/hyperframes/references/narration.md` **Updated:** - `skills/hyperframes/SKILL.md` — discovery, anti-scope-creep, rhythm, variations, two-phase verify, new references - `skills/hyperframes/references/prompt-expansion.md` — beat-direction format - `skills/hyperframes/references/motion-principles.md` — image treatment + GSAP rules - `skills/hyperframes/references/design-picker.md` — contextual generation - `skills/hyperframes/visual-styles.md` — YAML token blocks per preset - `skills/hyperframes/house-style.md` — design.md precedence - `skills/hyperframes/templates/design-picker.html` — spec-compliant output - `skills/website-to-hyperframes/references/*` — now reference shared files ## Test plan - [x] Design picker generates and serves correctly - [x] Picker output is spec-compliant design.md - [x] Composition built from picker design.md renders in Studio - [x] Before/after eval: 4 topics × 2 versions showing skill guidance impact - [x] Light canvas compositions respect user palette (don't switch to dark) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This commit is contained in:
@@ -112,13 +112,13 @@ handoff link; it is source-code context only.
|
||||
|
||||
### Reference Files
|
||||
|
||||
| File | When to read |
|
||||
| ------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [step-1-capture.md](references/step-1-capture.md) | Step 1 — reading captured data |
|
||||
| [step-2-design.md](references/step-2-design.md) | Step 2 — writing DESIGN.md |
|
||||
| [step-3-script.md](references/step-3-script.md) | Step 3 — writing the narration script |
|
||||
| [step-4-storyboard.md](references/step-4-storyboard.md) | Step 4 — per-beat creative direction |
|
||||
| [step-5-vo.md](references/step-5-vo.md) | Step 5 — TTS, transcription, timing |
|
||||
| [step-6-build.md](references/step-6-build.md) | Step 6 — building compositions with self-review |
|
||||
| [step-7-validate.md](references/step-7-validate.md) | Step 7 — lint, validate, snapshot, preview |
|
||||
| [techniques.md](references/techniques.md) | Steps 4 & 6 — 10 visual techniques with code patterns (SVG drawing, Canvas 2D, 3D, typography, Lottie, video, typing, variable fonts, MotionPath, transitions) |
|
||||
| File | When to read |
|
||||
| -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| [step-1-capture.md](references/step-1-capture.md) | Step 1 — reading captured data |
|
||||
| [step-2-design.md](references/step-2-design.md) | Step 2 — writing DESIGN.md |
|
||||
| [step-3-script.md](references/step-3-script.md) | Step 3 — writing the narration script |
|
||||
| [step-4-storyboard.md](references/step-4-storyboard.md) | Step 4 — per-beat creative direction |
|
||||
| [step-5-vo.md](references/step-5-vo.md) | Step 5 — TTS, transcription, timing |
|
||||
| [step-6-build.md](references/step-6-build.md) | Step 6 — building compositions with self-review |
|
||||
| [step-7-validate.md](references/step-7-validate.md) | Step 7 — lint, validate, snapshot, preview |
|
||||
| [techniques.md](../hyperframes/references/techniques.md) | Steps 4 & 6 — 11 visual techniques with code patterns (SVG drawing, Canvas 2D, 3D, typography, Lottie, video, typing, variable fonts, MotionPath, transitions, audio-reactive) |
|
||||
|
||||
@@ -6,91 +6,4 @@ The script is the backbone. Everything downstream — scene durations, animation
|
||||
|
||||
Save as `SCRIPT.md` in the project directory.
|
||||
|
||||
## Pacing
|
||||
|
||||
- **2.5 words per second** is natural speaking pace
|
||||
- 15s = ~37 words. 30s = ~75 words. 60s = ~150 words
|
||||
- Leave room for pauses. Silence between sentences is a feature, not dead air
|
||||
- The script should feel SHORTER than the video — visual breathing room matters
|
||||
|
||||
## Tone
|
||||
|
||||
Write like a person, not a brochure:
|
||||
|
||||
- Use contractions: "it's", "you'll", "that's", "we've"
|
||||
- Vary sentence length — short punchy phrases mixed with longer flowing ones
|
||||
- Read it out loud. If it sounds robotic, rewrite it
|
||||
- Avoid jargon unless the audience expects it
|
||||
|
||||
## Number Pronunciation
|
||||
|
||||
Write what you want the voice to say. TTS reads literally.
|
||||
|
||||
| On the website | Write in script as |
|
||||
| -------------- | --------------------------------- |
|
||||
| 135+ | more than one hundred thirty five |
|
||||
| $1.9T | nearly two trillion dollars |
|
||||
| 99.999% | ninety nine point nine percent |
|
||||
| 200M+ | over two hundred million |
|
||||
| 10x | ten times |
|
||||
| API | A P I |
|
||||
| stripe.com | stripe dot com |
|
||||
|
||||
The visual can show the exact figure while the voice rounds it.
|
||||
|
||||
## Structure
|
||||
|
||||
For product videos from a website capture:
|
||||
|
||||
1. **Hook** — what's surprising or impressive about this product? A bold claim, a provocative question, a contrast, or a striking number. This is the opening line. **Vary the hook type** — don't default to a stat every time.
|
||||
2. **Story** — what does the product do? Who uses it? Keep it concrete.
|
||||
3. **Proof** — stats, customer names, social proof. Real numbers from the website.
|
||||
4. **CTA** — what should the viewer do? "Start building at stripe dot com."
|
||||
|
||||
Not every video needs all four. A 15-second social ad might be Hook + Proof + CTA. A 60-second product tour uses all four with more Story.
|
||||
|
||||
## The Opening Line
|
||||
|
||||
The most important sentence in the video. It must create tension, curiosity, or surprise in the first 3 seconds.
|
||||
|
||||
Patterns that work:
|
||||
|
||||
- **A bold claim**: "The financial infrastructure that powers the internet economy."
|
||||
- **A question that provokes**: "What if your database could think?"
|
||||
- **A contrast**: "Your AI agent already knows how to make videos. It just needs the right format."
|
||||
- **A number that shocks**: "Nearly two trillion dollars." (Use sparingly — not every video should open with a stat.)
|
||||
|
||||
If the opening is generic ("Welcome to Stripe" / "Introducing our product"), start over.
|
||||
|
||||
## Example
|
||||
|
||||
From a 62-second product launch video (team reference):
|
||||
|
||||
```
|
||||
Your AI agent already knows how to make videos.
|
||||
It just needs the right format.
|
||||
|
||||
This is Hyperframes. An open source framework. HTML in, video out.
|
||||
|
||||
A div is a keyframe. Data attributes are your timeline.
|
||||
CSS is your look. G-Sap is your animation engine.
|
||||
|
||||
Anything a browser can render can be a frame in your video.
|
||||
|
||||
CSS animations. G-Sap. Lottie. Shaders. Three.js.
|
||||
|
||||
Drop in music, sound effects, footage — it all composes together.
|
||||
|
||||
No new framework for the agent to learn.
|
||||
Just HTML.
|
||||
|
||||
The agent writes it. The renderer captures every frame as MP4.
|
||||
It's deterministic. Identical outputs, every time.
|
||||
|
||||
Give your agent the CLI. Tell it what to make.
|
||||
Watch it build.
|
||||
|
||||
Hyperframes. Go make something.
|
||||
```
|
||||
|
||||
Note: ~140 words for 62 seconds — that's 2.3 words/sec, leaving room for pauses and visual breathing.
|
||||
Read [../../hyperframes/references/narration.md](../../hyperframes/references/narration.md) for the full narration guide.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
- **DESIGN.md** — your color palette, font rules, components, Do's/Don'ts. Every creative decision must be grounded in this brand identity. If it says "white backgrounds with purple accent" — plan light scenes, not dark moody ones.
|
||||
- **`capture/extracted/asset-descriptions.md`** — read EVERY line. This is your menu of available visuals. Each line describes what the image actually shows (e.g., "translucent ribbons in orange, pink, and purple on white background" or "a high-speed train under a dark starry sky"). Use these descriptions to decide which assets belong in which beat. Assets you don't understand from the description — view them directly before assigning.
|
||||
- **[techniques.md](techniques.md)** — 11 visual techniques (SVG path drawing, Canvas 2D art, CSS 3D, per-word typography, Lottie, video compositing, typing effect, variable fonts, MotionPath, velocity transitions, audio-reactive). Pick 2-3 per beat and specify them in the storyboard.
|
||||
- **[techniques.md](../../hyperframes/references/techniques.md)** — 11 visual techniques (SVG path drawing, Canvas 2D art, CSS 3D, per-word typography, Lottie, video compositing, typing effect, variable fonts, MotionPath, velocity transitions, audio-reactive). Pick 2-3 per beat and specify them in the storyboard.
|
||||
|
||||
The storyboard is the creative north star. It tells the engineer exactly what to build for each beat — mood, camera, animations, transitions, assets, sound. Write it as if you're briefing a motion designer who's never seen the website.
|
||||
|
||||
@@ -24,12 +24,9 @@ Apple keynote register — economy of words, silence between sentences is a feat
|
||||
**Style basis:** DESIGN.md (brand colors, fonts, components from the captured site)
|
||||
```
|
||||
|
||||
**Global guardrails** (adapt to the brand):
|
||||
**Global guardrails** — read [video-composition.md](../../hyperframes/references/video-composition.md) first. It defines the medium rules: density, color presence, scale, frame composition, and how design.md is brand truth not layout spec. Then apply these capture-specific additions:
|
||||
|
||||
- Push color presence. Muted is fine, flat is not. Every beat should have at least one color that pulls your eye.
|
||||
- Motion should be visible and intentional. Err toward more movement than feels safe — subtle reads as static at 30fps.
|
||||
- Use as many captured assets as the creative vision allows. Scatter framework icons around a dashboard. Layer enterprise photos behind stats. Use product screenshots as floating cards. The assets exist — use them generously.
|
||||
- Aim for 8-10 visual elements per beat, not 2-3. A great beat has: background texture, midground content, foreground accents, floating decorative elements, animated icons, SVG path drawings, particle effects, typographic details. It should feel DENSE and alive.
|
||||
- Use at least 2-3 different techniques from techniques.md per beat — not across the whole video, per beat. Don't default to basic fade/scale/opacity — mix in SVG path drawing, CSS 3D transforms, typing effects, counter animations, canvas procedural art. Each beat should feel like its own visual world.
|
||||
|
||||
**Underscore/music direction** (if applicable):
|
||||
@@ -63,18 +60,9 @@ Before writing any beats, audit every captured asset. Print this table:
|
||||
|
||||
## Per-Beat Direction
|
||||
|
||||
Each beat is a WORLD, not a layout. Before writing CSS specs and GSAP instructions, describe what the viewer EXPERIENCES. The difference between a great storyboard and a mediocre one:
|
||||
Read [beat-direction.md](../../hyperframes/references/beat-direction.md) for the general beat template: concept, mood, animation choreography (energy verbs), transitions (shader vs CSS vs hard cut decision matrix), depth layers, SFX cues, rhythm planning, and velocity-matched transitions.
|
||||
|
||||
**Mediocre:** "Dark navy background. '$1.9T' in white, 280px. Logo top-left. Wave image bottom-right."
|
||||
**Great:** "Camera is already mid-flight over a vast dark canvas. The gradient wave sweeps across the frame like aurora borealis — alive, shifting. '$1.9T' SLAMS into existence with such force the wave ripples in response. This isn't a slide — it's a moment."
|
||||
|
||||
The first describes pixels. The second describes an experience. Write the second, then figure out the pixels.
|
||||
|
||||
Each beat should have:
|
||||
|
||||
### Concept
|
||||
|
||||
The big idea for this beat in 2-3 sentences. What visual WORLD are we in? What metaphor drives it? What should the viewer FEEL? This is the most important part — everything else flows from it.
|
||||
In the capture pipeline, each beat also includes:
|
||||
|
||||
### VO cue
|
||||
|
||||
@@ -84,14 +72,6 @@ Which narration line plays over this beat.
|
||||
|
||||
What the viewer sees — described cinematically, not as CSS specs. Use camera language (pan, zoom, drift, settle). Describe at least 5 visual elements, not just text + background. Think in layers — what's moving in the foreground, midground, background simultaneously?
|
||||
|
||||
### Mood direction
|
||||
|
||||
Cultural and design references, not hex codes:
|
||||
|
||||
- "Geometric, rhythmic, precise. Think Josef Albers or Bauhaus color studies."
|
||||
- "Warm workspace. Nice notebook energy, not technical blueprint."
|
||||
- "Cinematic title sequence. The kind of opening where you lean forward."
|
||||
|
||||
### Assets
|
||||
|
||||
Which captured files to use, referenced by filename:
|
||||
@@ -100,64 +80,6 @@ Which captured files to use, referenced by filename:
|
||||
- "Logo: `capture/assets/svgs/stripe-logo.svg` — centered, fades in at 0.5s"
|
||||
- "Enterprise photo: `capture/assets/enterprise-accordion-hertz.png` — Ken Burns pan, 70% opacity overlay"
|
||||
|
||||
### Animation choreography
|
||||
|
||||
Specific motion verbs per element — not "it animates in" but HOW:
|
||||
|
||||
| Energy | Verbs | Example |
|
||||
| ------------- | --------------------------------------------- | ------------------------------------- |
|
||||
| High impact | SLAMS, CRASHES, PUNCHES, STAMPS, SHATTERS | "$1.9T" SLAMS in from left at -5° |
|
||||
| Medium energy | CASCADE, SLIDES, DROPS, FILLS, DRAWS | Three cards CASCADE in staggered 0.3s |
|
||||
| Low energy | types on, FLOATS, morphs, COUNTS UP, fades in | Counter COUNTS UP from 0 to 135K |
|
||||
|
||||
Every element gets a verb. If you can't name the verb, the element is not yet designed.
|
||||
|
||||
### Transition
|
||||
|
||||
How this beat hands off to the next. Specify the type and parameters.
|
||||
|
||||
**When to pick which:**
|
||||
|
||||
| Choose shader transition for | Choose CSS transition for | Choose hard cut for |
|
||||
| ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | -------------------------------------------------------------- |
|
||||
| Reveals, big reaction shots, product/logo unveils, energy shifts, "wow" moments | Continuous camera-motion beats where the scene feels like one move broken into cuts | Rapid-fire lists, percussive edits on the beat, comedic timing |
|
||||
| Any moment the music/VO punctuates with a downbeat or SFX hit | Beats that ease from one composition into the next with shared motion vocabulary | Sequences of 3+ quick tempo-matched switches |
|
||||
| Brand moments where the transition itself _is_ the visual | Minimal/editorial pacing | Anytime a 0.3-0.8s transition would feel too slow |
|
||||
|
||||
Rule of thumb: if the beat is the _centerpiece_ of the video, shader-transition into it. If the beat is connective tissue, CSS-transition. A brand reel of 5-7 beats usually wants 1-2 shader transitions (the hero reveal + the CTA) and the rest CSS or hard cuts — too many shader transitions flatten their impact.
|
||||
|
||||
**CSS transitions** (choose from `skills/hyperframes/references/transitions/catalog.md`):
|
||||
|
||||
- Velocity-matched upward: exit `y:-150, blur:30px, 0.33s power2.in` → entry `y:150→0, blur:30px→0, 1.0s power2.out`
|
||||
- Whip pan: exit `x:-400, blur:24px, 0.3s power3.in` → entry `x:400→0, blur:24px→0, 0.3s power3.out`
|
||||
- Blur through: exit `blur:20px, 0.3s` → entry `blur:20px→0, 0.25s power3.out`
|
||||
- Zoom through: exit `scale:1→1.2, blur:20px, 0.2s power3.in` → entry `scale:0.75→1, blur:20px→0, 0.5s expo.out`
|
||||
- Hard cut / smash cut (for rapid-fire sequences)
|
||||
|
||||
**Shader transitions** (choose from `packages/shader-transitions/README.md`):
|
||||
|
||||
- Cross-Warp Morph (organic, versatile) — 0.5-0.8s, power2.inOut
|
||||
- Cinematic Zoom (professional momentum) — 0.4-0.6s, power2.inOut
|
||||
- Gravitational Lens (otherworldly) — 0.6-1.0s, power2.inOut
|
||||
- Glitch (aggressive, high energy) — 0.3-0.5s
|
||||
- See `packages/shader-transitions/README.md` for the full API, available shaders, and setup
|
||||
|
||||
**How velocity-matched CSS transitions work:**
|
||||
Exit the outgoing beat with an accelerating ease (power2.in or power3.in) plus a blur ramp. Enter the incoming beat with a decelerating ease (power2.out or power3.out) plus blur clear. The fastest point of both easing curves meets at the cut — the viewer perceives continuous camera motion, not two discrete animations. Match exit velocity to entry velocity within ~5% tolerance.
|
||||
|
||||
### Depth layers
|
||||
|
||||
What's in foreground, midground, and background. Every beat should have at least 2 layers:
|
||||
|
||||
- "BG: dark navy fill + subtle radial glow. MG: stat cards with drop shadow. FG: brand logo bottom-right."
|
||||
|
||||
### SFX cues
|
||||
|
||||
What sounds at what moment:
|
||||
|
||||
- "On the capture pulse — a soft, warm analog shutter click."
|
||||
- "Left side carries a faint low drone. On fold: drone cuts. Silence. Then a single clean chime."
|
||||
|
||||
---
|
||||
|
||||
## Production Architecture
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
- **DESIGN.md** — your color palette, fonts, components, and Do's/Don'ts. Every composition must use EXACT hex colors and font families from this file. If it says "white backgrounds" — use white, not dark.
|
||||
- **STORYBOARD.md** — the beat-by-beat plan you're executing. Each beat specifies assets, animations, transitions, and which techniques to use.
|
||||
- **`capture/extracted/asset-descriptions.md`** — when the storyboard assigns an asset to a beat, re-read the description to understand what it shows and how to position/style it correctly.
|
||||
- **[techniques.md](techniques.md)** — code patterns for the 10 visual techniques. When the storyboard says "SVG path drawing" or "per-word kinetic typography" — read the code pattern from this file and adapt it.
|
||||
- **[techniques.md](../../hyperframes/references/techniques.md)** — code patterns for the 10 visual techniques. When the storyboard says "SVG path drawing" or "per-word kinetic typography" — read the code pattern from this file and adapt it.
|
||||
- **transcript.json** — word-level timestamps that drive scene durations.
|
||||
|
||||
**Split the work: spawn a sub-agent for each beat.** By this step your context is full of captured data, DESIGN.md, SCRIPT, STORYBOARD, and transcript. Building compositions on top of all that means the detailed rules below compete with thousands of tokens of prior work. Each sub-agent gets a fresh context focused on one beat — dramatically better output.
|
||||
|
||||
@@ -1,387 +0,0 @@
|
||||
# Visual Techniques Reference
|
||||
|
||||
10 proven techniques from production HyperFrames videos. Use these in your storyboard and compositions to create visually rich, professional output. Each technique includes a minimal code pattern you can adapt.
|
||||
|
||||
These are NOT advanced — they're standard motion design patterns that every composition should use at least 2-3 of.
|
||||
|
||||
---
|
||||
|
||||
## 1. SVG Path Drawing
|
||||
|
||||
A path draws itself in real-time, like someone tracing with a pen. Use for revealing diagrams, arrows, connector lines, or brand marks.
|
||||
|
||||
```html
|
||||
<svg viewBox="0 0 400 200">
|
||||
<path
|
||||
class="draw-path"
|
||||
d="M 50 100 L 200 50 L 350 100"
|
||||
stroke="#c84f1c"
|
||||
stroke-width="4"
|
||||
fill="none"
|
||||
stroke-linecap="round"
|
||||
/>
|
||||
</svg>
|
||||
<style>
|
||||
.draw-path {
|
||||
stroke-dasharray: 280;
|
||||
stroke-dashoffset: 280;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
tl.to(".draw-path", { strokeDashoffset: 0, duration: 0.7, ease: "power2.out" }, 0.5);
|
||||
</script>
|
||||
```
|
||||
|
||||
Use `path.getTotalLength()` to calculate the dasharray value dynamically.
|
||||
|
||||
---
|
||||
|
||||
## 2. Canvas 2D Procedural Art
|
||||
|
||||
Animated noise, particle fields, data visualizations — anything that evolves frame-by-frame. Drive it with a GSAP proxy.
|
||||
|
||||
```html
|
||||
<canvas id="proc-canvas" width="1920" height="1080"></canvas>
|
||||
<script>
|
||||
var canvas = document.getElementById("proc-canvas");
|
||||
var ctx = canvas.getContext("2d");
|
||||
|
||||
function hash(x, y) {
|
||||
var n = x * 374761393 + y * 668265263;
|
||||
n = (n ^ (n >> 13)) * 1274126177;
|
||||
return ((n ^ (n >> 16)) & 0x7fffffff) / 0x7fffffff;
|
||||
}
|
||||
|
||||
function drawFrame(t) {
|
||||
ctx.fillStyle = "#0a0a0a";
|
||||
ctx.fillRect(0, 0, 1920, 1080);
|
||||
for (var i = 0; i < 200; i++) {
|
||||
var x = hash(i, 0) * 1920;
|
||||
var y = hash(i, 1) * 1080;
|
||||
var brightness = hash(i, Math.floor(t * 10)) * 255;
|
||||
ctx.fillStyle = "rgba(255, 255, 255, " + brightness / 255 + ")";
|
||||
ctx.beginPath();
|
||||
ctx.arc(x, y, 2, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
}
|
||||
}
|
||||
|
||||
var proxy = { time: 0 };
|
||||
tl.to(
|
||||
proxy,
|
||||
{
|
||||
time: 5,
|
||||
duration: 5,
|
||||
ease: "none",
|
||||
onUpdate: function () {
|
||||
drawFrame(proxy.time);
|
||||
},
|
||||
},
|
||||
0,
|
||||
);
|
||||
</script>
|
||||
```
|
||||
|
||||
The `hash()` function is deterministic — same frame renders identically every time.
|
||||
|
||||
---
|
||||
|
||||
## 3. CSS 3D Transforms
|
||||
|
||||
Perspective rotations create depth. Use for product showcases, card flips, architectural reveals.
|
||||
|
||||
```html
|
||||
<div class="stage" style="perspective: 900px;">
|
||||
<div class="card-3d" style="transform-style: preserve-3d;">
|
||||
<div class="face front">Product</div>
|
||||
<div class="face back" style="transform: rotateY(180deg);">Details</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
tl.to(".card-3d", { rotationY: 360, rotationX: 15, duration: 1.2, ease: "sine.inOut" }, 0);
|
||||
</script>
|
||||
```
|
||||
|
||||
Always set `perspective` on the parent, `transform-style: preserve-3d` on the animated element.
|
||||
|
||||
---
|
||||
|
||||
## 4. Per-Word Kinetic Typography
|
||||
|
||||
Words appear one-by-one, synced to transcript.json timestamps. The core technique for narration-driven videos.
|
||||
|
||||
```html
|
||||
<div class="headline">
|
||||
<span class="word w-0">Anything</span>
|
||||
<span class="word w-1">a</span>
|
||||
<span class="word w-2">browser</span>
|
||||
<span class="word w-3">can</span>
|
||||
<span class="word w-4">render</span>
|
||||
</div>
|
||||
<style>
|
||||
.word {
|
||||
display: inline-block;
|
||||
opacity: 0;
|
||||
margin: 0 0.12em;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
// Word onset times from transcript.json (seconds relative to beat start)
|
||||
var timings = [0.0, 0.23, 0.28, 0.63, 0.78];
|
||||
var slides = [80, 60, 50, 25, 12]; // horizontal slide decay (px)
|
||||
|
||||
document.querySelectorAll(".word").forEach(function (word, i) {
|
||||
tl.from(
|
||||
word,
|
||||
{
|
||||
x: slides[i],
|
||||
y: 14,
|
||||
opacity: 0,
|
||||
duration: 0.35,
|
||||
ease: "power2.out",
|
||||
},
|
||||
timings[i],
|
||||
);
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
The slide distance DECAYS per word (80→12px) — mimics a camera settling.
|
||||
|
||||
---
|
||||
|
||||
## 5. Lottie Animation
|
||||
|
||||
Vector animations that play inside a composition. Use for logos, character animations, icons.
|
||||
|
||||
```html
|
||||
<script src="https://cdn.jsdelivr.net/npm/@dotlottie/player-component@2.7.12/dist/dotlottie-player.js"></script>
|
||||
<dotlottie-player
|
||||
class="lottie"
|
||||
src="../capture/assets/lottie/animation-0.json"
|
||||
autoplay
|
||||
loop
|
||||
speed="1.5"
|
||||
style="width:500px;height:500px;"
|
||||
>
|
||||
</dotlottie-player>
|
||||
<script>
|
||||
gsap.set(".lottie", { scale: 0.3, opacity: 0 });
|
||||
tl.to(".lottie", { scale: 1, opacity: 1, duration: 0.35, ease: "back.out(1.6)" }, 0.2);
|
||||
</script>
|
||||
```
|
||||
|
||||
Or use lottie-web for more control:
|
||||
|
||||
```javascript
|
||||
var anim = lottie.loadAnimation({
|
||||
container: document.getElementById("anim"),
|
||||
renderer: "svg",
|
||||
loop: false,
|
||||
autoplay: false,
|
||||
path: "../capture/assets/lottie/animation-0.json",
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. Video Compositing
|
||||
|
||||
Embed real video footage inside compositions. Videos must be `muted` with `playsinline`.
|
||||
|
||||
```html
|
||||
<div class="video-frame" style="width:680px;height:840px;border-radius:16px;overflow:hidden;">
|
||||
<video
|
||||
id="footage"
|
||||
src="../capture/assets/videos/clip.mp4"
|
||||
muted
|
||||
playsinline
|
||||
style="width:100%;height:100%;object-fit:cover;"
|
||||
></video>
|
||||
</div>
|
||||
<script>
|
||||
// Video playback is controlled by the framework — don't call play() manually
|
||||
tl.from(".video-frame", { scale: 0.9, opacity: 0, duration: 0.3, ease: "power2.out" }, 0);
|
||||
</script>
|
||||
```
|
||||
|
||||
The HyperFrames runtime handles video seeking and playback.
|
||||
|
||||
---
|
||||
|
||||
## 7. Character-by-Character Typing
|
||||
|
||||
Terminal typing effect using `tl.call()` to update text content character by character.
|
||||
|
||||
```html
|
||||
<div class="terminal-line">
|
||||
<span class="prompt">❯</span>
|
||||
<span class="typed" id="typed-text"></span>
|
||||
<span class="cursor" style="width:11px;height:22px;background:#333;display:inline-block;"></span>
|
||||
</div>
|
||||
<script>
|
||||
var CMD = "npx hyperframes init";
|
||||
var typed = document.getElementById("typed-text");
|
||||
|
||||
// Cursor blinks
|
||||
tl.to(".cursor", { opacity: 0, duration: 0.12, yoyo: true, repeat: 20, ease: "steps(1)" }, 0);
|
||||
|
||||
// Type each character
|
||||
for (var i = 0; i < CMD.length; i++) {
|
||||
(function (idx) {
|
||||
tl.call(
|
||||
function () {
|
||||
typed.textContent = CMD.substring(0, idx + 1);
|
||||
},
|
||||
null,
|
||||
(idx / CMD.length) * 0.9,
|
||||
);
|
||||
})(i);
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
Use `ease: "steps(1)"` for cursor blink — creates discrete on/off.
|
||||
|
||||
---
|
||||
|
||||
## 8. Variable Font Axis Animation
|
||||
|
||||
Animate font-variation-settings to reshape glyphs in real-time. Works with variable fonts that have axes like optical size (opsz), weight (wght), softness (SOFT).
|
||||
|
||||
```html
|
||||
<style>
|
||||
/* Load the captured local variable font — do NOT use Google Fonts @import.
|
||||
Replace this placeholder with an @font-face pointing to ../capture/assets/fonts/. */
|
||||
@font-face {
|
||||
font-family: "Fraunces";
|
||||
src: url("../capture/assets/fonts/Fraunces-Variable.woff2") format("woff2");
|
||||
font-weight: 100 900;
|
||||
font-style: normal;
|
||||
font-display: block;
|
||||
}
|
||||
.wordmark {
|
||||
--opsz: 144;
|
||||
--wght: 440;
|
||||
font-family: "Fraunces", serif;
|
||||
font-variation-settings:
|
||||
"opsz" var(--opsz),
|
||||
"wght" var(--wght);
|
||||
font-size: 200px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
tl.to(".wordmark", { "--opsz": 72, "--wght": 300, duration: 0.45, ease: "power2.out" }, 0);
|
||||
</script>
|
||||
```
|
||||
|
||||
The glyph subtly reshapes as axes animate — optical size adjusts detail, weight changes thickness.
|
||||
|
||||
---
|
||||
|
||||
## 9. GSAP MotionPathPlugin
|
||||
|
||||
Animate an element along an arbitrary SVG path. Use for sliders following curves, particles along trajectories, guided reveals.
|
||||
|
||||
```html
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/MotionPathPlugin.min.js"></script>
|
||||
<div class="dot" style="width:20px;height:20px;background:#2a8a7c;border-radius:50%;"></div>
|
||||
<script>
|
||||
gsap.registerPlugin(MotionPathPlugin);
|
||||
tl.to(
|
||||
".dot",
|
||||
{
|
||||
motionPath: { path: "M 12 300 C 280 280 520 80 820 50 S 1200 48 1308 38" },
|
||||
duration: 1.5,
|
||||
ease: "power2.out",
|
||||
},
|
||||
0,
|
||||
);
|
||||
</script>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 10. Velocity-Matched Transitions
|
||||
|
||||
Exit one beat and enter the next with matched velocities — creates perceived continuous motion.
|
||||
|
||||
```javascript
|
||||
// EXIT (in outgoing composition): accelerating with blur
|
||||
tl.to(
|
||||
".content",
|
||||
{
|
||||
y: -150,
|
||||
filter: "blur(30px)",
|
||||
opacity: 0,
|
||||
duration: 0.33,
|
||||
ease: "power2.in", // accelerates
|
||||
},
|
||||
beatDuration - 0.33,
|
||||
);
|
||||
|
||||
// ENTRY (in incoming composition): decelerating from blur
|
||||
gsap.set(".content", { y: 150, filter: "blur(30px)" });
|
||||
tl.to(
|
||||
".content",
|
||||
{
|
||||
y: 0,
|
||||
filter: "blur(0px)",
|
||||
duration: 1.0,
|
||||
ease: "power2.out", // decelerates
|
||||
},
|
||||
0,
|
||||
);
|
||||
```
|
||||
|
||||
The fastest point of both curves meets at the cut — the viewer perceives smooth camera motion. Match ease families: `.in` for exits, `.out` for entries.
|
||||
|
||||
---
|
||||
|
||||
## 11. Audio-Reactive Animation
|
||||
|
||||
Drive any GSAP-tweenable property from the playing audio. Bass pulses a logo on kick drums. Treble glows a CTA on cymbals. Amplitude breathes a background during quiet phrases. The result: motion that feels locked to the track in a way pre-authored tweens never can.
|
||||
|
||||
**When to use:** Any video with music or dramatic narration — brand reels, product launches, hype edits. Skip for calm/tutorial pacing.
|
||||
|
||||
**How it works:** Pre-extract audio frequency bands into a JSON file, then sample per-frame via `tl.call()`:
|
||||
|
||||
```js
|
||||
// audio-data.json: { fps: 30, totalFrames: 900, frames: [{ bands: [0.82, 0.45, 0.31, ...] }, ...] }
|
||||
for (var f = 0; f < AUDIO_DATA.totalFrames; f++) {
|
||||
tl.call(
|
||||
(function (frame) {
|
||||
return function () {
|
||||
var bass = frame.bands[0]; // 0–1
|
||||
var treble = frame.bands[13];
|
||||
gsap.set(".logo", { scale: 1 + bass * 0.04 }); // 3–4% pulse on bass
|
||||
gsap.set(".cta", { filter: `drop-shadow(0 0 ${treble * 24}px #00C3FF)` });
|
||||
};
|
||||
})(AUDIO_DATA.frames[f]),
|
||||
[],
|
||||
f / AUDIO_DATA.fps,
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
Per-frame sampling is required — a single tween will not react. Use the extract script:
|
||||
|
||||
```bash
|
||||
python3 skills/gsap/scripts/extract-audio-data.py narration.wav --fps 30 --bands 16 -o audio-data.json
|
||||
```
|
||||
|
||||
Keep text/logo intensity subtle (≤5% scale, ≤30% glow) — audio-reactive motion on tiny elements reads as jitter. Bigger backgrounds can push to 10–30%.
|
||||
|
||||
**Never do:** equalizer bars, spectrum analyzers, waveform displays, strobing, rainbow color cycling. The audio provides _timing and intensity_; the visual vocabulary still comes from the brand. See `skills/hyperframes/references/audio-reactive.md` for the full API and anti-patterns.
|
||||
|
||||
---
|
||||
|
||||
## When to Use What
|
||||
|
||||
| Video energy | Techniques to combine |
|
||||
| ------------------------------ | --------------------------------------------------------------- |
|
||||
| High impact (launches, promos) | Per-word typography + velocity transitions + counter animations |
|
||||
| Cinematic (tours, stories) | SVG path drawing + video compositing + 3D transforms |
|
||||
| Technical (dev tools, APIs) | Character typing + Canvas 2D procedural + MotionPath |
|
||||
| Premium (luxury, enterprise) | Variable font animation + Lottie + slow velocity transitions |
|
||||
| Data-driven (stats, metrics) | Canvas 2D procedural + counter animations + SVG path drawing |
|
||||
Reference in New Issue
Block a user