gsap-plugins
Skill này làm gì
Công cụ này giúp bạn dùng các “plugin” (tiện ích bổ sung) của thư viện GSAP. Nó cho phép đăng ký các plugin và dùng các tính năng như cuộn trang đến một vị trí cụ thể (ScrollToPlugin), làm hoạt ảnh thay đổi bố cục (Flip), cho phép kéo thả phần tử (Draggable) và nhiều tính năng khác.
Khi nào nên dùng
- ✓Khi bạn muốn đăng ký một plugin GSAP trong code.
- ✓Khi bạn tạo hoạt ảnh cuộn để đến một điểm cụ thể trên trang.
- ✓Khi bạn cần làm cho phần tử kéo thả được trên màn hình.
Liên kết skill
https://github.com/nexu-io/open-design/blob/main/skills/gsap-plugins/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Làm sao để đăng ký ScrollToPlugin trong GSAP?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Bạn dùng hàm `gsap.registerPlugin()` để báo cho GSAP biết những plugin bổ sung nào bạn sẽ dùng. Sau đó bạn có thể gọi các hàm cụ thể của từng plugin.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
GSAP Plugins
Curated from GreenSock's official GSAP skills: https://github.com/greensock/gsap-skills
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.
Licensing & Install (important)
Every GSAP plugin is free, including for commercial use. Since Webflow's acquisition of GSAP, Club GSAP is no longer a paid tier and no plugin requires a membership, license key, or auth token — this includes formerly Club-only plugins (SplitText, MorphSVG, etc.).
- ✅ Install everything from the public
gsapnpm package:npm install gsap. All plugins are included — import them asgsap/SplitText,gsap/MorphSVGPlugin, etc. - ❌ Do not generate an
.npmrcwith a GreenSock auth token, suggest the privatenpm.greensock.comregistry, or tell users to sign up for Club GSAP to access a plugin. Those instructions are outdated.
Registering Plugins
Register each plugin once so GSAP (and bundlers) know to include it. Use gsap.registerPlugin() with every plugin used in the project:
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.
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:
<body>
<div id="smooth-wrapper">
<div id="smooth-content">
<!--- ALL YOUR CONTENT HERE --->
</div>
</div>
<!-- position: fixed elements can go outside --->
</body>
DOM / UI
Flip
Capture state with Flip.getState(), then apply changes (e.g. layout or class changes), then use Flip.from() to animate from the previous state to the new state (FLIP: First, Last, Invert, Play). Use when animating between two layout states (lists, grids, expanded/collapsed).
gsap.registerPlugin(Flip);
const state = Flip.getState(".item");
// change DOM (reorder, add/remove, change classes)
Flip.from(state, { duration: 0.5, ease: "power2.inOut" });
Flip — key config (Flip.from vars):
| Option | Description |
|---|---|
absolute |
Use position: absolute during the flip (default: false) |
nested |
When true, only the first level of children is measured (better for nested transforms) |
scale |
When true, scale elements to fit (avoids stretch); default true |
simple |
When true, only position/scale are animated (faster, less accurate) |
duration, ease |
Standard tween options |
More information
https://gsap.com/docs/v3/Plugins/Flip
Draggable
Makes elements draggable, spinnable, or throwable with mouse/touch. Use for sliders, cards, reorderable lists, or any drag interaction.
gsap.registerPlugin(Draggable, InertiaPlugin);
…
Câu hỏi thường gặp
Tất cả plugin GSAP có phải trả phí không?
Không, tất cả plugin GSAP đều miễn phí, kể cả dùng thương mại. Bạn không cần giấy phép hay đăng ký để dùng bất kỳ plugin nào.
Tôi có cần cài plugin riêng không?
Không, mọi plugin đã có sẵn trong gói GSAP chính. Bạn chỉ cần nhập và đăng ký chúng trong code.
Khác nhau giữa ScrollToPlugin và ScrollTrigger là gì?
ScrollToPlugin dùng để hoạt ảnh vị trí cuộn của trang đến một điểm cụ thể. ScrollTrigger phức tạp hơn và cho phép kích hoạt hoạt ảnh dựa trên vị trí cuộn.
Chi tiết
Mô tả gốc của tác giả
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.
repo: nexu-io/open-design
Độ phổ biến
- Sao GitHub
- 101k
- Vị trí xếp hạng
- #1182
- Giấy phép
- Apache-2.0
- Cập nhật
- 15/10/2026
Bình luận
- …
Thêm skill từ kho mã này
sample-plugin
101kGiúp agent của bạn tạo một tệp metadata cho các bài kiểm thử. Nó giúp đảm bảo mã nguồn chạy đúng trong nhiều tình huống khác nhau.
aster-atelier
101kGiúp agent của bạn tạo một website nghệ thuật theo phong cách cổ điển. Nó dùng hình ảnh tinh tế, bầu trời xanh và phông chữ serif để tạo cảm giác điện ảnh.
audio-jingle
101kGiúp agent của bạn tạo âm thanh như nhạc hiệu và hiệu ứng âm thanh. Nó có thể tạo nhạc và giọng nói, rồi lưu kết quả thành tệp âm thanh.
blog-post
101kGiúp agent của bạn viết bài báo dài hoặc bài blog. Có chỗ dành cho hình ảnh, trích dẫn và thông tin tác giả.
Skill tương tự
angular-developer
280kGiúp agent của bạn viết code Angular và tư vấn cấu trúc dự án, hữu ích khi bắt đầu dự án mới hoặc cải thiện hiệu suất.
frontend-a11y
280kGiúp agent của bạn làm cho giao diện web dễ tiếp cận với mọi người. Đảm bảo website và ứng dụng hoạt động tốt với trình đọc màn hình và điều hướng bằng bàn phím.
frontend-patterns
280kGiúp agent của bạn áp dụng các mẫu hiện đại trong phát triển frontend. Tối ưu hiệu năng, quản lý trạng thái và tuân theo thực hành tốt nhất với React và Next.js.