Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)101k · #1182

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.md

Sao 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

Hãy dùng skill này để giúp tôi: https://github.com/nexu-io/open-design/blob/main/skills/gsap-plugins/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

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 gsap npm package: npm install gsap. All plugins are included — import them as gsap/SplitText, gsap/MorphSVGPlugin, etc.
  • ❌ Do not generate an .npmrc with a GreenSock auth token, suggest the private npm.greensock.com registry, 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

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự