Files
hyperframes/skills/gsap/references/plugins.md
T
James RussoandClaude Opus 4.6 0a0d5d3654 refactor(skills): consolidate 15 skills into 3 (#211)
* refactor(skills): consolidate 15 skills into 3 for better trigger reliability

Merge 9 GSAP skills (core, timeline, scrolltrigger, plugins, utils, react,
frameworks, performance, effects) and 6 HyperFrames skills (compose, captions,
tts, audio-reactive, marker-highlight, cli) into 3 consolidated skills:

- `gsap` — core API + timelines + performance in SKILL.md; scrolltrigger,
  plugins, utils, react, frameworks, effects in references/
- `hyperframes` — composition authoring rules in SKILL.md; captions, tts,
  audio-reactive, marker-highlight in references/
- `hyperframes-cli` — CLI commands (init, lint, preview, render, etc.)

Why: With 15 separate skills, agents must correctly trigger the right subset
for any task. "Create an animated video with captions" needed 6+ skills to
fire — each with ~90% trigger accuracy means ~53% chance of getting all of
them. With 3 skills, that same task needs just `hyperframes` + `gsap` (~90%
both fire). Progressive disclosure still works via references/ files loaded
on demand.

Also fixes: CLAUDE.md referenced `window.__GSAP_TIMELINE` (incorrect) —
corrected to `window.__timelines`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(cli): add --skip-skills flag to init command

Allow skipping the AI coding skills installation prompt during
`hyperframes init` with `--skip-skills`. Useful when skills are
already installed or when the user wants to scaffold without them.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(skills): address code review feedback on consolidation

Restore content lost during over-compression:

- captions: fix overflow to `visible` (not hidden — clips glow effects),
  add container pattern warning, scale headroom formula, and self-lint
  placement guidance
- audio-reactive: restore sampling frequency pattern (per-frame tl.call
  loop vs single tween) and textShadow-on-container gotcha
- effects/typewriter: restore word rotation, appending words, spacing
  with static text, and multi-line cursor handoff patterns
- effects/audio-visualizer: restore spatial mapping conventions, fetch vs
  inline loading, WebGL/DOM rendering approaches, and canvas layering
- hyperframes-cli: restore --strict-all flag in render flags table

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(cli): update build:copy and template for consolidated skill names

- build:copy: reference skills/hyperframes, skills/hyperframes-cli,
  skills/gsap instead of the old 15 skill directory names
- _shared/CLAUDE.md template: update skill table to consolidated names

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 11:21:49 -07:00

195 lines
4.9 KiB
Markdown

# GSAP Plugins
Register each plugin once before use:
```javascript
import gsap from "gsap";
import { ScrollToPlugin } from "gsap/ScrollToPlugin";
import { Flip } from "gsap/Flip";
gsap.registerPlugin(ScrollToPlugin, Flip);
```
## Table of Contents
- [ScrollToPlugin](#scrolltoplugin)
- [ScrollSmoother](#scrollsmoother)
- [Flip](#flip)
- [Draggable + Inertia](#draggable)
- [Observer](#observer)
- [SplitText](#splittext)
- [ScrambleText](#scrambletext)
- [DrawSVG](#drawsvg)
- [MorphSVG](#morphsvg)
- [MotionPath](#motionpath)
- [CustomEase / EasePack](#customeaseeasepak)
- [Physics2D / PhysicsProps](#physics)
- [GSDevTools](#gsdevtools)
- [PixiPlugin](#pixiplugin)
---
## ScrollToPlugin
Animate scroll position (window or scrollable element).
```javascript
gsap.to(window, { scrollTo: { y: "#section", offsetY: 50 }, duration: 1 });
gsap.to(scrollContainer, { scrollTo: { x: "max" }, duration: 1 });
```
## ScrollSmoother
Smooth scroll wrapper. Requires ScrollTrigger + specific DOM structure (`#smooth-wrapper` > `#smooth-content`).
## Flip
FLIP layout transitions: capture state, change DOM, animate from old to new.
```javascript
const state = Flip.getState(".item");
// change DOM (reorder, add/remove, change classes)
Flip.from(state, { duration: 0.5, ease: "power2.inOut" });
```
Options: `absolute`, `nested`, `scale`, `simple`, `duration`, `ease`.
## Draggable
Makes elements draggable/spinnable/throwable.
```javascript
gsap.registerPlugin(Draggable, InertiaPlugin);
Draggable.create(".box", { type: "x,y", bounds: "#container", inertia: true });
Draggable.create(".knob", { type: "rotation" });
```
Types: `"x"`, `"y"`, `"x,y"`, `"rotation"`, `"scroll"`. Options: `bounds`, `inertia`, `edgeResistance`, `cursor`, drag callbacks.
### Inertia (InertiaPlugin)
Momentum after release with Draggable, or track velocity of any property:
```javascript
InertiaPlugin.track(".box", "x");
gsap.to(obj, { inertia: { x: "auto" } });
```
## Observer
Normalized pointer/scroll input across devices. Use for swipe/gesture detection.
```javascript
Observer.create({
target: "#area",
onUp: () => {},
onDown: () => {},
tolerance: 10,
});
```
## SplitText
Split text into chars, words, lines for per-unit animation.
```javascript
const split = SplitText.create(".heading", { type: "words, chars" });
gsap.from(split.chars, { opacity: 0, y: 20, stagger: 0.03 });
// later: split.revert()
```
Key options: `type` (comma-separated: chars/words/lines), `charsClass`/`wordsClass`/`linesClass`, `aria` ("auto"/"hidden"/"none"), `autoSplit` + `onSplit(self)` for font-safe re-splitting, `mask` (lines/words/chars for reveal effects), `tag`, `ignore`, `smartWrap`, `propIndex`.
Tips: Split only what's animated. For custom fonts, use `autoSplit: true` with `onSplit()`. Avoid `text-wrap: balance`.
## ScrambleText
Scramble/glitch text effect.
```javascript
gsap.to(".text", { scrambleText: { text: "New message", chars: "01", revealDelay: 0.5 } });
```
## DrawSVG
Animate SVG stroke reveal (stroke-dashoffset/dasharray). Element must have `stroke` and `stroke-width`.
```javascript
gsap.from("#path", { drawSVG: 0, duration: 1 }); // nothing to full stroke
gsap.to("#path", { drawSVG: "20% 80%", duration: 1 }); // partial segment
```
`drawSVG` value = visible segment: `"start end"` in % or length. Single value (e.g. `0`) means start is 0.
## MorphSVG
Morph one SVG shape into another. Handles different point counts.
```javascript
MorphSVGPlugin.convertToPath("circle, rect, ellipse, line");
gsap.to("#diamond", { morphSVG: "#lightning", duration: 1 });
// object form: { shape, type: "rotational", shapeIndex, smooth, curveMode }
```
Use `shapeIndex: "log"` to find optimal value. `type: "rotational"` avoids kinks.
## MotionPath
Animate along an SVG path.
```javascript
gsap.to(".dot", {
motionPath: { path: "#path", align: "#path", alignOrigin: [0.5, 0.5], autoRotate: true },
});
```
## CustomEase/EasePack
Custom curves beyond built-in eases:
```javascript
const ease = CustomEase.create("name", ".17,.67,.83,.67");
// or SVG path data for complex curves
const hop = CustomEase.create("hop", "M0,0 C0,0 0.056,0.442 ...");
```
EasePack adds SlowMo, RoughEase, ExpoScaleEase. CustomWiggle for oscillation. CustomBounce for configurable bounces.
## Physics
### Physics2D
```javascript
gsap.to(".ball", { physics2D: { velocity: 250, angle: 80, gravity: 500 }, duration: 2 });
```
### PhysicsProps
```javascript
gsap.to(".obj", {
physicsProps: { x: { velocity: 100, end: 300 }, y: { velocity: -50, acceleration: 200 } },
duration: 2,
});
```
## GSDevTools
Timeline scrubbing UI for development. **Do not ship to production.**
```javascript
GSDevTools.create({ animation: tl });
```
## PixiPlugin
Integrates GSAP with PixiJS display objects.
```javascript
gsap.to(sprite, { pixi: { x: 200, scale: 1.5 }, duration: 1 });
```
## Do Not
- Use a plugin without registering it first.
- Ship GSDevTools to production.
- Forget to revert SplitText instances on unmount.