vibecodeagent 0.0.0-stage → 0.1.65
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/LICENSE +21 -0
- package/README.md +46 -2
- package/THIRD-PARTY-NOTICES.txt +1427 -0
- package/dist/agen.js +138920 -0
- package/dist/bin.js +1245 -0
- package/dist/daemon.js +163701 -0
- package/dist/node_modules/node-ensure/index.js +10 -0
- package/dist/node_modules/node-ensure/package.json +31 -0
- package/dist/node_modules/pdf-parse/lib/pdf-parse.js +102 -0
- package/dist/node_modules/pdf-parse/lib/pdf.js/v1.10.100/build/pdf.js +18538 -0
- package/dist/node_modules/pdf-parse/lib/pdf.js/v1.10.100/build/pdf.worker.js +45507 -0
- package/dist/node_modules/pdf-parse/package.json +49 -0
- package/dist/node_modules/sql.js/dist/sql-wasm.js +186 -0
- package/dist/node_modules/sql.js/dist/sql-wasm.wasm +0 -0
- package/dist/node_modules/sql.js/package.json +58 -0
- package/dist/resources/skills/builtin/.gitkeep +0 -0
- package/dist/resources/skills/builtin/NOTICE.md +35 -0
- package/dist/resources/skills/builtin/README.md +74 -0
- package/dist/resources/skills/builtin/backend-engineering/SKILL.md +102 -0
- package/dist/resources/skills/builtin/backend-engineering/references/api-contracts.md +320 -0
- package/dist/resources/skills/builtin/backend-engineering/references/auth-and-secrets.md +268 -0
- package/dist/resources/skills/builtin/backend-engineering/references/concurrency-and-jobs.md +386 -0
- package/dist/resources/skills/builtin/backend-engineering/references/data-modelling.md +367 -0
- package/dist/resources/skills/builtin/backend-engineering/references/deploy-and-config.md +228 -0
- package/dist/resources/skills/builtin/backend-engineering/references/migrations.md +320 -0
- package/dist/resources/skills/builtin/backend-engineering/references/observability.md +301 -0
- package/dist/resources/skills/builtin/backend-engineering/references/plan-template.md +152 -0
- package/dist/resources/skills/builtin/backend-engineering/references/review-audit.md +213 -0
- package/dist/resources/skills/builtin/backend-engineering/references/security.md +251 -0
- package/dist/resources/skills/builtin/backend-engineering/references/stack-go.md +238 -0
- package/dist/resources/skills/builtin/backend-engineering/references/stack-node.md +274 -0
- package/dist/resources/skills/builtin/backend-engineering/references/stack-python.md +296 -0
- package/dist/resources/skills/builtin/backend-engineering/references/testing-and-perf.md +298 -0
- package/dist/resources/skills/builtin/backend-engineering/references/validation-and-errors.md +266 -0
- package/dist/resources/skills/builtin/dasar-vibecode/SKILL.md +312 -0
- package/dist/resources/skills/builtin/excel-maker/SKILL.md +71 -0
- package/dist/resources/skills/builtin/frontend-design/SKILL.md +131 -0
- package/dist/resources/skills/builtin/frontend-design/data/app-interface.csv +33 -0
- package/dist/resources/skills/builtin/frontend-design/data/catalog-summary.json +78 -0
- package/dist/resources/skills/builtin/frontend-design/data/charts.csv +26 -0
- package/dist/resources/skills/builtin/frontend-design/data/colors.csv +193 -0
- package/dist/resources/skills/builtin/frontend-design/data/data-provenance.json +1348 -0
- package/dist/resources/skills/builtin/frontend-design/data/google-font-licenses.json +20185 -0
- package/dist/resources/skills/builtin/frontend-design/data/google-fonts.csv +1935 -0
- package/dist/resources/skills/builtin/frontend-design/data/icons.csv +106 -0
- package/dist/resources/skills/builtin/frontend-design/data/landing.csv +35 -0
- package/dist/resources/skills/builtin/frontend-design/data/motion.csv +18 -0
- package/dist/resources/skills/builtin/frontend-design/data/phosphor-icons-upstream.json +32582 -0
- package/dist/resources/skills/builtin/frontend-design/data/products.csv +193 -0
- package/dist/resources/skills/builtin/frontend-design/data/react-performance.csv +45 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/angular.csv +51 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/astro.csv +54 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/avalonia.csv +57 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/flutter.csv +53 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/html-tailwind.csv +60 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/javafx.csv +76 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/jetpack-compose.csv +53 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/laravel.csv +51 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/nextjs.csv +62 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/nuxt-ui.csv +71 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/nuxtjs.csv +68 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/react-native.csv +52 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/react.csv +62 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/shadcn.csv +69 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/svelte.csv +56 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/swiftui.csv +51 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/threejs.csv +54 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/uno.csv +60 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/uwp.csv +56 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/vue.csv +50 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/winui.csv +60 -0
- package/dist/resources/skills/builtin/frontend-design/data/stacks/wpf.csv +57 -0
- package/dist/resources/skills/builtin/frontend-design/data/styles.csv +89 -0
- package/dist/resources/skills/builtin/frontend-design/data/typography.csv +75 -0
- package/dist/resources/skills/builtin/frontend-design/data/ui-reasoning.csv +193 -0
- package/dist/resources/skills/builtin/frontend-design/data/ux-guidelines.csv +120 -0
- package/dist/resources/skills/builtin/frontend-design/references/animation-patterns.md +705 -0
- package/dist/resources/skills/builtin/frontend-design/references/app-polish.md +117 -0
- package/dist/resources/skills/builtin/frontend-design/references/apple-fluid.md +278 -0
- package/dist/resources/skills/builtin/frontend-design/references/art-direction.md +280 -0
- package/dist/resources/skills/builtin/frontend-design/references/case-studies.md +599 -0
- package/dist/resources/skills/builtin/frontend-design/references/craft.md +128 -0
- package/dist/resources/skills/builtin/frontend-design/references/expo.md +251 -0
- package/dist/resources/skills/builtin/frontend-design/references/layout-systems.md +533 -0
- package/dist/resources/skills/builtin/frontend-design/references/libraries.md +72 -0
- package/dist/resources/skills/builtin/frontend-design/references/motion.md +222 -0
- package/dist/resources/skills/builtin/frontend-design/references/picker.md +197 -0
- package/dist/resources/skills/builtin/frontend-design/references/plan-template.md +73 -0
- package/dist/resources/skills/builtin/frontend-design/references/prototype.md +85 -0
- package/dist/resources/skills/builtin/frontend-design/references/recipes-expo.md +385 -0
- package/dist/resources/skills/builtin/frontend-design/references/recipes-web.md +421 -0
- package/dist/resources/skills/builtin/frontend-design/references/review-audit.md +107 -0
- package/dist/resources/skills/builtin/frontend-design/references/sonner.md +143 -0
- package/dist/resources/skills/builtin/frontend-design/references/technical-stack.md +543 -0
- package/dist/resources/skills/builtin/frontend-design/references/theming.md +60 -0
- package/dist/resources/skills/builtin/frontend-design/references/typography.md +393 -0
- package/dist/resources/skills/builtin/frontend-design/references/ux-rules.md +256 -0
- package/dist/resources/skills/builtin/frontend-design/references/vocabulary.md +169 -0
- package/dist/resources/skills/builtin/frontend-design/scripts/core.py +993 -0
- package/dist/resources/skills/builtin/frontend-design/scripts/design_system.py +1643 -0
- package/dist/resources/skills/builtin/frontend-design/scripts/reasoning_contract.py +123 -0
- package/dist/resources/skills/builtin/frontend-design/scripts/search.py +171 -0
- package/dist/resources/skills/builtin/frontend-design/scripts/validate_data.py +1091 -0
- package/dist/resources/skills/builtin/kerja-agentik/SKILL.md +117 -0
- package/dist/resources/skills/builtin/pdf-maker/SKILL.md +51 -0
- package/dist/resources/skills/builtin/tinjau-keamanan/SKILL.md +53 -0
- package/dist/resources/skills/builtin/word-maker/SKILL.md +58 -0
- package/dist/resources/skills/builtin/write-swift/SKILL.md +388 -0
- package/package.json +35 -4
|
@@ -0,0 +1,705 @@
|
|
|
1
|
+
# Animation Patterns Reference
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
1. Easing Functions
|
|
5
|
+
2. Page Load Sequences
|
|
6
|
+
3. Scroll-Triggered Animations
|
|
7
|
+
4. Micro-Interactions
|
|
8
|
+
5. Page Transitions
|
|
9
|
+
6. Text Animations
|
|
10
|
+
7. Performance Optimization
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 1. Easing Functions
|
|
15
|
+
|
|
16
|
+
### CSS Custom Easings (Agency Standards)
|
|
17
|
+
|
|
18
|
+
```css
|
|
19
|
+
:root {
|
|
20
|
+
/* Smooth exits - most common for UI */
|
|
21
|
+
--ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
|
|
22
|
+
--ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
|
|
23
|
+
--ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
|
|
24
|
+
--ease-out-circ: cubic-bezier(0, 0.55, 0.45, 1);
|
|
25
|
+
|
|
26
|
+
/* Dramatic entrances */
|
|
27
|
+
--ease-in-expo: cubic-bezier(0.7, 0, 0.84, 0);
|
|
28
|
+
--ease-in-quart: cubic-bezier(0.5, 0, 0.75, 0);
|
|
29
|
+
|
|
30
|
+
/* Symmetric - for toggles, loops */
|
|
31
|
+
--ease-in-out-quint: cubic-bezier(0.83, 0, 0.17, 1);
|
|
32
|
+
--ease-in-out-expo: cubic-bezier(0.87, 0, 0.13, 1);
|
|
33
|
+
|
|
34
|
+
/* Bouncy/Elastic */
|
|
35
|
+
--ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
36
|
+
--ease-out-elastic: cubic-bezier(0.68, -0.6, 0.32, 1.6);
|
|
37
|
+
|
|
38
|
+
/* Duration standards */
|
|
39
|
+
--duration-fast: 150ms;
|
|
40
|
+
--duration-normal: 300ms;
|
|
41
|
+
--duration-slow: 500ms;
|
|
42
|
+
--duration-slower: 800ms;
|
|
43
|
+
--duration-slowest: 1200ms;
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### GSAP Equivalent
|
|
48
|
+
|
|
49
|
+
```javascript
|
|
50
|
+
// Common GSAP easings
|
|
51
|
+
gsap.to(element, {
|
|
52
|
+
duration: 1,
|
|
53
|
+
ease: "expo.out" // Most used for reveals
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
gsap.to(element, {
|
|
57
|
+
duration: 0.8,
|
|
58
|
+
ease: "power4.out" // Slightly faster settle
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
gsap.to(element, {
|
|
62
|
+
duration: 1.2,
|
|
63
|
+
ease: "power2.inOut" // Symmetric movement
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Custom ease (Locomotive-style)
|
|
67
|
+
gsap.registerPlugin(CustomEase);
|
|
68
|
+
CustomEase.create("smooth", "0.16, 1, 0.3, 1");
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 2. Page Load Sequences
|
|
74
|
+
|
|
75
|
+
### Staggered Reveal Pattern
|
|
76
|
+
|
|
77
|
+
```css
|
|
78
|
+
/* CSS-only staggered reveal */
|
|
79
|
+
.reveal-item {
|
|
80
|
+
opacity: 0;
|
|
81
|
+
transform: translateY(60px);
|
|
82
|
+
animation: revealUp 0.8s var(--ease-out-expo) forwards;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.reveal-item:nth-child(1) { animation-delay: 0.1s; }
|
|
86
|
+
.reveal-item:nth-child(2) { animation-delay: 0.2s; }
|
|
87
|
+
.reveal-item:nth-child(3) { animation-delay: 0.3s; }
|
|
88
|
+
.reveal-item:nth-child(4) { animation-delay: 0.4s; }
|
|
89
|
+
|
|
90
|
+
@keyframes revealUp {
|
|
91
|
+
to {
|
|
92
|
+
opacity: 1;
|
|
93
|
+
transform: translateY(0);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### GSAP Page Load
|
|
99
|
+
|
|
100
|
+
```javascript
|
|
101
|
+
// Orchestrated page load
|
|
102
|
+
const tl = gsap.timeline({ defaults: { ease: "expo.out" } });
|
|
103
|
+
|
|
104
|
+
tl.set(".page-content", { visibility: "visible" })
|
|
105
|
+
.from(".hero-title .word", {
|
|
106
|
+
y: 120,
|
|
107
|
+
opacity: 0,
|
|
108
|
+
duration: 1.2,
|
|
109
|
+
stagger: 0.1
|
|
110
|
+
})
|
|
111
|
+
.from(".hero-subtitle", {
|
|
112
|
+
y: 40,
|
|
113
|
+
opacity: 0,
|
|
114
|
+
duration: 0.8
|
|
115
|
+
}, "-=0.6")
|
|
116
|
+
.from(".hero-cta", {
|
|
117
|
+
y: 30,
|
|
118
|
+
opacity: 0,
|
|
119
|
+
duration: 0.6
|
|
120
|
+
}, "-=0.4")
|
|
121
|
+
.from(".nav-item", {
|
|
122
|
+
y: -20,
|
|
123
|
+
opacity: 0,
|
|
124
|
+
duration: 0.5,
|
|
125
|
+
stagger: 0.05
|
|
126
|
+
}, "-=0.8");
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Split Text Animation
|
|
130
|
+
|
|
131
|
+
```javascript
|
|
132
|
+
// Using GSAP SplitText or custom splitting
|
|
133
|
+
import { SplitText } from "gsap/SplitText";
|
|
134
|
+
|
|
135
|
+
const split = new SplitText(".hero-title", {
|
|
136
|
+
type: "words,chars",
|
|
137
|
+
wordsClass: "word",
|
|
138
|
+
charsClass: "char"
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
gsap.from(split.chars, {
|
|
142
|
+
y: 100,
|
|
143
|
+
opacity: 0,
|
|
144
|
+
duration: 0.8,
|
|
145
|
+
ease: "expo.out",
|
|
146
|
+
stagger: 0.02
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// CSS approach (manual splitting)
|
|
150
|
+
/* HTML: <span class="char">H</span><span class="char">e</span>... */
|
|
151
|
+
.char {
|
|
152
|
+
display: inline-block;
|
|
153
|
+
opacity: 0;
|
|
154
|
+
transform: translateY(100%);
|
|
155
|
+
animation: charReveal 0.6s var(--ease-out-expo) forwards;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.char:nth-child(1) { animation-delay: calc(0.03s * 1); }
|
|
159
|
+
.char:nth-child(2) { animation-delay: calc(0.03s * 2); }
|
|
160
|
+
/* ... generate with CSS custom properties or JS */
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 3. Scroll-Triggered Animations
|
|
166
|
+
|
|
167
|
+
### Intersection Observer (Vanilla)
|
|
168
|
+
|
|
169
|
+
```javascript
|
|
170
|
+
// Reusable scroll reveal
|
|
171
|
+
const observerOptions = {
|
|
172
|
+
root: null,
|
|
173
|
+
rootMargin: '0px 0px -100px 0px',
|
|
174
|
+
threshold: 0.1
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const revealOnScroll = (entries, observer) => {
|
|
178
|
+
entries.forEach(entry => {
|
|
179
|
+
if (entry.isIntersecting) {
|
|
180
|
+
entry.target.classList.add('is-visible');
|
|
181
|
+
observer.unobserve(entry.target);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const observer = new IntersectionObserver(revealOnScroll, observerOptions);
|
|
187
|
+
|
|
188
|
+
document.querySelectorAll('[data-reveal]').forEach(el => {
|
|
189
|
+
observer.observe(el);
|
|
190
|
+
});
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
```css
|
|
194
|
+
/* Accompanying CSS */
|
|
195
|
+
[data-reveal] {
|
|
196
|
+
opacity: 0;
|
|
197
|
+
transform: translateY(60px);
|
|
198
|
+
transition: opacity 0.8s var(--ease-out-expo),
|
|
199
|
+
transform 0.8s var(--ease-out-expo);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
[data-reveal].is-visible {
|
|
203
|
+
opacity: 1;
|
|
204
|
+
transform: translateY(0);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* Stagger children */
|
|
208
|
+
[data-reveal="stagger"] > * {
|
|
209
|
+
opacity: 0;
|
|
210
|
+
transform: translateY(40px);
|
|
211
|
+
transition: opacity 0.6s var(--ease-out-expo),
|
|
212
|
+
transform 0.6s var(--ease-out-expo);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
[data-reveal="stagger"].is-visible > *:nth-child(1) { transition-delay: 0.1s; }
|
|
216
|
+
[data-reveal="stagger"].is-visible > *:nth-child(2) { transition-delay: 0.2s; }
|
|
217
|
+
[data-reveal="stagger"].is-visible > *:nth-child(3) { transition-delay: 0.3s; }
|
|
218
|
+
[data-reveal="stagger"].is-visible > * {
|
|
219
|
+
opacity: 1;
|
|
220
|
+
transform: translateY(0);
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### GSAP ScrollTrigger
|
|
225
|
+
|
|
226
|
+
```javascript
|
|
227
|
+
import { gsap } from "gsap";
|
|
228
|
+
import { ScrollTrigger } from "gsap/ScrollTrigger";
|
|
229
|
+
|
|
230
|
+
gsap.registerPlugin(ScrollTrigger);
|
|
231
|
+
|
|
232
|
+
// Fade up on scroll
|
|
233
|
+
gsap.utils.toArray('.reveal').forEach(el => {
|
|
234
|
+
gsap.from(el, {
|
|
235
|
+
y: 60,
|
|
236
|
+
opacity: 0,
|
|
237
|
+
duration: 1,
|
|
238
|
+
ease: "expo.out",
|
|
239
|
+
scrollTrigger: {
|
|
240
|
+
trigger: el,
|
|
241
|
+
start: "top 85%",
|
|
242
|
+
toggleActions: "play none none none"
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
// Parallax effect
|
|
248
|
+
gsap.to('.parallax-bg', {
|
|
249
|
+
yPercent: -30,
|
|
250
|
+
ease: "none",
|
|
251
|
+
scrollTrigger: {
|
|
252
|
+
trigger: '.parallax-section',
|
|
253
|
+
start: "top bottom",
|
|
254
|
+
end: "bottom top",
|
|
255
|
+
scrub: true
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
// Horizontal scroll section
|
|
260
|
+
gsap.to('.horizontal-panels', {
|
|
261
|
+
xPercent: -100 * (panels.length - 1),
|
|
262
|
+
ease: "none",
|
|
263
|
+
scrollTrigger: {
|
|
264
|
+
trigger: '.horizontal-container',
|
|
265
|
+
pin: true,
|
|
266
|
+
scrub: 1,
|
|
267
|
+
end: () => "+=" + document.querySelector('.horizontal-panels').offsetWidth
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
// Pin and reveal
|
|
272
|
+
gsap.timeline({
|
|
273
|
+
scrollTrigger: {
|
|
274
|
+
trigger: '.pinned-section',
|
|
275
|
+
start: "top top",
|
|
276
|
+
end: "+=200%",
|
|
277
|
+
pin: true,
|
|
278
|
+
scrub: 1
|
|
279
|
+
}
|
|
280
|
+
})
|
|
281
|
+
.from('.pinned-title', { opacity: 0, y: 100 })
|
|
282
|
+
.from('.pinned-content', { opacity: 0, y: 50 }, 0.3);
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Lenis Smooth Scroll + GSAP
|
|
286
|
+
|
|
287
|
+
```javascript
|
|
288
|
+
import Lenis from '@studio-freight/lenis';
|
|
289
|
+
import { gsap } from 'gsap';
|
|
290
|
+
import { ScrollTrigger } from 'gsap/ScrollTrigger';
|
|
291
|
+
|
|
292
|
+
// Initialize Lenis
|
|
293
|
+
const lenis = new Lenis({
|
|
294
|
+
duration: 1.2,
|
|
295
|
+
easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)),
|
|
296
|
+
direction: 'vertical',
|
|
297
|
+
smooth: true,
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
// Connect Lenis to GSAP ScrollTrigger
|
|
301
|
+
lenis.on('scroll', ScrollTrigger.update);
|
|
302
|
+
|
|
303
|
+
gsap.ticker.add((time) => {
|
|
304
|
+
lenis.raf(time * 1000);
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
gsap.ticker.lagSmoothing(0);
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## 4. Micro-Interactions
|
|
313
|
+
|
|
314
|
+
### Button Hover States
|
|
315
|
+
|
|
316
|
+
```css
|
|
317
|
+
/* Magnetic button effect */
|
|
318
|
+
.magnetic-btn {
|
|
319
|
+
position: relative;
|
|
320
|
+
transition: transform 0.3s var(--ease-out-expo);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/* JS handles the magnetic effect, CSS handles the visual */
|
|
324
|
+
.magnetic-btn::before {
|
|
325
|
+
content: '';
|
|
326
|
+
position: absolute;
|
|
327
|
+
inset: 0;
|
|
328
|
+
background: var(--color-accent);
|
|
329
|
+
transform: scaleX(0);
|
|
330
|
+
transform-origin: right;
|
|
331
|
+
transition: transform 0.5s var(--ease-out-expo);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.magnetic-btn:hover::before {
|
|
335
|
+
transform: scaleX(1);
|
|
336
|
+
transform-origin: left;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/* Text slide effect */
|
|
340
|
+
.text-slide-btn {
|
|
341
|
+
overflow: hidden;
|
|
342
|
+
position: relative;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.text-slide-btn span {
|
|
346
|
+
display: block;
|
|
347
|
+
transition: transform 0.5s var(--ease-out-expo);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.text-slide-btn span::after {
|
|
351
|
+
content: attr(data-text);
|
|
352
|
+
position: absolute;
|
|
353
|
+
top: 100%;
|
|
354
|
+
left: 0;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.text-slide-btn:hover span {
|
|
358
|
+
transform: translateY(-100%);
|
|
359
|
+
}
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
```javascript
|
|
363
|
+
// Magnetic button JS
|
|
364
|
+
document.querySelectorAll('.magnetic-btn').forEach(btn => {
|
|
365
|
+
btn.addEventListener('mousemove', (e) => {
|
|
366
|
+
const rect = btn.getBoundingClientRect();
|
|
367
|
+
const x = e.clientX - rect.left - rect.width / 2;
|
|
368
|
+
const y = e.clientY - rect.top - rect.height / 2;
|
|
369
|
+
|
|
370
|
+
gsap.to(btn, {
|
|
371
|
+
x: x * 0.3,
|
|
372
|
+
y: y * 0.3,
|
|
373
|
+
duration: 0.3,
|
|
374
|
+
ease: "power2.out"
|
|
375
|
+
});
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
btn.addEventListener('mouseleave', () => {
|
|
379
|
+
gsap.to(btn, {
|
|
380
|
+
x: 0,
|
|
381
|
+
y: 0,
|
|
382
|
+
duration: 0.5,
|
|
383
|
+
ease: "elastic.out(1, 0.5)"
|
|
384
|
+
});
|
|
385
|
+
});
|
|
386
|
+
});
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### Link Underline Animations
|
|
390
|
+
|
|
391
|
+
```css
|
|
392
|
+
/* Slide in underline */
|
|
393
|
+
.link-underline {
|
|
394
|
+
position: relative;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.link-underline::after {
|
|
398
|
+
content: '';
|
|
399
|
+
position: absolute;
|
|
400
|
+
bottom: 0;
|
|
401
|
+
left: 0;
|
|
402
|
+
width: 100%;
|
|
403
|
+
height: 1px;
|
|
404
|
+
background: currentColor;
|
|
405
|
+
transform: scaleX(0);
|
|
406
|
+
transform-origin: right;
|
|
407
|
+
transition: transform 0.4s var(--ease-out-expo);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.link-underline:hover::after {
|
|
411
|
+
transform: scaleX(1);
|
|
412
|
+
transform-origin: left;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/* Draw underline */
|
|
416
|
+
.link-draw {
|
|
417
|
+
background-image: linear-gradient(currentColor, currentColor);
|
|
418
|
+
background-position: 0 100%;
|
|
419
|
+
background-repeat: no-repeat;
|
|
420
|
+
background-size: 0% 1px;
|
|
421
|
+
transition: background-size 0.4s var(--ease-out-expo);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.link-draw:hover {
|
|
425
|
+
background-size: 100% 1px;
|
|
426
|
+
}
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
### Card Hover Effects
|
|
430
|
+
|
|
431
|
+
```css
|
|
432
|
+
/* 3D tilt card */
|
|
433
|
+
.tilt-card {
|
|
434
|
+
transform-style: preserve-3d;
|
|
435
|
+
transition: transform 0.5s var(--ease-out-expo);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.tilt-card:hover {
|
|
439
|
+
transform: perspective(1000px) rotateX(5deg) rotateY(-5deg);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
.tilt-card::before {
|
|
443
|
+
content: '';
|
|
444
|
+
position: absolute;
|
|
445
|
+
inset: 0;
|
|
446
|
+
background: linear-gradient(
|
|
447
|
+
135deg,
|
|
448
|
+
rgba(255,255,255,0.1) 0%,
|
|
449
|
+
transparent 50%
|
|
450
|
+
);
|
|
451
|
+
opacity: 0;
|
|
452
|
+
transition: opacity 0.3s;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
.tilt-card:hover::before {
|
|
456
|
+
opacity: 1;
|
|
457
|
+
}
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
|
|
462
|
+
## 5. Page Transitions
|
|
463
|
+
|
|
464
|
+
### Basic Fade Transition
|
|
465
|
+
|
|
466
|
+
```javascript
|
|
467
|
+
// Using Barba.js
|
|
468
|
+
import barba from '@barba/core';
|
|
469
|
+
|
|
470
|
+
barba.init({
|
|
471
|
+
transitions: [{
|
|
472
|
+
name: 'fade',
|
|
473
|
+
leave(data) {
|
|
474
|
+
return gsap.to(data.current.container, {
|
|
475
|
+
opacity: 0,
|
|
476
|
+
duration: 0.5,
|
|
477
|
+
ease: "power2.inOut"
|
|
478
|
+
});
|
|
479
|
+
},
|
|
480
|
+
enter(data) {
|
|
481
|
+
return gsap.from(data.next.container, {
|
|
482
|
+
opacity: 0,
|
|
483
|
+
duration: 0.5,
|
|
484
|
+
ease: "power2.inOut"
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
}]
|
|
488
|
+
});
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
### Overlay Wipe Transition
|
|
492
|
+
|
|
493
|
+
```javascript
|
|
494
|
+
// Wipe transition with overlay
|
|
495
|
+
barba.init({
|
|
496
|
+
transitions: [{
|
|
497
|
+
name: 'wipe',
|
|
498
|
+
leave(data) {
|
|
499
|
+
const tl = gsap.timeline();
|
|
500
|
+
|
|
501
|
+
tl.to('.transition-overlay', {
|
|
502
|
+
scaleY: 1,
|
|
503
|
+
transformOrigin: 'bottom',
|
|
504
|
+
duration: 0.6,
|
|
505
|
+
ease: "expo.inOut"
|
|
506
|
+
})
|
|
507
|
+
.to(data.current.container, {
|
|
508
|
+
opacity: 0,
|
|
509
|
+
duration: 0.3
|
|
510
|
+
}, 0.3);
|
|
511
|
+
|
|
512
|
+
return tl;
|
|
513
|
+
},
|
|
514
|
+
enter(data) {
|
|
515
|
+
const tl = gsap.timeline();
|
|
516
|
+
|
|
517
|
+
tl.set(data.next.container, { opacity: 1 })
|
|
518
|
+
.to('.transition-overlay', {
|
|
519
|
+
scaleY: 0,
|
|
520
|
+
transformOrigin: 'top',
|
|
521
|
+
duration: 0.6,
|
|
522
|
+
ease: "expo.inOut"
|
|
523
|
+
})
|
|
524
|
+
.from('[data-reveal]', {
|
|
525
|
+
y: 60,
|
|
526
|
+
opacity: 0,
|
|
527
|
+
stagger: 0.1,
|
|
528
|
+
duration: 0.8,
|
|
529
|
+
ease: "expo.out"
|
|
530
|
+
}, 0.2);
|
|
531
|
+
|
|
532
|
+
return tl;
|
|
533
|
+
}
|
|
534
|
+
}]
|
|
535
|
+
});
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
---
|
|
539
|
+
|
|
540
|
+
## 6. Text Animations
|
|
541
|
+
|
|
542
|
+
### Word-by-Word Reveal
|
|
543
|
+
|
|
544
|
+
```javascript
|
|
545
|
+
// Split and animate
|
|
546
|
+
function animateText(element) {
|
|
547
|
+
const text = element.textContent;
|
|
548
|
+
const words = text.split(' ');
|
|
549
|
+
|
|
550
|
+
element.innerHTML = words.map(word =>
|
|
551
|
+
`<span class="word-wrapper"><span class="word">${word}</span></span>`
|
|
552
|
+
).join(' ');
|
|
553
|
+
|
|
554
|
+
gsap.from(element.querySelectorAll('.word'), {
|
|
555
|
+
y: '100%',
|
|
556
|
+
duration: 0.8,
|
|
557
|
+
ease: "expo.out",
|
|
558
|
+
stagger: 0.05
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
### Scramble/Decode Effect
|
|
564
|
+
|
|
565
|
+
```javascript
|
|
566
|
+
// Text scramble effect
|
|
567
|
+
class TextScramble {
|
|
568
|
+
constructor(el) {
|
|
569
|
+
this.el = el;
|
|
570
|
+
this.chars = '!<>-_\\/[]{}—=+*^?#________';
|
|
571
|
+
this.update = this.update.bind(this);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
setText(newText) {
|
|
575
|
+
const oldText = this.el.innerText;
|
|
576
|
+
const length = Math.max(oldText.length, newText.length);
|
|
577
|
+
const promise = new Promise(resolve => this.resolve = resolve);
|
|
578
|
+
this.queue = [];
|
|
579
|
+
|
|
580
|
+
for (let i = 0; i < length; i++) {
|
|
581
|
+
const from = oldText[i] || '';
|
|
582
|
+
const to = newText[i] || '';
|
|
583
|
+
const start = Math.floor(Math.random() * 40);
|
|
584
|
+
const end = start + Math.floor(Math.random() * 40);
|
|
585
|
+
this.queue.push({ from, to, start, end });
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
cancelAnimationFrame(this.frameRequest);
|
|
589
|
+
this.frame = 0;
|
|
590
|
+
this.update();
|
|
591
|
+
return promise;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
update() {
|
|
595
|
+
let output = '';
|
|
596
|
+
let complete = 0;
|
|
597
|
+
|
|
598
|
+
for (let i = 0; i < this.queue.length; i++) {
|
|
599
|
+
let { from, to, start, end, char } = this.queue[i];
|
|
600
|
+
|
|
601
|
+
if (this.frame >= end) {
|
|
602
|
+
complete++;
|
|
603
|
+
output += to;
|
|
604
|
+
} else if (this.frame >= start) {
|
|
605
|
+
if (!char || Math.random() < 0.28) {
|
|
606
|
+
char = this.chars[Math.floor(Math.random() * this.chars.length)];
|
|
607
|
+
this.queue[i].char = char;
|
|
608
|
+
}
|
|
609
|
+
output += char;
|
|
610
|
+
} else {
|
|
611
|
+
output += from;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
this.el.innerText = output;
|
|
616
|
+
|
|
617
|
+
if (complete === this.queue.length) {
|
|
618
|
+
this.resolve();
|
|
619
|
+
} else {
|
|
620
|
+
this.frameRequest = requestAnimationFrame(this.update);
|
|
621
|
+
this.frame++;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
---
|
|
628
|
+
|
|
629
|
+
## 7. Performance Optimization
|
|
630
|
+
|
|
631
|
+
### GPU-Accelerated Properties
|
|
632
|
+
|
|
633
|
+
```css
|
|
634
|
+
/* ONLY animate these for 60fps */
|
|
635
|
+
.performant-animation {
|
|
636
|
+
/* Good - GPU accelerated */
|
|
637
|
+
transform: translateX(100px);
|
|
638
|
+
transform: translateY(100px);
|
|
639
|
+
transform: scale(1.2);
|
|
640
|
+
transform: rotate(45deg);
|
|
641
|
+
opacity: 0.5;
|
|
642
|
+
|
|
643
|
+
/* Bad - triggers layout/paint */
|
|
644
|
+
/* left: 100px; */
|
|
645
|
+
/* top: 100px; */
|
|
646
|
+
/* width: 200px; */
|
|
647
|
+
/* height: 200px; */
|
|
648
|
+
/* margin: 20px; */
|
|
649
|
+
/* padding: 20px; */
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/* Force GPU layer */
|
|
653
|
+
.will-animate {
|
|
654
|
+
will-change: transform, opacity;
|
|
655
|
+
transform: translateZ(0);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/* Remove will-change after animation */
|
|
659
|
+
.animation-complete {
|
|
660
|
+
will-change: auto;
|
|
661
|
+
}
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
### Reduce Motion Support
|
|
665
|
+
|
|
666
|
+
```css
|
|
667
|
+
@media (prefers-reduced-motion: reduce) {
|
|
668
|
+
*,
|
|
669
|
+
*::before,
|
|
670
|
+
*::after {
|
|
671
|
+
animation-duration: 0.01ms !important;
|
|
672
|
+
animation-iteration-count: 1 !important;
|
|
673
|
+
transition-duration: 0.01ms !important;
|
|
674
|
+
scroll-behavior: auto !important;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
```javascript
|
|
680
|
+
// JS check for reduced motion
|
|
681
|
+
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
682
|
+
|
|
683
|
+
if (prefersReducedMotion.matches) {
|
|
684
|
+
// Skip or simplify animations
|
|
685
|
+
gsap.globalTimeline.timeScale(10); // Or skip entirely
|
|
686
|
+
}
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
### Lazy Animation Loading
|
|
690
|
+
|
|
691
|
+
```javascript
|
|
692
|
+
// Only initialize animations when needed
|
|
693
|
+
const animationObserver = new IntersectionObserver((entries) => {
|
|
694
|
+
entries.forEach(entry => {
|
|
695
|
+
if (entry.isIntersecting) {
|
|
696
|
+
initHeavyAnimation(entry.target);
|
|
697
|
+
animationObserver.unobserve(entry.target);
|
|
698
|
+
}
|
|
699
|
+
});
|
|
700
|
+
}, { rootMargin: '200px' });
|
|
701
|
+
|
|
702
|
+
document.querySelectorAll('[data-heavy-animation]').forEach(el => {
|
|
703
|
+
animationObserver.observe(el);
|
|
704
|
+
});
|
|
705
|
+
```
|