# Gsap Plugins
> Skill oficial de GSAP para plugins: registro, ScrollToPlugin, ScrollSmoother, Flip, Draggable, Inertia, Observer, SplitText, ScrambleText, plugins de SVG y física, CustomEase y GSDevTools.
Fuente: https://skillsagentes.com/skills/calesthio/openmontage/gsap-plugins
Markdown: https://skillsagentes.com/skills/calesthio/openmontage/gsap-plugins.md
Repositorio: https://github.com/calesthio/OpenMontage
Autor: calesthio
Licencia: MIT
Actualizado: hace 4 meses
Coste de contexto: 89 tok instalada, 5.2k tok al activarse, 5.2k tok con todos los archivos del bundle
Bundle: 1 archivo, 20 KB
Permisos que pide: ninguno declarado
## Instalación
Un skill son archivos markdown: los mismos archivos valen para cualquier agente y lo único que cambia es el directorio de destino, es decir la bandera `--agent`. Añade `-g` para instalarlo en todos los proyectos de la máquina.
```bash
# Claude Code
npx -y skills add calesthio/OpenMontage --skill gsap-plugins --agent claude-code
# Cursor
npx -y skills add calesthio/OpenMontage --skill gsap-plugins --agent cursor
# Codex
npx -y skills add calesthio/OpenMontage --skill gsap-plugins --agent codex
# Gemini CLI
npx -y skills add calesthio/OpenMontage --skill gsap-plugins --agent gemini
# Windsurf
npx -y skills add calesthio/OpenMontage --skill gsap-plugins --agent windsurf
# Cline
npx -y skills add calesthio/OpenMontage --skill gsap-plugins --agent cline
```
## Qué hace
- Explica cómo registrar plugins con `gsap.registerPlugin()` antes de usarlos
- Cubre scroll: ScrollToPlugin y ScrollSmoother
- Cubre DOM e interacción: Flip, Draggable, Inertia y Observer
- Cubre texto y SVG: SplitText, ScrambleText, DrawSVG, MorphSVG y MotionPath
- Cubre easing y física: CustomEase, EasePack, CustomWiggle, CustomBounce, Physics2D y GSDevTools
## Cuándo usarla
- El usuario pregunta por un plugin de GSAP
- Hace falta scroll-to, animaciones flip o elementos arrastrables
- Hay que dibujar o transformar SVG, o dividir texto para animarlo
- Se revisa el registro de plugins en un proyecto
## Cuándo no
- ScrollTrigger, que tiene su propio skill (`gsap-scrolltrigger`)
## Qué la activa
- "Haz esta tarjeta arrastrable con GSAP"
- "Anima la transición de este grid con Flip"
- "Divide este titular en caracteres y anímalo"
- "Dibuja este trazo SVG al hacer scroll"
## Antes de instalar
- Los plugins de GSAP hay que registrarlos con `gsap.registerPlugin()` antes del primer uso; GSDevTools es solo para desarrollo y no debe llegar a producción.
## Archivos
- SKILL.md — 20 KB
## SKILL.md
Reproducido tal cual desde calesthio/OpenMontage bajo MIT. Esta sección es el documento original y está en inglés.
# GSAP Plugins
## When to Use This Skill
Apply when using or reviewing code that uses GSAP plugins: registering plugins, scroll-to, flip/FLIP animations, draggable elements, SVG (DrawSVG, MorphSVG, MotionPath), text (SplitText, ScrambleText), physics, easing plugins (CustomEase, EasePack, CustomWiggle, CustomBounce), or GSDevTools. ScrollTrigger has its own skill (gsap-scrolltrigger).
**Related skills:** For core tweens use **gsap-core**; for ScrollTrigger use **gsap-scrolltrigger**; for React use **gsap-react**.
## Registering Plugins
Register each plugin once so GSAP (and bundlers) know to include it. Use **gsap.registerPlugin()** with every plugin used in the project:
```javascript
import gsap from "gsap";
import { ScrollToPlugin } from "gsap/ScrollToPlugin";
import { Flip } from "gsap/Flip";
import { Draggable } from "gsap/Draggable";
gsap.registerPlugin(ScrollToPlugin, Flip, Draggable);
```
- ✅ Register before using the plugin in any tween or API call.
- ✅ In React, register at top level or once in the app (e.g. before first useGSAP); do not register inside a component that re-renders. useGSAP is a plugin that needs to be registered before use.
## Scroll
### ScrollToPlugin
Animates scroll position (window or a scrollable element). Use for “scroll to element” or “scroll to position” without ScrollTrigger.
```javascript
gsap.registerPlugin(ScrollToPlugin);
gsap.to(window, { duration: 1, scrollTo: { y: 500 } });
gsap.to(window, { duration: 1, scrollTo: { y: "#section", offsetY: 50 } });
gsap.to(scrollContainer, { duration: 1, scrollTo: { x: "max" } });
```
**ScrollToPlugin — key config (scrollTo object):**
| Option | Description |
|--------|-------------|
| `x`, `y` | Target scroll position (number), or `"max"` for maximum |
| `element` | Selector or element to scroll to (for scroll-into-view) |
| `offsetX`, `offsetY` | Offset in pixels from the target position |
### ScrollSmoother
Smooth scroll wrapper (smooths native scroll). Requires ScrollTrigger and a specific DOM structure (content wrapper + smooth wrapper). Use when smooth, momentum-style scroll is needed. See GSAP docs for setup; register after ScrollTrigger. DOM structure would look like:
```html
`) that span multiple lines are subdivided so lines don’t stretch vertically. Only applies when splitting lines. |
| **ignore** | Selector or element(s) to leave unsplit (e.g. `ignore: "sup"`). |
| **smartWrap** | When splitting **chars** only, wraps words in a `white-space: nowrap` span to avoid mid-word line breaks. Ignored if words or lines are split. Default `false`. |
| **wordDelimiter** | Word boundary: string (default `" "`), RegExp, or `{ delimiter: RegExp, replaceWith: string }` for custom splitting (e.g. zero-width joiner for hashtags, or non-Latin). |
| **prepareText(text, parent)** | Function that receives raw text and parent element; return modified text before splitting (e.g. to insert break markers for languages without spaces). |
| **propIndex** | When `true`, adds a CSS variable with index on each split element (e.g. `--word: 1`, `--char: 2`). |
| **reduceWhiteSpace** | Collapse consecutive spaces; default `true`. From v3.13.0 also honors line breaks and can insert `
` for ``. |
| **onRevert** | Callback when the instance is reverted. |
**Tips:** Split only what is animated (e.g. skip chars if only animating words). For custom fonts, split after they load (e.g. `document.fonts.ready.then(...)`) or use **autoSplit: true** with **onSplit()**. To avoid kerning shift when splitting chars, use CSS `font-kerning: none; text-rendering: optimizeSpeed;`. Avoid `text-wrap: balance`; it can interfere with splitting. SplitText does not support SVG ``.
**Learn more:** [SplitText](https://gsap.com/docs/v3/Plugins/SplitText/)
### ScrambleText
Animates text with a scramble/glitch effect. Use when revealing or transitioning text with a scramble.
```javascript
gsap.registerPlugin(ScrambleTextPlugin);
gsap.to(".text", {
duration: 1,
scrambleText: { text: "New message", chars: "01", revealDelay: 0.5 }
});
```
## SVG
### DrawSVG (DrawSVGPlugin)
Reveals or hides the stroke of SVG elements by animating `stroke-dashoffset` / `stroke-dasharray`. Works on ``, ``, ``, ``, ``, ``. Use when “drawing” or “erasing” strokes.
**drawSVG value:** Describes the **visible segment** of the stroke along the path (start and end positions), not “animate from A to B over time.” Format: `"start end"` in percent or length. Examples: `"0% 100%"` = full stroke; `"20% 80%"` = stroke only between 20% and 80% (gaps at both ends). The tween animates from the element’s **current** segment to the **target** segment — e.g. `gsap.to("#path", { drawSVG: "0% 100%" })` goes from whatever it is now to full stroke. Single value (e.g. `0`, `"100%"`) means start is 0: `"100%"` is equivalent to `"0% 100%"`.
**Required:** The element must have a visible stroke — set `stroke` and `stroke-width` in CSS or as SVG attributes; otherwise nothing is drawn.
```javascript
gsap.registerPlugin(DrawSVGPlugin);
// draw from nothing to full stroke
gsap.from("#path", { duration: 1, drawSVG: 0 });
// or explicit segment: from 0–0 to 0–100%
gsap.fromTo("#path", { drawSVG: "0% 0%" }, { drawSVG: "0% 100%", duration: 1 });
// stroke only in the middle (gaps at ends)
gsap.to("#path", { duration: 1, drawSVG: "20% 80%" });
```
**Caveats:** Only affects stroke (not fill). Prefer single-segment `` elements; multi-segment paths can render oddly in some browsers. Contents of `