create-huenei-template 0.2.2 → 0.2.4
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/dist/config/templates.js +3 -3
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-component/SKILL.md +288 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-component/references/component-patterns.md +358 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-di/SKILL.md +387 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-di/references/di-patterns.md +519 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-directives/SKILL.md +437 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-directives/references/directive-patterns.md +570 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-forms/SKILL.md +434 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-forms/references/form-patterns.md +398 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-http/SKILL.md +366 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-http/references/http-patterns.md +448 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-routing/SKILL.md +395 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-routing/references/routing-patterns.md +472 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-signals/SKILL.md +302 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-signals/references/signal-patterns.md +404 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-ssr/SKILL.md +435 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-ssr/references/ssr-patterns.md +497 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-testing/SKILL.md +660 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-testing/references/testing-patterns.md +707 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-tooling/SKILL.md +352 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-tooling/references/tooling-patterns.md +448 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-accessibility/SKILL.md +780 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-components/SKILL.md +718 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-design-systems/SKILL.md +612 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-layouts/SKILL.md +594 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/SKILL.md +432 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/references/animation-patterns.md +427 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/SKILL.md +354 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/references/troubleshooting-guide.md +306 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/SKILL.md +578 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/references/react-patterns.md +353 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/SKILL.md +608 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/advanced-theme-patterns.md +215 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/custom-utilities-guide.md +281 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-mobile-first/SKILL.md +768 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/SKILL.md +374 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/references/bundle-optimization.md +244 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-plugins/SKILL.md +505 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/SKILL.md +601 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/references/advanced-responsive-patterns.md +485 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/web-design-guidelines/SKILL.md +39 -0
- package/dist/templates/frontend/angular-base/package.json +0 -1
- package/dist/templates/frontend/angular-base/pnpm-lock.yaml +8183 -0
- package/package.json +1 -1
- package/templates/frontend/angular-base/.cursor/skills/angular-component/SKILL.md +288 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-component/references/component-patterns.md +358 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-di/SKILL.md +387 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-di/references/di-patterns.md +519 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-directives/SKILL.md +437 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-directives/references/directive-patterns.md +570 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-forms/SKILL.md +434 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-forms/references/form-patterns.md +398 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-http/SKILL.md +366 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-http/references/http-patterns.md +448 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-routing/SKILL.md +395 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-routing/references/routing-patterns.md +472 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-signals/SKILL.md +302 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-signals/references/signal-patterns.md +404 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-ssr/SKILL.md +435 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-ssr/references/ssr-patterns.md +497 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-testing/SKILL.md +660 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-testing/references/testing-patterns.md +707 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-tooling/SKILL.md +352 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-tooling/references/tooling-patterns.md +448 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-accessibility/SKILL.md +780 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-components/SKILL.md +718 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-design-systems/SKILL.md +612 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-layouts/SKILL.md +594 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/SKILL.md +432 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/references/animation-patterns.md +427 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/SKILL.md +354 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/references/troubleshooting-guide.md +306 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/SKILL.md +578 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/references/react-patterns.md +353 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/SKILL.md +608 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/advanced-theme-patterns.md +215 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/custom-utilities-guide.md +281 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-mobile-first/SKILL.md +768 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/SKILL.md +374 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/references/bundle-optimization.md +244 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-plugins/SKILL.md +505 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/SKILL.md +601 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/references/advanced-responsive-patterns.md +485 -0
- package/templates/frontend/angular-base/.cursor/skills/web-design-guidelines/SKILL.md +39 -0
- package/templates/frontend/angular-base/package.json +0 -1
- package/templates/frontend/angular-base/pnpm-lock.yaml +8183 -0
- package/templates/frontend/angular-base/package-lock.json +0 -13321
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tailwindcss-animations
|
|
3
|
+
description: Tailwind CSS animations and transitions including built-in utilities and custom animation patterns
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Tailwind CSS Animations & Transitions
|
|
7
|
+
|
|
8
|
+
## Built-in Animations
|
|
9
|
+
|
|
10
|
+
### Spin
|
|
11
|
+
|
|
12
|
+
Continuous rotation for loading indicators:
|
|
13
|
+
|
|
14
|
+
```html
|
|
15
|
+
<svg class="animate-spin h-5 w-5 text-blue-500" viewBox="0 0 24 24">
|
|
16
|
+
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
|
|
17
|
+
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" />
|
|
18
|
+
</svg>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Ping
|
|
22
|
+
|
|
23
|
+
Radar-style pulse for notifications:
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<span class="relative flex h-3 w-3">
|
|
27
|
+
<span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-sky-400 opacity-75"></span>
|
|
28
|
+
<span class="relative inline-flex rounded-full h-3 w-3 bg-sky-500"></span>
|
|
29
|
+
</span>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Pulse
|
|
33
|
+
|
|
34
|
+
Subtle fade for skeleton loaders:
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<div class="animate-pulse flex space-x-4">
|
|
38
|
+
<div class="rounded-full bg-slate-200 h-10 w-10"></div>
|
|
39
|
+
<div class="flex-1 space-y-2 py-1">
|
|
40
|
+
<div class="h-2 bg-slate-200 rounded"></div>
|
|
41
|
+
<div class="h-2 bg-slate-200 rounded w-5/6"></div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Bounce
|
|
47
|
+
|
|
48
|
+
Attention-grabbing vertical bounce:
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<svg class="animate-bounce w-6 h-6 text-blue-500" fill="none" viewBox="0 0 24 24">
|
|
52
|
+
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 14l-7 7m0 0l-7-7m7 7V3" />
|
|
53
|
+
</svg>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Transitions
|
|
57
|
+
|
|
58
|
+
### Transition Properties
|
|
59
|
+
|
|
60
|
+
| Class | CSS Property |
|
|
61
|
+
|-------|--------------|
|
|
62
|
+
| `transition-none` | None |
|
|
63
|
+
| `transition-all` | All properties |
|
|
64
|
+
| `transition` | Common properties |
|
|
65
|
+
| `transition-colors` | Colors only |
|
|
66
|
+
| `transition-opacity` | Opacity only |
|
|
67
|
+
| `transition-shadow` | Shadow only |
|
|
68
|
+
| `transition-transform` | Transform only |
|
|
69
|
+
|
|
70
|
+
### Transition Duration
|
|
71
|
+
|
|
72
|
+
| Class | Duration |
|
|
73
|
+
|-------|----------|
|
|
74
|
+
| `duration-75` | 75ms |
|
|
75
|
+
| `duration-100` | 100ms |
|
|
76
|
+
| `duration-150` | 150ms |
|
|
77
|
+
| `duration-200` | 200ms |
|
|
78
|
+
| `duration-300` | 300ms |
|
|
79
|
+
| `duration-500` | 500ms |
|
|
80
|
+
| `duration-700` | 700ms |
|
|
81
|
+
| `duration-1000` | 1000ms |
|
|
82
|
+
|
|
83
|
+
### Transition Timing Functions
|
|
84
|
+
|
|
85
|
+
| Class | Easing |
|
|
86
|
+
|-------|--------|
|
|
87
|
+
| `ease-linear` | Linear |
|
|
88
|
+
| `ease-in` | Accelerate |
|
|
89
|
+
| `ease-out` | Decelerate |
|
|
90
|
+
| `ease-in-out` | Accelerate then decelerate |
|
|
91
|
+
|
|
92
|
+
### Transition Delay
|
|
93
|
+
|
|
94
|
+
| Class | Delay |
|
|
95
|
+
|-------|-------|
|
|
96
|
+
| `delay-75` | 75ms |
|
|
97
|
+
| `delay-100` | 100ms |
|
|
98
|
+
| `delay-150` | 150ms |
|
|
99
|
+
| `delay-200` | 200ms |
|
|
100
|
+
| `delay-300` | 300ms |
|
|
101
|
+
| `delay-500` | 500ms |
|
|
102
|
+
|
|
103
|
+
### Basic Transition Examples
|
|
104
|
+
|
|
105
|
+
```html
|
|
106
|
+
<!-- Color transition -->
|
|
107
|
+
<button class="bg-blue-500 hover:bg-blue-700 transition-colors duration-200">
|
|
108
|
+
Hover me
|
|
109
|
+
</button>
|
|
110
|
+
|
|
111
|
+
<!-- Scale on hover -->
|
|
112
|
+
<div class="transform hover:scale-105 transition-transform duration-200">
|
|
113
|
+
Card
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
<!-- Opacity transition -->
|
|
117
|
+
<div class="opacity-100 hover:opacity-75 transition-opacity duration-150">
|
|
118
|
+
Fade
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
<!-- Multiple properties -->
|
|
122
|
+
<button class="
|
|
123
|
+
bg-blue-500 hover:bg-blue-700
|
|
124
|
+
transform hover:scale-105
|
|
125
|
+
shadow-md hover:shadow-lg
|
|
126
|
+
transition-all duration-200
|
|
127
|
+
">
|
|
128
|
+
Full transition
|
|
129
|
+
</button>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Transform Utilities
|
|
133
|
+
|
|
134
|
+
### Scale
|
|
135
|
+
|
|
136
|
+
```html
|
|
137
|
+
<div class="transform scale-100 hover:scale-110 transition-transform">
|
|
138
|
+
Scale up
|
|
139
|
+
</div>
|
|
140
|
+
|
|
141
|
+
<div class="transform scale-100 hover:scale-90 transition-transform">
|
|
142
|
+
Scale down
|
|
143
|
+
</div>
|
|
144
|
+
|
|
145
|
+
<!-- Specific axes -->
|
|
146
|
+
<div class="transform hover:scale-x-110">Horizontal</div>
|
|
147
|
+
<div class="transform hover:scale-y-110">Vertical</div>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Rotate
|
|
151
|
+
|
|
152
|
+
```html
|
|
153
|
+
<div class="transform hover:rotate-12 transition-transform">
|
|
154
|
+
Rotate right
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
<div class="transform hover:-rotate-12 transition-transform">
|
|
158
|
+
Rotate left
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
<div class="transform hover:rotate-180 transition-transform duration-500">
|
|
162
|
+
Flip
|
|
163
|
+
</div>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Translate
|
|
167
|
+
|
|
168
|
+
```html
|
|
169
|
+
<div class="transform hover:translate-x-2 transition-transform">
|
|
170
|
+
Move right
|
|
171
|
+
</div>
|
|
172
|
+
|
|
173
|
+
<div class="transform hover:-translate-y-2 transition-transform">
|
|
174
|
+
Move up
|
|
175
|
+
</div>
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Skew
|
|
179
|
+
|
|
180
|
+
```html
|
|
181
|
+
<div class="transform hover:skew-x-3 transition-transform">
|
|
182
|
+
Skew horizontal
|
|
183
|
+
</div>
|
|
184
|
+
|
|
185
|
+
<div class="transform hover:skew-y-3 transition-transform">
|
|
186
|
+
Skew vertical
|
|
187
|
+
</div>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Transform Origin
|
|
191
|
+
|
|
192
|
+
```html
|
|
193
|
+
<div class="origin-center transform hover:rotate-45">Center (default)</div>
|
|
194
|
+
<div class="origin-top-left transform hover:rotate-45">Top left</div>
|
|
195
|
+
<div class="origin-bottom-right transform hover:rotate-45">Bottom right</div>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Custom Animations (v4)
|
|
199
|
+
|
|
200
|
+
### Define in @theme
|
|
201
|
+
|
|
202
|
+
```css
|
|
203
|
+
@theme {
|
|
204
|
+
/* Custom keyframes */
|
|
205
|
+
--animate-fade-in: fade-in 0.5s ease-out;
|
|
206
|
+
--animate-slide-up: slide-up 0.3s ease-out;
|
|
207
|
+
--animate-shake: shake 0.5s ease-in-out;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
@keyframes fade-in {
|
|
211
|
+
from { opacity: 0; }
|
|
212
|
+
to { opacity: 1; }
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
@keyframes slide-up {
|
|
216
|
+
from {
|
|
217
|
+
opacity: 0;
|
|
218
|
+
transform: translateY(20px);
|
|
219
|
+
}
|
|
220
|
+
to {
|
|
221
|
+
opacity: 1;
|
|
222
|
+
transform: translateY(0);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
@keyframes shake {
|
|
227
|
+
0%, 100% { transform: translateX(0); }
|
|
228
|
+
25% { transform: translateX(-5px); }
|
|
229
|
+
75% { transform: translateX(5px); }
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Usage
|
|
234
|
+
|
|
235
|
+
```html
|
|
236
|
+
<div class="animate-fade-in">Fades in</div>
|
|
237
|
+
<div class="animate-slide-up">Slides up</div>
|
|
238
|
+
<div class="animate-shake">Shakes on error</div>
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Custom Easing
|
|
242
|
+
|
|
243
|
+
```css
|
|
244
|
+
@theme {
|
|
245
|
+
--ease-in-expo: cubic-bezier(0.95, 0.05, 0.795, 0.035);
|
|
246
|
+
--ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
|
|
247
|
+
--ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
```html
|
|
252
|
+
<div class="transition-transform ease-bounce duration-300 hover:scale-110">
|
|
253
|
+
Bouncy scale
|
|
254
|
+
</div>
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Accessibility: Reduced Motion
|
|
258
|
+
|
|
259
|
+
### motion-safe / motion-reduce
|
|
260
|
+
|
|
261
|
+
```html
|
|
262
|
+
<!-- Only animate if user prefers motion -->
|
|
263
|
+
<div class="motion-safe:animate-bounce motion-reduce:animate-none">
|
|
264
|
+
Respects preferences
|
|
265
|
+
</div>
|
|
266
|
+
|
|
267
|
+
<!-- Alternative: reduced animation -->
|
|
268
|
+
<button class="
|
|
269
|
+
motion-safe:transition-all motion-safe:duration-200
|
|
270
|
+
motion-reduce:transition-none
|
|
271
|
+
hover:bg-blue-600
|
|
272
|
+
">
|
|
273
|
+
Accessible button
|
|
274
|
+
</button>
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Reduced Motion Pattern
|
|
278
|
+
|
|
279
|
+
```css
|
|
280
|
+
/* Apply globally */
|
|
281
|
+
@media (prefers-reduced-motion: reduce) {
|
|
282
|
+
*,
|
|
283
|
+
::before,
|
|
284
|
+
::after {
|
|
285
|
+
animation-duration: 0.01ms !important;
|
|
286
|
+
animation-iteration-count: 1 !important;
|
|
287
|
+
transition-duration: 0.01ms !important;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## Common Animation Patterns
|
|
293
|
+
|
|
294
|
+
### Hover Card Lift
|
|
295
|
+
|
|
296
|
+
```html
|
|
297
|
+
<div class="
|
|
298
|
+
transform transition-all duration-200
|
|
299
|
+
hover:-translate-y-1 hover:shadow-lg
|
|
300
|
+
bg-white rounded-lg p-6 shadow
|
|
301
|
+
">
|
|
302
|
+
Card content
|
|
303
|
+
</div>
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Button Press Effect
|
|
307
|
+
|
|
308
|
+
```html
|
|
309
|
+
<button class="
|
|
310
|
+
transform transition-transform duration-100
|
|
311
|
+
active:scale-95
|
|
312
|
+
bg-blue-500 text-white px-4 py-2 rounded
|
|
313
|
+
">
|
|
314
|
+
Click me
|
|
315
|
+
</button>
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### Loading Dots
|
|
319
|
+
|
|
320
|
+
```html
|
|
321
|
+
<div class="flex space-x-1">
|
|
322
|
+
<div class="w-2 h-2 bg-blue-500 rounded-full animate-bounce [animation-delay:-0.3s]"></div>
|
|
323
|
+
<div class="w-2 h-2 bg-blue-500 rounded-full animate-bounce [animation-delay:-0.15s]"></div>
|
|
324
|
+
<div class="w-2 h-2 bg-blue-500 rounded-full animate-bounce"></div>
|
|
325
|
+
</div>
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Fade In on Scroll (with JS)
|
|
329
|
+
|
|
330
|
+
```html
|
|
331
|
+
<div class="opacity-0 translate-y-4 transition-all duration-500" data-animate>
|
|
332
|
+
Content that fades in
|
|
333
|
+
</div>
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
```javascript
|
|
337
|
+
// Intersection Observer to trigger animation
|
|
338
|
+
const observer = new IntersectionObserver((entries) => {
|
|
339
|
+
entries.forEach(entry => {
|
|
340
|
+
if (entry.isIntersecting) {
|
|
341
|
+
entry.target.classList.remove('opacity-0', 'translate-y-4')
|
|
342
|
+
}
|
|
343
|
+
})
|
|
344
|
+
})
|
|
345
|
+
|
|
346
|
+
document.querySelectorAll('[data-animate]').forEach(el => observer.observe(el))
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Skeleton Loader
|
|
350
|
+
|
|
351
|
+
```html
|
|
352
|
+
<div class="animate-pulse">
|
|
353
|
+
<div class="h-4 bg-gray-200 rounded w-3/4 mb-4"></div>
|
|
354
|
+
<div class="h-4 bg-gray-200 rounded w-1/2 mb-4"></div>
|
|
355
|
+
<div class="h-4 bg-gray-200 rounded w-5/6"></div>
|
|
356
|
+
</div>
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### Hamburger to X Animation
|
|
360
|
+
|
|
361
|
+
```html
|
|
362
|
+
<button class="group" aria-label="Toggle menu">
|
|
363
|
+
<span class="block w-6 h-0.5 bg-black transition-all duration-200 group-open:rotate-45 group-open:translate-y-1.5"></span>
|
|
364
|
+
<span class="block w-6 h-0.5 bg-black mt-1 transition-opacity duration-200 group-open:opacity-0"></span>
|
|
365
|
+
<span class="block w-6 h-0.5 bg-black mt-1 transition-all duration-200 group-open:-rotate-45 group-open:-translate-y-1.5"></span>
|
|
366
|
+
</button>
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
## Transition on Enter/Leave (with JS)
|
|
370
|
+
|
|
371
|
+
For complex enter/leave transitions, use a library like Headless UI:
|
|
372
|
+
|
|
373
|
+
```jsx
|
|
374
|
+
import { Transition } from '@headlessui/react'
|
|
375
|
+
|
|
376
|
+
function Modal({ isOpen, children }) {
|
|
377
|
+
return (
|
|
378
|
+
<Transition
|
|
379
|
+
show={isOpen}
|
|
380
|
+
enter="transition-opacity duration-300"
|
|
381
|
+
enterFrom="opacity-0"
|
|
382
|
+
enterTo="opacity-100"
|
|
383
|
+
leave="transition-opacity duration-200"
|
|
384
|
+
leaveFrom="opacity-100"
|
|
385
|
+
leaveTo="opacity-0"
|
|
386
|
+
>
|
|
387
|
+
{children}
|
|
388
|
+
</Transition>
|
|
389
|
+
)
|
|
390
|
+
}
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
## Performance Tips
|
|
394
|
+
|
|
395
|
+
### 1. Prefer GPU-Accelerated Properties
|
|
396
|
+
|
|
397
|
+
```html
|
|
398
|
+
<!-- GOOD - GPU accelerated -->
|
|
399
|
+
<div class="transform hover:translate-x-2 transition-transform">
|
|
400
|
+
|
|
401
|
+
<!-- AVOID - May cause repaints -->
|
|
402
|
+
<div class="hover:left-2 transition-all">
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
### 2. Use Specific Transitions
|
|
406
|
+
|
|
407
|
+
```html
|
|
408
|
+
<!-- GOOD - Only transitions what changes -->
|
|
409
|
+
<div class="transition-colors duration-200 hover:bg-blue-500">
|
|
410
|
+
|
|
411
|
+
<!-- AVOID - Transitions everything -->
|
|
412
|
+
<div class="transition-all duration-200 hover:bg-blue-500">
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
### 3. Keep Animations Short
|
|
416
|
+
|
|
417
|
+
```html
|
|
418
|
+
<!-- GOOD - Snappy feedback -->
|
|
419
|
+
<button class="transition-colors duration-150">
|
|
420
|
+
|
|
421
|
+
<!-- AVOID - Too slow for UI feedback -->
|
|
422
|
+
<button class="transition-colors duration-1000">
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### 4. Use will-change Sparingly
|
|
426
|
+
|
|
427
|
+
```html
|
|
428
|
+
<!-- Only for complex, frequently animated elements -->
|
|
429
|
+
<div class="will-change-transform animate-spin">
|
|
430
|
+
Loading spinner
|
|
431
|
+
</div>
|
|
432
|
+
```
|