做什么
GSAP 插件的官方 GSAP 技能 – 注册, ScrolltoPlugin, ScrollSmoother, Flip, Draggable, Inertia, Observator, SplitText, ScrambleText, SVG 和物理插件, C自定义Ease, EasePack, C自定义Wiggle, C自定义Bounce, GSDevTools
技能库 智客分类:Agent 工作流 gsap-plugins
GSAP 插件的官方 GSAP 技能 — 注册 , Scroll ToPlugin, ScrollSmoother, Flip, Draggable, Inertia, Observator, SplitText, ScrambleText, SVG 和物理插件, C自定义Ease, EasePack, C自定义Wiggle, C自定义Bounce, GSDev 工具 来 当用户询问GSAP插件,滚动到,翻转动画,可拖动,SVG绘图,或插件注册时使用.
官方网址:GitHub
先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。
GSAP 插件的官方 GSAP 技能 – 注册, ScrolltoPlugin, ScrollSmoother, Flip, Draggable, Inertia, Observator, SplitText, ScrambleText, SVG 和物理插件, C自定义Ease, EasePack, C自定义Wiggle, C自定义Bounce, GSDevTools
这个技能
按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:GSAP Plugins、When to Use This Skill、Licensing & Install (important)、Registering Plugins、Scroll、ScrollToPlugin。
文件分析:这是一份仅含 SKILL.md 的指令型技能,代理激活后整份正文进入上下文。
Official GSAP skill for GSAP plugins — registration, ScrollToPlugin, ScrollSmoother, Flip, Draggable, Inertia, Observer, SplitText, ScrambleText, SVG and physics plugins, CustomEase, EasePack, CustomWiggle, CustomBounce, GSDevTools. Use when the user asks about a GSAP plugin, scroll-to, flip animations, draggable, SVG drawing, or plugin registration.
GSAP PluginsWhen to Use This SkillLicensing & Install (important)Registering PluginsScrollScrollToPluginScrollSmootherDOM / UIFlipDraggableInertia (InertiaPlugin)Observer
· 许可:MIT
来源分类:GitHub skill
市场来源:GitHub
namegsap-pluginsdescription具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗
先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。
复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。
把 Agent Skill「gsap-plugins」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-56fa4cf96790a2d4-Gsap-%E6%8F%92%E4%BB%B6.html 请存为 .cursor/skills/gsap-plugins/SKILL.md 或 .claude/skills/gsap-plugins/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。
npx skills add 'https://github.com/nexu-io/open-design/tree/HEAD/skills/gsap-plugins' --list
npx skills add 'https://github.com/nexu-io/open-design/tree/HEAD/skills/gsap-plugins' --skill 'gsap-plugins'
CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。
`. |
| **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 `` cannot be visually changed. **DrawSVGPlugin.getLength(element)** and **DrawSVGPlugin.getPosition(element)** return stroke length and current position.
**Learn more:** [DrawSVG](https://gsap.com/docs/v3/Plugins/DrawSVGPlugin)
### MorphSVG (MorphSVGPlugin)
Morphs one SVG shape into another by animating the `d` attribute (path data). Start and end shapes do not need the same number of points — MorphSVG converts to cubic beziers and adds points as needed. Use for icon-to-icon morphs, shape transitions, or path-based animations. Works on ``, ``, and ``; ``, ``, ``, and `` are converted internally or via **MorphSVGPlugin.convertToPath(selector | element)** (replaces the element in the DOM with a ``).
**morphSVG value:** Can be a **selector** (e.g. `"#lightning"`), an **element**, **raw path data** (e.g. `"M47.1,0.8 73.3,0.8..."`), or for polygon/polyline a **points string** (e.g. `"240,220 240,70 70,70 70,220"`). For full config use the **object form** with **shape** as the only required property.
```javascript
gsap.registerPlugin(MorphSVGPlugin);
// convert primitives to path first if needed:
MorphSVGPlugin.convertToPath("circle, rect, ellipse, line");
gsap.to("#diamond", { duration: 1, morphSVG: "#lightning", ease: "power2.inOut" });
// object form:
gsap.to("#diamond", {
duration: 1,
morphSVG: { shape: "#lightning", type: "rotational", shapeIndex: 2 }
});
```
**MorphSVG — key config (morphSVG object):**
| Option | Description |
|--------|-------------|
| **shape** | _(Required.)_ Target shape: selector, element, or raw path string. |
| **type** | `"linear"` (default) or `"rotational"`. Rotational uses angle/length interpolation and can avoid kinks mid-morph; try it when linear looks wrong. |
| **map** | How segments are matched: `"size"` (default), `"position"`, or `"complexity"`. Use when start/end segments don’t line up; if none work, split into multiple paths and morph each. |
| **shapeIndex** | Offsets which point in the start path maps to the first point in the end path (avoids shape “crossing over” or inverting). Number for single-segment paths; **array** for multi-segment (e.g. `[5, 1, -8]`). Negative reverses that segment. Use **shapeIndex: "log"** once to log the auto-calculated value, then paste the number/array into the tween. **findShapeIndex(start, end)** (separate utility) provides an interactive UI to find a good value. Only applies to closed paths. |
| **smooth** | (v3.14+). Adds smoothing points. Number (e.g. `80`), `"auto"`, or object: `{ points: 40 \| "auto", redraw: true \| false, persist: true \| false }`. `redraw: false` keeps original anchors (perfect fidelity, less even spacing). `persist: false` removes added points when the tween ends. Use when the default morph looks jagged or unnatural. |
| **curveMode** | Boolean (v3.14+). Interpolates control-handle angle/length instead of raw x/y to avoid kinks on curves. Try if a morph has a mid-morph kink. |
| **origin** | Rotation origin for **type: "rotational"**. String: `"50% 50%"` (default) or `"20% 60%, 35% 90%"` for different start/end origins. |
| **precision** | Decimal places for output path data; default `2`. |
| **precompile** | Array of precomputed path strings (or use **precompile: "log"** once, copy from console). Skips expensive startup calculations; use for very complex morphs. Only for `` (convert polygon/polyline first). |
| **render** | Function(rawPath, target) called each update — e.g. draw to canvas. RawPath is an array of segments (each segment = array of alternating x,y cubic bezier coords). |
| **updateTarget** | When using **render** (e.g. canvas-only), set **updateTarget: false** so the original `` is not updated. **MorphSVGPlugin.defaultUpdateTarget** sets default. |
**Utilities:** **MorphSVGPlugin.convertToPath(selector | element)** converts circle/rect/ellipse/line/polygon/polyline to `` in the DOM. **MorphSVGPlugin.rawPathToString(rawPath)** and **stringToRawPath(d)** convert between path strings and raw arrays. The plugin stores the original `d` on the target (e.g. for tweening back: `morphSVG: "#originalId"` or the same element).
**Tips:** For twisted or inverted morphs, set **shapeIndex** (use `"log"` or findShapeIndex()). For multi-segment paths, **shapeIndex** is an array (one value per segment). Precompile only when the first frame is slow; it does not fix jank during the tween (simplify the SVG or reduce size if needed).
**Learn more:** [MorphSVG](https://gsap.com/docs/v3/Plugins/MorphSVGPlugin)
### MotionPath (MotionPathPlugin)
Animates an element along an SVG path. Use when moving an object along a path (e.g. a curve or custom route).
```javascript
gsap.registerPlugin(MotionPathPlugin);
gsap.to(".dot", {
duration: 2,
motionPath: { path: "#path", align: "#path", alignOrigin: [0.5, 0.5] }
});
```
**MotionPath — key config (motionPath object):**
| Option | Description |
|--------|-------------|
| `path` | SVG path element, selector, or path data string |
| `align` | Path element or selector to align the target to |
| `alignOrigin` | `[x, y]` origin (0–1); default `[0.5, 0.5]` |
| `autoRotate` | Rotate element to follow path tangent |
| `curviness` | 0–2; path smoothing |
### MotionPathHelper
Visual editor for MotionPath (alignment, offset). Use during development to tune path alignment.
```javascript
gsap.registerPlugin(MotionPathPlugin, MotionPathHelperPlugin);
const helper = MotionPathHelper.create(".dot", "#path", { end: 0.5 });
// adjust in UI, then use helper.path or helper.getProgress() in your animation
```
## Easing
### CustomEase
Custom easing curves (cubic-bezier or SVG path). Use when a built-in ease is not enough. Basic usage is covered in gsap-core; register when using:
```javascript
gsap.registerPlugin(CustomEase);
const ease = CustomEase.create("name", ".17,.67,.83,.67");
gsap.to(".el", { x: 100, ease: ease, duration: 1 });
```
### EasePack
Adds more named eases (e.g. SlowMo, RoughEase, ExpoScaleEase). Register and use the ease names in tweens.
### CustomWiggle
Wiggle/shake easing. Use when a value should “wiggle” (multiple oscillations).
### CustomBounce
Bounce-style easing with configurable strength.
## Physics
### Physics2D (Physics2DPlugin)
2D physics (velocity, angle, gravity). Use when animating with simple physics (e.g. projectiles, bouncing).
```javascript
gsap.registerPlugin(Physics2DPlugin);
gsap.to(".ball", {
duration: 2,
physics2D: {
velocity: 250,
angle: 80,
gravity: 500
}
});
```
### PhysicsProps (PhysicsPropsPlugin)
Applies physics to property values. Use for physics-driven property animation.
```javascript
gsap.registerPlugin(PhysicsPropsPlugin);
gsap.to(".obj", {
duration: 2,
physicsProps: {
x: { velocity: 100, end: 300 },
y: { velocity: -50, acceleration: 200 }
}
});
```
## Development
### GSDevTools
UI for scrubbing timelines, toggling animations, and debugging. Use during development only; do not ship. Register and create an instance with a timeline reference.
```javascript
gsap.registerPlugin(GSDevTools);
GSDevTools.create({ animation: tl });
```
## Other
### Pixi (PixiPlugin)
Integrates GSAP with PixiJS for animating Pixi display objects. Register when animating Pixi objects with GSAP.
```javascript
gsap.registerPlugin(PixiPlugin);
const sprite = new PIXI.Sprite(texture);
gsap.to(sprite, { pixi: { x: 200, y: 100, scale: 1.5 }, duration: 1 });
```
## Best practices
- ✅ Register every plugin used with **gsap.registerPlugin()** before first use.
- ✅ Use **Flip.getState()** → DOM change → **Flip.from()** for layout transitions; use **Draggable** + **InertiaPlugin** for drag with momentum.
- ✅ Revert plugin instances (e.g. `SplitTextInstance.revert()`) when components unmount or elements are removed.
## Do Not
- ❌ Use a plugin in a tween or API without registering it first (**gsap.registerPlugin()**).
- ❌ Ship GSDevTools or development-only plugins to production.
### Learn More
https://gsap.com/docs/v3/Plugins/Agent 工作流
创造有效技能指南。 当用户想创造出新的技能(或更新现有的技能),以专业知识,工作流程,或工具集成来扩展克洛德的能力时,应该使用这种技能.
Agent 工作流
使用ClawdHub CLI搜索,安装,更新并发布从taladhub.com的代理技能. 需要获取苍蝇上的新技能时使用,将安装的技能同步到最新版本或特定版本,或者发布 npm-instainddhub CLI 的新/更新的技能文件夹.
Agent 工作流
管弦乐团多代理团队,任务设定周期,交接协议,审查工作流程. 使用时间: (1)建立2+特派员队伍,具有不同专业,(2)确定任务路线和生命周期(收录框_ spec_建设_审查_完成),(3)在特派员之间制定交接协议,(4)建立审查和质量关口,(5)管理特派员之间的交流和文物共享.
Agent 工作流
Spec-first,TDD,子代理驱动的软件开发工作流程. 当:(1)构建任何新功能或应用——触发脑暴_计划_子代理执行回路,(2)调试出一个bug或测试失败——触发系统性的根起过程,(3)用户说"让我们构建","帮助我计划","我想添加X",或"这个被打破",(4)完成一个功…