@istmx/skills 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -20
- package/bin/cli.js +50 -24
- package/istm-animate/SKILL.md +31 -26
- package/istm-animate/core/motion-principles/SKILL.md +284 -0
- package/istm-animate/core/motion-principles/references/designers.md +127 -0
- package/istm-animate/core/motion-principles/references/easing-guide.md +231 -0
- package/istm-animate/core/motion-principles/references/enter-exit-recipes.md +466 -0
- package/istm-animate/frameworks/canvas-generative/SKILL.md +325 -0
- package/istm-animate/frameworks/canvas-generative/references/algorithms.md +925 -0
- package/istm-animate/frameworks/css-native/SKILL.md +319 -0
- package/istm-animate/frameworks/css-native/references/modern-css.md +465 -0
- package/istm-animate/frameworks/framer-motion/SKILL.md +187 -0
- package/istm-animate/frameworks/framer-motion/references/api.md +312 -0
- package/istm-animate/frameworks/gsap/SKILL.md +188 -0
- package/istm-animate/frameworks/gsap/references/core.md +218 -0
- package/istm-animate/frameworks/gsap/references/plugins.md +371 -0
- package/istm-animate/frameworks/gsap/references/scrolltrigger.md +325 -0
- package/istm-animate/frameworks/gsap/references/timeline.md +218 -0
- package/istm-animate/frameworks/threejs-r3f/SKILL.md +243 -0
- package/istm-animate/frameworks/threejs-r3f/references/scene-setup.md +392 -0
- package/istm-animate/frameworks/threejs-r3f/references/shaders.md +446 -0
- package/istm-animate/mobile/android/compose-graphics/SKILL.md +503 -0
- package/istm-animate/mobile/android/compose-graphics/references/agsl-recipes.md +356 -0
- package/istm-animate/mobile/android/compose-graphics/references/canvas-generative.md +282 -0
- package/istm-animate/mobile/android/compose-graphics/references/m3-expressive-deep.md +303 -0
- package/istm-animate/mobile/android/compose-motion/SKILL.md +359 -0
- package/istm-animate/mobile/android/compose-motion/references/gestures-compose.md +273 -0
- package/istm-animate/mobile/android/compose-motion/references/recomposition-and-anim.md +196 -0
- package/istm-animate/mobile/android/compose-motion/references/shared-transitions.md +281 -0
- package/istm-animate/mobile/android/compose-multiplatform/SKILL.md +311 -0
- package/istm-animate/mobile/android/compose-multiplatform/references/cmp-interop.md +288 -0
- package/istm-animate/mobile/android/compose-multiplatform/references/cmp-platform-quirks.md +156 -0
- package/istm-animate/mobile/apple/swiftui-graphics/SKILL.md +408 -0
- package/istm-animate/mobile/apple/swiftui-graphics/references/canvas-swiftui.md +239 -0
- package/istm-animate/mobile/apple/swiftui-graphics/references/liquid-glass-deep.md +252 -0
- package/istm-animate/mobile/apple/swiftui-graphics/references/metal-recipes.md +382 -0
- package/istm-animate/mobile/apple/swiftui-motion/SKILL.md +379 -0
- package/istm-animate/mobile/apple/swiftui-motion/references/gestures-swiftui.md +336 -0
- package/istm-animate/mobile/apple/swiftui-motion/references/phase-keyframe-deep.md +231 -0
- package/istm-animate/mobile/apple/swiftui-motion/references/springs-cheatsheet.md +129 -0
- package/istm-animate/references/animate.md +199 -0
- package/istm-animate/references/audit.md +115 -0
- package/istm-animate/references/design-engineering.md +674 -0
- package/istm-animate/references/improve.md +101 -0
- package/istm-animate/references/opportunities.md +132 -0
- package/istm-animate/references/plan-template.md +73 -0
- package/istm-animate/references/recipes.md +324 -0
- package/istm-animate/references/review.md +112 -0
- package/istm-animate/references/standards.md +187 -0
- package/istm-animate/references/vocabulary.md +173 -0
- package/istm-awwward-designer/SKILL.md +29 -17
- package/istm-design/SKILL.md +31 -59
- package/istm-design/core/design-audit/SKILL.md +248 -0
- package/istm-design/core/desktop-principles/SKILL.md +363 -0
- package/istm-design/core/desktop-principles/references/keyboard-patterns.md +137 -0
- package/istm-design/core/desktop-principles/references/multi-window.md +105 -0
- package/istm-design/core/mobile-principles/SKILL.md +289 -0
- package/istm-design/core/mobile-principles/references/accessibility-mobile.md +175 -0
- package/istm-design/core/mobile-principles/references/gestures-deep.md +220 -0
- package/istm-design/core/ui-ux-pro-max/SKILL.md +392 -0
- package/istm-design/core/ui-ux-pro-max/UPSTREAM.md +23 -0
- package/istm-design/core/ui-ux-pro-max/data/app-interface.csv +31 -0
- package/istm-design/core/ui-ux-pro-max/data/charts.csv +26 -0
- package/istm-design/core/ui-ux-pro-max/data/colors.csv +193 -0
- package/istm-design/core/ui-ux-pro-max/data/google-fonts.csv +1924 -0
- package/istm-design/core/ui-ux-pro-max/data/icons.csv +106 -0
- package/istm-design/core/ui-ux-pro-max/data/landing.csv +35 -0
- package/istm-design/core/ui-ux-pro-max/data/motion.csv +17 -0
- package/istm-design/core/ui-ux-pro-max/data/products.csv +193 -0
- package/istm-design/core/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/angular.csv +51 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/avalonia.csv +57 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/javafx.csv +76 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/laravel.csv +51 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/nuxt-ui.csv +71 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/threejs.csv +54 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/uno.csv +60 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/uwp.csv +56 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/winui.csv +60 -0
- package/istm-design/core/ui-ux-pro-max/data/stacks/wpf.csv +57 -0
- package/istm-design/core/ui-ux-pro-max/data/styles.csv +85 -0
- package/istm-design/core/ui-ux-pro-max/data/typography.csv +75 -0
- package/istm-design/core/ui-ux-pro-max/data/ui-reasoning.csv +162 -0
- package/istm-design/core/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/istm-design/core/ui-ux-pro-max/references/pro-rules.md +109 -0
- package/istm-design/core/ui-ux-pro-max/references/quick-reference.md +240 -0
- package/istm-design/core/ui-ux-pro-max/scripts/core.py +464 -0
- package/istm-design/core/ui-ux-pro-max/scripts/design_system.py +1371 -0
- package/istm-design/core/ui-ux-pro-max/scripts/search.py +162 -0
- package/istm-design/core/ui-ux-pro-max/scripts/tests/test_core.py +134 -0
- package/istm-design/core/ui-ux-pro-max/scripts/validate_data.py +114 -0
- package/istm-design/references/apple-design.md +282 -0
- package/istm-design/references/generation-guide.md +209 -0
- package/istm-design/references/pick-ui-library.md +77 -0
- package/istm-design/references/picker.md +197 -0
- package/istm-design/references/prototype.md +90 -0
- package/istm-design/references/schema.md +366 -0
- package/package.json +1 -1
- package/RELEASE_v1.2.0.md +0 -40
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# GSAP Core API
|
|
2
|
+
|
|
3
|
+
## Tween Methods
|
|
4
|
+
|
|
5
|
+
### gsap.to(targets, vars)
|
|
6
|
+
|
|
7
|
+
Animates properties TO the specified values.
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
gsap.to(".box", {
|
|
11
|
+
x: 200, // translateX
|
|
12
|
+
y: -50, // translateY
|
|
13
|
+
rotation: 360, // rotate in degrees
|
|
14
|
+
scale: 1.5,
|
|
15
|
+
opacity: 0.5,
|
|
16
|
+
duration: 1,
|
|
17
|
+
ease: "power2.out",
|
|
18
|
+
delay: 0.3,
|
|
19
|
+
});
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`targets`: CSS selector string, element, Array of elements, NodeList, or JS object.
|
|
23
|
+
|
|
24
|
+
### gsap.from(targets, vars)
|
|
25
|
+
|
|
26
|
+
Animates FROM the specified values to the current state.
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
gsap.from(".box", { y: 100, opacity: 0, duration: 0.8 });
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Warning**: `immediateRender` is `true` by default on `from()`. The element jumps to the `from` values immediately. Set `immediateRender: false` if needed.
|
|
33
|
+
|
|
34
|
+
### gsap.fromTo(targets, fromVars, toVars)
|
|
35
|
+
|
|
36
|
+
Full control over both the start AND the end.
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
gsap.fromTo(".box",
|
|
40
|
+
{ x: -100, opacity: 0 }, // from
|
|
41
|
+
{ x: 0, opacity: 1, duration: 1 } // to (options here)
|
|
42
|
+
);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### gsap.set(targets, vars)
|
|
46
|
+
|
|
47
|
+
Applies values immediately (duration: 0). Equivalent to `gsap.to(target, { ...vars, duration: 0 })`.
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
gsap.set(".box", { x: 0, y: 0, opacity: 1, clearProps: "all" });
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`clearProps: "all"` removes all inline styles applied by GSAP.
|
|
54
|
+
|
|
55
|
+
## Tween Options
|
|
56
|
+
|
|
57
|
+
| Option | Type | Default | Description |
|
|
58
|
+
| ----------------- | ----------------- | --------- | ----------------------------------------------------------- |
|
|
59
|
+
| `duration` | number | `0.5` | Duration in seconds |
|
|
60
|
+
| `ease` | string | `"power1.out"` | Animation curve |
|
|
61
|
+
| `delay` | number | `0` | Delay before start |
|
|
62
|
+
| `repeat` | number | `0` | Number of repetitions (`-1` = infinite) |
|
|
63
|
+
| `yoyo` | boolean | `false` | Alternates direction on each repeat |
|
|
64
|
+
| `repeatDelay` | number | `0` | Delay between each repeat |
|
|
65
|
+
| `stagger` | number/object | `0` | Delay between each target |
|
|
66
|
+
| `overwrite` | boolean/string | `false` | `true` kills conflicting tweens, `"auto"` conflicting props |
|
|
67
|
+
| `immediateRender` | boolean | auto | `true` on from/fromTo, `false` on to |
|
|
68
|
+
| `paused` | boolean | `false` | Creates the tween paused |
|
|
69
|
+
| `reversed` | boolean | `false` | Plays in reverse |
|
|
70
|
+
| `onStart` | function | null | Callback on start |
|
|
71
|
+
| `onUpdate` | function | null | Callback on each frame |
|
|
72
|
+
| `onComplete` | function | null | Callback on complete |
|
|
73
|
+
| `onRepeat` | function | null | Callback on each repeat |
|
|
74
|
+
| `onReverseComplete` | function | null | Callback when reverse reaches the start |
|
|
75
|
+
| `callbackScope` | object | tween | `this` scope of the callbacks |
|
|
76
|
+
|
|
77
|
+
## Easing
|
|
78
|
+
|
|
79
|
+
Format: `"type.direction"`, e.g. `"power2.out"`, `"elastic.inOut"`, `"back.in"`.
|
|
80
|
+
|
|
81
|
+
Common types:
|
|
82
|
+
- `none` (linear), `power1`-`power4`, `back`, `elastic`, `bounce`, `circ`, `expo`, `sine`
|
|
83
|
+
- `steps(n)` -> stepped animation
|
|
84
|
+
- `"slow(0.7, 0.7, false)"` -> slow-mo effect
|
|
85
|
+
- Custom: `CustomEase.create("myEase", "M0,0 C0.5,0 0.5,1 1,1")`
|
|
86
|
+
|
|
87
|
+
## Stagger
|
|
88
|
+
|
|
89
|
+
### Simple
|
|
90
|
+
|
|
91
|
+
```js
|
|
92
|
+
gsap.to(".item", { y: -20, stagger: 0.1 }); // 0.1s between each element
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Object config
|
|
96
|
+
|
|
97
|
+
```js
|
|
98
|
+
gsap.to(".item", {
|
|
99
|
+
y: -20,
|
|
100
|
+
stagger: {
|
|
101
|
+
each: 0.1, // time between each element
|
|
102
|
+
// OR amount: 0.8, // TOTAL time for the stagger (divided by N elements)
|
|
103
|
+
from: "center", // "start" | "end" | "center" | "edges" | "random" | number (index)
|
|
104
|
+
grid: "auto", // enables 2D distribution, detects the grid
|
|
105
|
+
axis: "y", // "x" | "y" | null (2D distance)
|
|
106
|
+
ease: "power2.in", // ease of the stagger distribution
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Animatable CSS Properties
|
|
112
|
+
|
|
113
|
+
### Transforms (GPU -> prefer these)
|
|
114
|
+
|
|
115
|
+
| GSAP shorthand | CSS equivalent |
|
|
116
|
+
| --------------- | ---------------------- |
|
|
117
|
+
| `x` | `translateX` |
|
|
118
|
+
| `y` | `translateY` |
|
|
119
|
+
| `z` | `translateZ` |
|
|
120
|
+
| `rotation` | `rotate` (in degrees) |
|
|
121
|
+
| `rotationX/Y` | `rotateX/Y` |
|
|
122
|
+
| `scale` | `scale` |
|
|
123
|
+
| `scaleX/Y` | `scaleX/Y` |
|
|
124
|
+
| `skewX/Y` | `skewX/Y` |
|
|
125
|
+
| `xPercent` | `translateX(%)` |
|
|
126
|
+
| `yPercent` | `translateY(%)` |
|
|
127
|
+
| `transformOrigin` | `transform-origin` |
|
|
128
|
+
|
|
129
|
+
### Other properties
|
|
130
|
+
|
|
131
|
+
- `opacity`, `borderRadius`, `backgroundColor`, `color`, `boxShadow`
|
|
132
|
+
- CSS variables: `gsap.to(el, { "--my-var": 100 })`
|
|
133
|
+
- SVG: `attr: { cx: 200, r: 50 }` for SVG attributes
|
|
134
|
+
|
|
135
|
+
## Utilities
|
|
136
|
+
|
|
137
|
+
### gsap.defaults(vars)
|
|
138
|
+
|
|
139
|
+
Applies defaults to ALL tweens created after this call.
|
|
140
|
+
|
|
141
|
+
```js
|
|
142
|
+
gsap.defaults({ duration: 0.8, ease: "power2.out" });
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### gsap.registerPlugin(...plugins)
|
|
146
|
+
|
|
147
|
+
Registers plugins. Call once, at the top level.
|
|
148
|
+
|
|
149
|
+
```js
|
|
150
|
+
import { ScrollTrigger, SplitText, Flip } from "gsap/all";
|
|
151
|
+
gsap.registerPlugin(ScrollTrigger, SplitText, Flip);
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### gsap.quickTo(target, prop, vars)
|
|
155
|
+
|
|
156
|
+
Creates a reusable function to animate a property (ideal for mouse-follow).
|
|
157
|
+
|
|
158
|
+
```js
|
|
159
|
+
const xTo = gsap.quickTo(".cursor", "x", { duration: 0.3, ease: "power3" });
|
|
160
|
+
const yTo = gsap.quickTo(".cursor", "y", { duration: 0.3, ease: "power3" });
|
|
161
|
+
|
|
162
|
+
window.addEventListener("mousemove", (e) => {
|
|
163
|
+
xTo(e.clientX);
|
|
164
|
+
yTo(e.clientY);
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### gsap.quickSetter(target, prop, unit)
|
|
169
|
+
|
|
170
|
+
Like quickTo but instant (no interpolation). Ultra performant for onUpdate.
|
|
171
|
+
|
|
172
|
+
```js
|
|
173
|
+
const setX = gsap.quickSetter(".el", "x", "px");
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### gsap.utils
|
|
177
|
+
|
|
178
|
+
```js
|
|
179
|
+
gsap.utils.toArray(".items") // NodeList -> Array
|
|
180
|
+
gsap.utils.clamp(0, 100, value) // clamps the value
|
|
181
|
+
gsap.utils.mapRange(0, 1, 0, 100, 0.5) // map 0.5 -> 50
|
|
182
|
+
gsap.utils.wrap([1, 2, 3], 5) // cycle: returns 3
|
|
183
|
+
gsap.utils.interpolate(0, 100, 0.5) // returns 50
|
|
184
|
+
gsap.utils.random(1, 10, 1) // random between 1-10, step 1
|
|
185
|
+
gsap.utils.shuffle(array) // shuffles the array
|
|
186
|
+
gsap.utils.distribute({ amount: 1, from: "center" }) // distribution function
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### gsap.context()
|
|
190
|
+
|
|
191
|
+
Scope for easy cleanup (crucial in React/Vue). Replace with `useGSAP()` in React.
|
|
192
|
+
|
|
193
|
+
```js
|
|
194
|
+
const ctx = gsap.context(() => {
|
|
195
|
+
gsap.to(".box", { x: 200 });
|
|
196
|
+
ScrollTrigger.create({ ... });
|
|
197
|
+
}, containerRef); // scope selectors to the container
|
|
198
|
+
|
|
199
|
+
// Cleanup
|
|
200
|
+
ctx.revert(); // kills everything: tweens, ScrollTriggers, etc.
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Controlling a Tween
|
|
204
|
+
|
|
205
|
+
```js
|
|
206
|
+
const tween = gsap.to(".box", { x: 200, paused: true });
|
|
207
|
+
|
|
208
|
+
tween.play();
|
|
209
|
+
tween.pause();
|
|
210
|
+
tween.reverse();
|
|
211
|
+
tween.restart();
|
|
212
|
+
tween.kill();
|
|
213
|
+
|
|
214
|
+
tween.progress(0.5); // jumps to 50%
|
|
215
|
+
tween.timeScale(2); // 2x faster
|
|
216
|
+
tween.duration(); // getter
|
|
217
|
+
tween.duration(2); // setter
|
|
218
|
+
```
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
# GSAP Plugins
|
|
2
|
+
|
|
3
|
+
## SplitText (Free since v3.12)
|
|
4
|
+
|
|
5
|
+
Splits text into `chars`, `words`, `lines` for granular animations.
|
|
6
|
+
|
|
7
|
+
### Usage
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
import { SplitText } from "gsap/SplitText";
|
|
11
|
+
gsap.registerPlugin(SplitText);
|
|
12
|
+
|
|
13
|
+
const split = SplitText.create(".headline", {
|
|
14
|
+
type: "chars, words, lines",
|
|
15
|
+
mask: "lines", // masks lines (clip overflow for reveal)
|
|
16
|
+
linesClass: "line",
|
|
17
|
+
charsClass: "char",
|
|
18
|
+
wordsClass: "word",
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Animate chars
|
|
22
|
+
gsap.from(split.chars, {
|
|
23
|
+
y: 50,
|
|
24
|
+
opacity: 0,
|
|
25
|
+
stagger: 0.03,
|
|
26
|
+
duration: 0.6,
|
|
27
|
+
ease: "power3.out",
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### autoSplit + onSplit (v3.13+)
|
|
32
|
+
|
|
33
|
+
Automatic re-split on resize (when lines change).
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
SplitText.create(".text", {
|
|
37
|
+
type: "lines, words",
|
|
38
|
+
mask: "lines",
|
|
39
|
+
autoSplit: true, // re-split au resize
|
|
40
|
+
onSplit(self) {
|
|
41
|
+
return gsap.from(self.words, {
|
|
42
|
+
y: "100%",
|
|
43
|
+
opacity: 0,
|
|
44
|
+
stagger: 0.04,
|
|
45
|
+
duration: 0.7,
|
|
46
|
+
});
|
|
47
|
+
// Returning the tween allows autoSplit to kill/recreate it
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Revert
|
|
53
|
+
|
|
54
|
+
Always revert after animation to clean up the DOM.
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
// BAD — spans remain in the DOM indefinitely
|
|
58
|
+
const split = SplitText.create(".text", { type: "chars" });
|
|
59
|
+
gsap.from(split.chars, { opacity: 0 });
|
|
60
|
+
|
|
61
|
+
// GOOD — revert when the animation is finished
|
|
62
|
+
const split = SplitText.create(".text", { type: "chars" });
|
|
63
|
+
gsap.from(split.chars, {
|
|
64
|
+
opacity: 0,
|
|
65
|
+
stagger: 0.02,
|
|
66
|
+
onComplete: () => split.revert(),
|
|
67
|
+
});
|
|
68
|
+
// OR use autoSplit + onSplit which handles the cycle automatically
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Flip
|
|
72
|
+
|
|
73
|
+
Animates layout changes (position, size) with a smooth transition. FLIP technique: First, Last, Invert, Play.
|
|
74
|
+
|
|
75
|
+
### Usage
|
|
76
|
+
|
|
77
|
+
```js
|
|
78
|
+
import { Flip } from "gsap/Flip";
|
|
79
|
+
gsap.registerPlugin(Flip);
|
|
80
|
+
|
|
81
|
+
// 1. Capture the current state
|
|
82
|
+
const state = Flip.getState(".items");
|
|
83
|
+
|
|
84
|
+
// 2. Modify the DOM / layout
|
|
85
|
+
container.appendChild(movedElement);
|
|
86
|
+
// or toggle a class, reorder, etc.
|
|
87
|
+
|
|
88
|
+
// 3. Animate from the old state to the new one
|
|
89
|
+
Flip.from(state, {
|
|
90
|
+
duration: 0.8,
|
|
91
|
+
ease: "power2.inOut",
|
|
92
|
+
stagger: 0.05,
|
|
93
|
+
absolute: true, // uses position absolute during the animation
|
|
94
|
+
onEnter: (elements) => gsap.fromTo(elements, { opacity: 0, scale: 0 }, { opacity: 1, scale: 1 }),
|
|
95
|
+
onLeave: (elements) => gsap.to(elements, { opacity: 0, scale: 0 }),
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Flip.fit()
|
|
100
|
+
|
|
101
|
+
Matches the size/position of one element to another.
|
|
102
|
+
|
|
103
|
+
```js
|
|
104
|
+
// Makes .box match the position/size of .target
|
|
105
|
+
Flip.fit(".box", ".target", {
|
|
106
|
+
scale: true, // uses scale instead of width/height
|
|
107
|
+
duration: 0.5,
|
|
108
|
+
});
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Flip pitfall
|
|
112
|
+
|
|
113
|
+
```js
|
|
114
|
+
// BAD — getState AFTER the DOM change = no reference
|
|
115
|
+
container.appendChild(element);
|
|
116
|
+
const state = Flip.getState(".items"); // TOO LATE
|
|
117
|
+
|
|
118
|
+
// GOOD — getState BEFORE the change
|
|
119
|
+
const state = Flip.getState(".items");
|
|
120
|
+
container.appendChild(element);
|
|
121
|
+
Flip.from(state, { duration: 0.6 });
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## MorphSVG
|
|
125
|
+
|
|
126
|
+
Morphs one SVG path into another.
|
|
127
|
+
|
|
128
|
+
### Usage
|
|
129
|
+
|
|
130
|
+
```js
|
|
131
|
+
import { MorphSVGPlugin } from "gsap/MorphSVGPlugin";
|
|
132
|
+
gsap.registerPlugin(MorphSVGPlugin);
|
|
133
|
+
|
|
134
|
+
gsap.to("#circle", {
|
|
135
|
+
morphSVG: "#star", // target shape (selector or path data)
|
|
136
|
+
duration: 1.5,
|
|
137
|
+
ease: "power2.inOut",
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
// With path data string
|
|
141
|
+
gsap.to("#shape", {
|
|
142
|
+
morphSVG: "M10,10 C20,20 40,20 50,10",
|
|
143
|
+
duration: 1,
|
|
144
|
+
});
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### findShapeIndex
|
|
148
|
+
|
|
149
|
+
Interactive tool to find the best starting point for the morph.
|
|
150
|
+
|
|
151
|
+
```js
|
|
152
|
+
// Dev only — opens an interactive tool
|
|
153
|
+
MorphSVGPlugin.findShapeIndex("#circle", "#star");
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Convert primitives to path
|
|
157
|
+
|
|
158
|
+
```js
|
|
159
|
+
// Converts rect, circle, ellipse, polygon, polyline, line to <path>
|
|
160
|
+
MorphSVGPlugin.convertToPath("circle, rect, ellipse");
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### MorphSVG pitfall
|
|
164
|
+
|
|
165
|
+
```js
|
|
166
|
+
// BAD — morph between shapes with very different point counts = chaotic result
|
|
167
|
+
gsap.to("#simple-circle", { morphSVG: "#complex-illustration" });
|
|
168
|
+
|
|
169
|
+
// GOOD — use shapes with similar complexity, or shapeIndex to optimize
|
|
170
|
+
gsap.to("#simple-circle", {
|
|
171
|
+
morphSVG: { shape: "#complex-shape", shapeIndex: 2 }, // test with findShapeIndex
|
|
172
|
+
});
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## DrawSVG
|
|
176
|
+
|
|
177
|
+
Animates an SVG stroke (drawing effect).
|
|
178
|
+
|
|
179
|
+
### Usage
|
|
180
|
+
|
|
181
|
+
```js
|
|
182
|
+
import { DrawSVGPlugin } from "gsap/DrawSVGPlugin";
|
|
183
|
+
gsap.registerPlugin(DrawSVGPlugin);
|
|
184
|
+
|
|
185
|
+
// Draws the stroke from 0% to 100%
|
|
186
|
+
gsap.from(".path", { drawSVG: 0, duration: 2, ease: "power2.inOut" });
|
|
187
|
+
|
|
188
|
+
// Animate a portion of the stroke
|
|
189
|
+
gsap.fromTo(".path",
|
|
190
|
+
{ drawSVG: "0% 0%" },
|
|
191
|
+
{ drawSVG: "0% 100%", duration: 2 }
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
// Moving portion
|
|
195
|
+
gsap.to(".path", { drawSVG: "50% 60%", duration: 1 });
|
|
196
|
+
|
|
197
|
+
// Timeline for "snake" effect
|
|
198
|
+
const tl = gsap.timeline({ repeat: -1 });
|
|
199
|
+
tl.fromTo(".path",
|
|
200
|
+
{ drawSVG: "0% 0%" },
|
|
201
|
+
{ drawSVG: "0% 30%", duration: 1 }
|
|
202
|
+
).to(".path",
|
|
203
|
+
{ drawSVG: "100% 100%", duration: 1 }
|
|
204
|
+
);
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### DrawSVG pitfall
|
|
208
|
+
|
|
209
|
+
```js
|
|
210
|
+
// BAD — the element has no stroke defined in CSS/SVG
|
|
211
|
+
gsap.from(".path", { drawSVG: 0 }); // nothing happens
|
|
212
|
+
|
|
213
|
+
// GOOD — always define a visible stroke
|
|
214
|
+
// CSS: .path { stroke: #fff; stroke-width: 2; fill: none; }
|
|
215
|
+
gsap.from(".path", { drawSVG: 0, duration: 2 });
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## MotionPath (Free)
|
|
219
|
+
|
|
220
|
+
Animates an element along an SVG path.
|
|
221
|
+
|
|
222
|
+
### Usage
|
|
223
|
+
|
|
224
|
+
```js
|
|
225
|
+
import { MotionPathPlugin } from "gsap/MotionPathPlugin";
|
|
226
|
+
gsap.registerPlugin(MotionPathPlugin);
|
|
227
|
+
|
|
228
|
+
gsap.to(".rocket", {
|
|
229
|
+
motionPath: {
|
|
230
|
+
path: "#flight-path", // SVG path to follow
|
|
231
|
+
align: "#flight-path", // aligns the element on the path
|
|
232
|
+
alignOrigin: [0.5, 0.5], // center of the element
|
|
233
|
+
autoRotate: true, // rotates in the direction of movement
|
|
234
|
+
autoRotate: 90, // rotation offset in degrees
|
|
235
|
+
start: 0, // start position (0-1)
|
|
236
|
+
end: 1, // end position (0-1)
|
|
237
|
+
},
|
|
238
|
+
duration: 3,
|
|
239
|
+
ease: "power1.inOut",
|
|
240
|
+
});
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Path with coordinates
|
|
244
|
+
|
|
245
|
+
```js
|
|
246
|
+
gsap.to(".ball", {
|
|
247
|
+
motionPath: {
|
|
248
|
+
path: [
|
|
249
|
+
{ x: 100, y: 0 },
|
|
250
|
+
{ x: 200, y: -100 },
|
|
251
|
+
{ x: 300, y: 0 },
|
|
252
|
+
],
|
|
253
|
+
curviness: 1.5, // 0 = linear, 2 = very curved
|
|
254
|
+
autoRotate: true,
|
|
255
|
+
},
|
|
256
|
+
duration: 2,
|
|
257
|
+
});
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### MotionPath pitfall
|
|
261
|
+
|
|
262
|
+
```js
|
|
263
|
+
// BAD — autoRotate without alignOrigin = the element rotates around its corner
|
|
264
|
+
gsap.to(".el", {
|
|
265
|
+
motionPath: { path: "#path", autoRotate: true },
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
// GOOD — always define align + alignOrigin with autoRotate
|
|
269
|
+
gsap.to(".el", {
|
|
270
|
+
motionPath: {
|
|
271
|
+
path: "#path",
|
|
272
|
+
align: "#path",
|
|
273
|
+
alignOrigin: [0.5, 0.5],
|
|
274
|
+
autoRotate: true,
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
## Observer (Free)
|
|
280
|
+
|
|
281
|
+
Detects user gestures (scroll, touch, pointer) without ScrollTrigger. Ideal for custom interactions (swipe, drag-to-reveal).
|
|
282
|
+
|
|
283
|
+
### Usage
|
|
284
|
+
|
|
285
|
+
```js
|
|
286
|
+
import { Observer } from "gsap/Observer";
|
|
287
|
+
gsap.registerPlugin(Observer);
|
|
288
|
+
|
|
289
|
+
Observer.create({
|
|
290
|
+
type: "wheel, touch, pointer", // event types to listen to
|
|
291
|
+
target: window, // target element
|
|
292
|
+
onUp: () => goToSection(-1), // scroll/swipe up
|
|
293
|
+
onDown: () => goToSection(1), // scroll/swipe down
|
|
294
|
+
tolerance: 50, // minimum pixels before triggering
|
|
295
|
+
preventDefault: true, // prevents native scroll
|
|
296
|
+
wheelSpeed: -1, // inverts wheel direction
|
|
297
|
+
onPress: (self) => {}, // pointer down
|
|
298
|
+
onRelease: (self) => {}, // pointer up
|
|
299
|
+
onDrag: (self) => {}, // during drag
|
|
300
|
+
onChange: (self) => {
|
|
301
|
+
self.deltaX; // X displacement
|
|
302
|
+
self.deltaY; // Y displacement
|
|
303
|
+
self.velocityX; // X velocity
|
|
304
|
+
self.velocityY; // Y velocity
|
|
305
|
+
},
|
|
306
|
+
});
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Full-page section transitions
|
|
310
|
+
|
|
311
|
+
```js
|
|
312
|
+
let currentIndex = 0;
|
|
313
|
+
const sections = gsap.utils.toArray(".section");
|
|
314
|
+
let animating = false;
|
|
315
|
+
|
|
316
|
+
function goToSection(direction) {
|
|
317
|
+
if (animating) return;
|
|
318
|
+
const nextIndex = gsap.utils.clamp(0, sections.length - 1, currentIndex + direction);
|
|
319
|
+
if (nextIndex === currentIndex) return;
|
|
320
|
+
|
|
321
|
+
animating = true;
|
|
322
|
+
gsap.to(sections[currentIndex], { yPercent: -100 * direction, duration: 0.8 });
|
|
323
|
+
gsap.fromTo(sections[nextIndex],
|
|
324
|
+
{ yPercent: 100 * direction },
|
|
325
|
+
{ yPercent: 0, duration: 0.8, onComplete: () => (animating = false) }
|
|
326
|
+
);
|
|
327
|
+
currentIndex = nextIndex;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
Observer.create({
|
|
331
|
+
type: "wheel, touch",
|
|
332
|
+
onUp: () => goToSection(-1),
|
|
333
|
+
onDown: () => goToSection(1),
|
|
334
|
+
tolerance: 80,
|
|
335
|
+
preventDefault: true,
|
|
336
|
+
});
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Observer pitfall
|
|
340
|
+
|
|
341
|
+
```js
|
|
342
|
+
// BAD — no debounce/lock = animations stacking up
|
|
343
|
+
Observer.create({
|
|
344
|
+
onDown: () => gsap.to(".box", { y: "+=100" }), // each scroll adds 100px
|
|
345
|
+
|
|
346
|
+
// GOOD — lock during animation
|
|
347
|
+
let animating = false;
|
|
348
|
+
Observer.create({
|
|
349
|
+
onDown: () => {
|
|
350
|
+
if (animating) return;
|
|
351
|
+
animating = true;
|
|
352
|
+
gsap.to(".box", { y: "+=100", onComplete: () => (animating = false) });
|
|
353
|
+
},
|
|
354
|
+
});
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
## Recap : plugins
|
|
358
|
+
|
|
359
|
+
Since GSAP 3.13 (2025, post-Webflow acquisition) the entire library - including every former Club/bonus plugin (MorphSVG, DrawSVG, ScrollSmoother, SplitText, MotionPathHelper...) - is 100% free for all uses. There is no more Club paywall.
|
|
360
|
+
|
|
361
|
+
| Plugin | Usage principal |
|
|
362
|
+
| -------------- | ---------------------------------- |
|
|
363
|
+
| ScrollTrigger | Scroll-driven animations |
|
|
364
|
+
| Observer | Gesture detection |
|
|
365
|
+
| MotionPath | Path following |
|
|
366
|
+
| Flip | Layout transitions |
|
|
367
|
+
| SplitText | Text splitting |
|
|
368
|
+
| MorphSVG | SVG shape morphing |
|
|
369
|
+
| DrawSVG | SVG stroke animation |
|
|
370
|
+
| CustomEase | Custom easing curves |
|
|
371
|
+
| ScrollSmoother | Smooth scrolling wrapper |
|