mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-11 14:50:02 +00:00
* chore(skills): remove 1,685 lines of redundant and irrelevant skill content - Remove 5 GSAP references irrelevant to HyperFrames (scrolltrigger, plugins, react, frameworks, utils) — no scroll, no frameworks, no interactive plugins in video compositions - Remove shader-setup.md and shader-transitions.md — duplicated by @hyperframes/shader-transitions package (packages/shader-transitions/) - Remove marker-highlight.md and examples.md — JS library docs superseded by css-patterns.md (deterministic, GSAP-driven, fully seekable) - Trim CLAUDE.md to dev-only instructions — move product docs (transcription, TTS, player) to skills where they belong - Deduplicate house-style.md typography/motion sections — point to dedicated references instead of repeating rules - Clean up stale references to deleted files across SKILL.md and catalog.md - Update gsap skill description to reflect HyperFrames-only scope Skills: 5,230 → 3,714 lines (29% reduction) CLAUDE.md: 204 → 50 lines (75% reduction) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(skills): update broken marker-highlight.md references in captions.md Point to css-patterns.md instead of deleted marker-highlight.md. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(skills): update stale shader CSS rule to reference package API BG_COLOR was from the old manual setup. Now it's bgColor in the @hyperframes/shader-transitions init() config. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(skills): address 6 doc gaps surfaced by eval agents P0: Document HyperShader as IIFE global name in shader-transitions README P1: Replace async fetch() with sync XHR in effects.md audio data loading (fetch violates synchronous timeline construction rule in SKILL.md) P1: Change <div> to <span> in css-patterns.md marker highlight patterns (<div> inside <p> is invalid HTML, breaks layout in inline contexts) P2: Clarify bgColor as fallback color in shader-transitions README P2: Add data-start to Composition Clips table in SKILL.md (root composition element needs data-start="0", linter enforces it) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(templates): update init templates to match trimmed skill scope - Remove ScrollTrigger/plugins/React/Vue/Svelte from gsap skill description - Replace class="clip" with accurate pattern examples in skill intro text (class="clip" is still in Key Rules where it belongs) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(skills): remove contradictory 5:1 contrast threshold from house-style house-style.md said 5:1 minimum, but hyperframes validate enforces WCAG AA (4.5:1 normal text, 3:1 large text). Now defers to validate instead of stating a conflicting number. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
212 lines
6.2 KiB
Markdown
212 lines
6.2 KiB
Markdown
---
|
||
name: gsap
|
||
description: GSAP animation reference for HyperFrames. Covers gsap.to(), from(), fromTo(), easing, stagger, defaults, timelines (gsap.timeline(), position parameter, labels, nesting, playback), and performance (transforms, will-change, quickTo). Use when writing GSAP animations in HyperFrames compositions.
|
||
---
|
||
|
||
# GSAP
|
||
|
||
## Core Tween Methods
|
||
|
||
- **gsap.to(targets, vars)** — animate from current state to `vars`. Most common.
|
||
- **gsap.from(targets, vars)** — animate from `vars` to current state (entrances).
|
||
- **gsap.fromTo(targets, fromVars, toVars)** — explicit start and end.
|
||
- **gsap.set(targets, vars)** — apply immediately (duration 0).
|
||
|
||
Always use **camelCase** property names (e.g. `backgroundColor`, `rotationX`).
|
||
|
||
## Common vars
|
||
|
||
- **duration** — seconds (default 0.5).
|
||
- **delay** — seconds before start.
|
||
- **ease** — `"power1.out"` (default), `"power3.inOut"`, `"back.out(1.7)"`, `"elastic.out(1, 0.3)"`, `"none"`.
|
||
- **stagger** — number `0.1` or object: `{ amount: 0.3, from: "center" }`, `{ each: 0.1, from: "random" }`.
|
||
- **overwrite** — `false` (default), `true`, or `"auto"`.
|
||
- **repeat** — number or `-1` for infinite. **yoyo** — alternates direction with repeat.
|
||
- **onComplete**, **onStart**, **onUpdate** — callbacks.
|
||
- **immediateRender** — default `true` for from()/fromTo(). Set `false` on later tweens targeting the same property+element to avoid overwrite.
|
||
|
||
## Transforms and CSS
|
||
|
||
Prefer GSAP's **transform aliases** over raw `transform` string:
|
||
|
||
| GSAP property | Equivalent |
|
||
| --------------------------- | ------------------- |
|
||
| `x`, `y`, `z` | translateX/Y/Z (px) |
|
||
| `xPercent`, `yPercent` | translateX/Y in % |
|
||
| `scale`, `scaleX`, `scaleY` | scale |
|
||
| `rotation` | rotate (deg) |
|
||
| `rotationX`, `rotationY` | 3D rotate |
|
||
| `skewX`, `skewY` | skew |
|
||
| `transformOrigin` | transform-origin |
|
||
|
||
- **autoAlpha** — prefer over `opacity`. At 0: also sets `visibility: hidden`.
|
||
- **CSS variables** — `"--hue": 180`.
|
||
- **svgOrigin** _(SVG only)_ — global SVG coordinate space origin. Don't combine with `transformOrigin`.
|
||
- **Directional rotation** — `"360_cw"`, `"-170_short"`, `"90_ccw"`.
|
||
- **clearProps** — `"all"` or comma-separated; removes inline styles on complete.
|
||
- **Relative values** — `"+=20"`, `"-=10"`, `"*=2"`.
|
||
|
||
## Function-Based Values
|
||
|
||
```javascript
|
||
gsap.to(".item", {
|
||
x: (i, target, targets) => i * 50,
|
||
stagger: 0.1,
|
||
});
|
||
```
|
||
|
||
## Easing
|
||
|
||
Built-in eases: `power1`–`power4`, `back`, `bounce`, `circ`, `elastic`, `expo`, `sine`. Each has `.in`, `.out`, `.inOut`.
|
||
|
||
## Defaults
|
||
|
||
```javascript
|
||
gsap.defaults({ duration: 0.6, ease: "power2.out" });
|
||
```
|
||
|
||
## Controlling Tweens
|
||
|
||
```javascript
|
||
const tween = gsap.to(".box", { x: 100 });
|
||
tween.pause();
|
||
tween.play();
|
||
tween.reverse();
|
||
tween.kill();
|
||
tween.progress(0.5);
|
||
tween.time(0.2);
|
||
```
|
||
|
||
## gsap.matchMedia() (Responsive + Accessibility)
|
||
|
||
Runs setup only when a media query matches; auto-reverts when it stops matching.
|
||
|
||
```javascript
|
||
let mm = gsap.matchMedia();
|
||
mm.add(
|
||
{
|
||
isDesktop: "(min-width: 800px)",
|
||
reduceMotion: "(prefers-reduced-motion: reduce)",
|
||
},
|
||
(context) => {
|
||
const { isDesktop, reduceMotion } = context.conditions;
|
||
gsap.to(".box", {
|
||
rotation: isDesktop ? 360 : 180,
|
||
duration: reduceMotion ? 0 : 2,
|
||
});
|
||
},
|
||
);
|
||
```
|
||
|
||
---
|
||
|
||
## Timelines
|
||
|
||
### Creating a Timeline
|
||
|
||
```javascript
|
||
const tl = gsap.timeline({ defaults: { duration: 0.5, ease: "power2.out" } });
|
||
tl.to(".a", { x: 100 }).to(".b", { y: 50 }).to(".c", { opacity: 0 });
|
||
```
|
||
|
||
### Position Parameter
|
||
|
||
Third argument controls placement:
|
||
|
||
- **Absolute**: `1` — at 1s
|
||
- **Relative**: `"+=0.5"` — after end; `"-=0.2"` — before end
|
||
- **Label**: `"intro"`, `"intro+=0.3"`
|
||
- **Alignment**: `"<"` — same start as previous; `">"` — after previous ends; `"<0.2"` — 0.2s after previous starts
|
||
|
||
```javascript
|
||
tl.to(".a", { x: 100 }, 0);
|
||
tl.to(".b", { y: 50 }, "<"); // same start as .a
|
||
tl.to(".c", { opacity: 0 }, "<0.2"); // 0.2s after .b starts
|
||
```
|
||
|
||
### Labels
|
||
|
||
```javascript
|
||
tl.addLabel("intro", 0);
|
||
tl.to(".a", { x: 100 }, "intro");
|
||
tl.addLabel("outro", "+=0.5");
|
||
tl.play("outro");
|
||
tl.tweenFromTo("intro", "outro");
|
||
```
|
||
|
||
### Timeline Options
|
||
|
||
- **paused: true** — create paused; call `.play()` to start.
|
||
- **repeat**, **yoyo** — apply to whole timeline.
|
||
- **defaults** — vars merged into every child tween.
|
||
|
||
### Nesting Timelines
|
||
|
||
```javascript
|
||
const master = gsap.timeline();
|
||
const child = gsap.timeline();
|
||
child.to(".a", { x: 100 }).to(".b", { y: 50 });
|
||
master.add(child, 0);
|
||
```
|
||
|
||
### Playback Control
|
||
|
||
`tl.play()`, `tl.pause()`, `tl.reverse()`, `tl.restart()`, `tl.time(2)`, `tl.progress(0.5)`, `tl.kill()`.
|
||
|
||
---
|
||
|
||
## Performance
|
||
|
||
### Prefer Transform and Opacity
|
||
|
||
Animating `x`, `y`, `scale`, `rotation`, `opacity` stays on the compositor. Avoid `width`, `height`, `top`, `left` when transforms achieve the same effect.
|
||
|
||
### will-change
|
||
|
||
```css
|
||
will-change: transform;
|
||
```
|
||
|
||
Only on elements that actually animate.
|
||
|
||
### gsap.quickTo() for Frequent Updates
|
||
|
||
```javascript
|
||
let xTo = gsap.quickTo("#id", "x", { duration: 0.4, ease: "power3" }),
|
||
yTo = gsap.quickTo("#id", "y", { duration: 0.4, ease: "power3" });
|
||
container.addEventListener("mousemove", (e) => {
|
||
xTo(e.pageX);
|
||
yTo(e.pageY);
|
||
});
|
||
```
|
||
|
||
### Stagger > Many Tweens
|
||
|
||
Use `stagger` instead of separate tweens with manual delays.
|
||
|
||
### Cleanup
|
||
|
||
Pause or kill off-screen animations.
|
||
|
||
---
|
||
|
||
## References (loaded on demand)
|
||
|
||
- **[references/effects.md](references/effects.md)** — Drop-in effects: typewriter text, audio visualizer. Read when needing ready-made effect patterns for HyperFrames.
|
||
|
||
## Best Practices
|
||
|
||
- Use camelCase property names; prefer transform aliases and autoAlpha.
|
||
- Prefer timelines over chaining with delay; use the position parameter.
|
||
- Add labels with `addLabel()` for readable sequencing.
|
||
- Pass defaults into timeline constructor.
|
||
- Store tween/timeline return value when controlling playback.
|
||
|
||
## Do Not
|
||
|
||
- Animate layout properties (width/height/top/left) when transforms suffice.
|
||
- Use both svgOrigin and transformOrigin on the same SVG element.
|
||
- Chain animations with delay when a timeline can sequence them.
|
||
- Create tweens before the DOM exists.
|
||
- Skip cleanup — always kill tweens when no longer needed.
|