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,427 @@
|
|
|
1
|
+
# Tailwind CSS Animation Patterns
|
|
2
|
+
|
|
3
|
+
## CSS Keyframe Animations
|
|
4
|
+
|
|
5
|
+
### Defining Custom Animations
|
|
6
|
+
|
|
7
|
+
```css
|
|
8
|
+
@theme {
|
|
9
|
+
/* Animation definitions */
|
|
10
|
+
--animate-fade-in: fade-in 0.3s ease-out;
|
|
11
|
+
--animate-fade-out: fade-out 0.3s ease-out;
|
|
12
|
+
--animate-slide-up: slide-up 0.4s ease-out;
|
|
13
|
+
--animate-slide-down: slide-down 0.4s ease-out;
|
|
14
|
+
--animate-scale-in: scale-in 0.2s ease-out;
|
|
15
|
+
--animate-spin-slow: spin 3s linear infinite;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@keyframes fade-in {
|
|
19
|
+
from { opacity: 0; }
|
|
20
|
+
to { opacity: 1; }
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@keyframes fade-out {
|
|
24
|
+
from { opacity: 1; }
|
|
25
|
+
to { opacity: 0; }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@keyframes slide-up {
|
|
29
|
+
from {
|
|
30
|
+
opacity: 0;
|
|
31
|
+
transform: translateY(10px);
|
|
32
|
+
}
|
|
33
|
+
to {
|
|
34
|
+
opacity: 1;
|
|
35
|
+
transform: translateY(0);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@keyframes slide-down {
|
|
40
|
+
from {
|
|
41
|
+
opacity: 0;
|
|
42
|
+
transform: translateY(-10px);
|
|
43
|
+
}
|
|
44
|
+
to {
|
|
45
|
+
opacity: 1;
|
|
46
|
+
transform: translateY(0);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@keyframes scale-in {
|
|
51
|
+
from {
|
|
52
|
+
opacity: 0;
|
|
53
|
+
transform: scale(0.95);
|
|
54
|
+
}
|
|
55
|
+
to {
|
|
56
|
+
opacity: 1;
|
|
57
|
+
transform: scale(1);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Usage
|
|
63
|
+
|
|
64
|
+
```html
|
|
65
|
+
<div class="animate-fade-in">Fades in</div>
|
|
66
|
+
<div class="animate-slide-up">Slides up</div>
|
|
67
|
+
<div class="animate-scale-in">Scales in</div>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Transition Utilities
|
|
71
|
+
|
|
72
|
+
### Transition Properties
|
|
73
|
+
|
|
74
|
+
```html
|
|
75
|
+
<!-- Specific properties (recommended) -->
|
|
76
|
+
<button class="transition-colors duration-200">Color transition</button>
|
|
77
|
+
<button class="transition-transform duration-200">Transform transition</button>
|
|
78
|
+
<button class="transition-opacity duration-200">Opacity transition</button>
|
|
79
|
+
<button class="transition-shadow duration-200">Shadow transition</button>
|
|
80
|
+
|
|
81
|
+
<!-- Multiple properties -->
|
|
82
|
+
<button class="transition-[color,transform] duration-200">Custom</button>
|
|
83
|
+
|
|
84
|
+
<!-- All properties (use sparingly - performance impact) -->
|
|
85
|
+
<button class="transition-all duration-200">All properties</button>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Duration Scale
|
|
89
|
+
|
|
90
|
+
```html
|
|
91
|
+
<div class="transition duration-75">75ms</div>
|
|
92
|
+
<div class="transition duration-100">100ms</div>
|
|
93
|
+
<div class="transition duration-150">150ms (default)</div>
|
|
94
|
+
<div class="transition duration-200">200ms</div>
|
|
95
|
+
<div class="transition duration-300">300ms</div>
|
|
96
|
+
<div class="transition duration-500">500ms</div>
|
|
97
|
+
<div class="transition duration-700">700ms</div>
|
|
98
|
+
<div class="transition duration-1000">1000ms</div>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Timing Functions
|
|
102
|
+
|
|
103
|
+
```html
|
|
104
|
+
<div class="transition ease-linear">Linear</div>
|
|
105
|
+
<div class="transition ease-in">Ease in</div>
|
|
106
|
+
<div class="transition ease-out">Ease out (recommended)</div>
|
|
107
|
+
<div class="transition ease-in-out">Ease in-out</div>
|
|
108
|
+
|
|
109
|
+
<!-- Custom cubic-bezier -->
|
|
110
|
+
<div class="transition ease-[cubic-bezier(0.68,-0.55,0.265,1.55)]">
|
|
111
|
+
Bouncy
|
|
112
|
+
</div>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Delay
|
|
116
|
+
|
|
117
|
+
```html
|
|
118
|
+
<div class="transition delay-75">75ms delay</div>
|
|
119
|
+
<div class="transition delay-100">100ms delay</div>
|
|
120
|
+
<div class="transition delay-150">150ms delay</div>
|
|
121
|
+
<div class="transition delay-200">200ms delay</div>
|
|
122
|
+
<div class="transition delay-300">300ms delay</div>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Interactive Animations
|
|
126
|
+
|
|
127
|
+
### Hover Effects
|
|
128
|
+
|
|
129
|
+
```html
|
|
130
|
+
<!-- Scale on hover -->
|
|
131
|
+
<div class="transition-transform duration-200 hover:scale-105">
|
|
132
|
+
Grows on hover
|
|
133
|
+
</div>
|
|
134
|
+
|
|
135
|
+
<!-- Lift effect -->
|
|
136
|
+
<div class="transition-all duration-200 hover:-translate-y-1 hover:shadow-lg">
|
|
137
|
+
Lifts on hover
|
|
138
|
+
</div>
|
|
139
|
+
|
|
140
|
+
<!-- Color shift -->
|
|
141
|
+
<button class="
|
|
142
|
+
bg-blue-600 text-white
|
|
143
|
+
transition-colors duration-200
|
|
144
|
+
hover:bg-blue-700
|
|
145
|
+
">
|
|
146
|
+
Button
|
|
147
|
+
</button>
|
|
148
|
+
|
|
149
|
+
<!-- Multi-property -->
|
|
150
|
+
<div class="
|
|
151
|
+
transition-all duration-300
|
|
152
|
+
hover:scale-105 hover:shadow-xl hover:bg-gray-50
|
|
153
|
+
">
|
|
154
|
+
Complex hover
|
|
155
|
+
</div>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Focus Effects
|
|
159
|
+
|
|
160
|
+
```html
|
|
161
|
+
<input class="
|
|
162
|
+
border border-gray-300
|
|
163
|
+
transition-all duration-200
|
|
164
|
+
focus:border-blue-500 focus:ring-2 focus:ring-blue-500/20
|
|
165
|
+
focus:outline-none
|
|
166
|
+
" />
|
|
167
|
+
|
|
168
|
+
<button class="
|
|
169
|
+
transition-all duration-200
|
|
170
|
+
focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2
|
|
171
|
+
">
|
|
172
|
+
Accessible focus
|
|
173
|
+
</button>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Active States
|
|
177
|
+
|
|
178
|
+
```html
|
|
179
|
+
<button class="
|
|
180
|
+
transition-transform duration-100
|
|
181
|
+
active:scale-95
|
|
182
|
+
">
|
|
183
|
+
Press effect
|
|
184
|
+
</button>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Group Animations
|
|
188
|
+
|
|
189
|
+
### Group Hover
|
|
190
|
+
|
|
191
|
+
```html
|
|
192
|
+
<div class="group cursor-pointer p-4 border rounded-lg hover:border-blue-500">
|
|
193
|
+
<h3 class="transition-colors group-hover:text-blue-600">Title</h3>
|
|
194
|
+
<p class="transition-colors group-hover:text-gray-600">Description</p>
|
|
195
|
+
<span class="
|
|
196
|
+
inline-block transition-transform
|
|
197
|
+
group-hover:translate-x-1
|
|
198
|
+
">
|
|
199
|
+
→ Read more
|
|
200
|
+
</span>
|
|
201
|
+
</div>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Nested Groups
|
|
205
|
+
|
|
206
|
+
```html
|
|
207
|
+
<div class="group/card p-4 border rounded-lg">
|
|
208
|
+
<div class="group/image relative overflow-hidden">
|
|
209
|
+
<img class="
|
|
210
|
+
transition-transform duration-300
|
|
211
|
+
group-hover/image:scale-110
|
|
212
|
+
" />
|
|
213
|
+
<div class="
|
|
214
|
+
absolute inset-0 bg-black/50
|
|
215
|
+
opacity-0 transition-opacity
|
|
216
|
+
group-hover/image:opacity-100
|
|
217
|
+
">
|
|
218
|
+
Overlay
|
|
219
|
+
</div>
|
|
220
|
+
</div>
|
|
221
|
+
<h3 class="transition-colors group-hover/card:text-blue-600">
|
|
222
|
+
Title
|
|
223
|
+
</h3>
|
|
224
|
+
</div>
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Staggered Animations
|
|
228
|
+
|
|
229
|
+
### CSS Custom Properties
|
|
230
|
+
|
|
231
|
+
```html
|
|
232
|
+
<div class="space-y-2">
|
|
233
|
+
<div class="animate-slide-up" style="animation-delay: 0ms">Item 1</div>
|
|
234
|
+
<div class="animate-slide-up" style="animation-delay: 100ms">Item 2</div>
|
|
235
|
+
<div class="animate-slide-up" style="animation-delay: 200ms">Item 3</div>
|
|
236
|
+
<div class="animate-slide-up" style="animation-delay: 300ms">Item 4</div>
|
|
237
|
+
</div>
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### React Pattern
|
|
241
|
+
|
|
242
|
+
```tsx
|
|
243
|
+
{items.map((item, index) => (
|
|
244
|
+
<div
|
|
245
|
+
key={item.id}
|
|
246
|
+
className="animate-slide-up opacity-0"
|
|
247
|
+
style={{
|
|
248
|
+
animationDelay: `${index * 100}ms`,
|
|
249
|
+
animationFillMode: 'forwards',
|
|
250
|
+
}}
|
|
251
|
+
>
|
|
252
|
+
{item.content}
|
|
253
|
+
</div>
|
|
254
|
+
))}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Loading Animations
|
|
258
|
+
|
|
259
|
+
### Spinner
|
|
260
|
+
|
|
261
|
+
```html
|
|
262
|
+
<svg class="animate-spin h-5 w-5" viewBox="0 0 24 24">
|
|
263
|
+
<circle
|
|
264
|
+
class="opacity-25"
|
|
265
|
+
cx="12" cy="12" r="10"
|
|
266
|
+
stroke="currentColor"
|
|
267
|
+
stroke-width="4"
|
|
268
|
+
fill="none"
|
|
269
|
+
/>
|
|
270
|
+
<path
|
|
271
|
+
class="opacity-75"
|
|
272
|
+
fill="currentColor"
|
|
273
|
+
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
|
|
274
|
+
/>
|
|
275
|
+
</svg>
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Pulse
|
|
279
|
+
|
|
280
|
+
```html
|
|
281
|
+
<div class="animate-pulse flex space-x-4">
|
|
282
|
+
<div class="rounded-full bg-gray-300 h-10 w-10"></div>
|
|
283
|
+
<div class="flex-1 space-y-4 py-1">
|
|
284
|
+
<div class="h-4 bg-gray-300 rounded w-3/4"></div>
|
|
285
|
+
<div class="h-4 bg-gray-300 rounded"></div>
|
|
286
|
+
</div>
|
|
287
|
+
</div>
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Skeleton
|
|
291
|
+
|
|
292
|
+
```css
|
|
293
|
+
@utility skeleton {
|
|
294
|
+
background: linear-gradient(
|
|
295
|
+
90deg,
|
|
296
|
+
var(--color-gray-200) 25%,
|
|
297
|
+
var(--color-gray-300) 50%,
|
|
298
|
+
var(--color-gray-200) 75%
|
|
299
|
+
);
|
|
300
|
+
background-size: 200% 100%;
|
|
301
|
+
animation: shimmer 1.5s infinite;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
@keyframes shimmer {
|
|
305
|
+
0% { background-position: 200% 0; }
|
|
306
|
+
100% { background-position: -200% 0; }
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
```html
|
|
311
|
+
<div class="skeleton h-4 w-full rounded"></div>
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Bounce Dots
|
|
315
|
+
|
|
316
|
+
```html
|
|
317
|
+
<div class="flex space-x-1">
|
|
318
|
+
<div class="w-2 h-2 bg-blue-500 rounded-full animate-bounce" style="animation-delay: 0ms"></div>
|
|
319
|
+
<div class="w-2 h-2 bg-blue-500 rounded-full animate-bounce" style="animation-delay: 150ms"></div>
|
|
320
|
+
<div class="w-2 h-2 bg-blue-500 rounded-full animate-bounce" style="animation-delay: 300ms"></div>
|
|
321
|
+
</div>
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
## Accessibility
|
|
325
|
+
|
|
326
|
+
### Reduced Motion
|
|
327
|
+
|
|
328
|
+
```html
|
|
329
|
+
<!-- Respect user preferences -->
|
|
330
|
+
<div class="
|
|
331
|
+
transition-transform duration-300
|
|
332
|
+
motion-safe:hover:scale-105
|
|
333
|
+
motion-reduce:transition-none
|
|
334
|
+
motion-reduce:hover:scale-100
|
|
335
|
+
">
|
|
336
|
+
Respects motion preferences
|
|
337
|
+
</div>
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### CSS Approach
|
|
341
|
+
|
|
342
|
+
```css
|
|
343
|
+
@media (prefers-reduced-motion: reduce) {
|
|
344
|
+
*,
|
|
345
|
+
*::before,
|
|
346
|
+
*::after {
|
|
347
|
+
animation-duration: 0.01ms !important;
|
|
348
|
+
animation-iteration-count: 1 !important;
|
|
349
|
+
transition-duration: 0.01ms !important;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
## Performance Tips
|
|
355
|
+
|
|
356
|
+
### GPU-Accelerated Properties
|
|
357
|
+
|
|
358
|
+
Prefer these for smooth 60fps animations:
|
|
359
|
+
- `transform` (translate, scale, rotate)
|
|
360
|
+
- `opacity`
|
|
361
|
+
|
|
362
|
+
Avoid animating:
|
|
363
|
+
- `width`, `height`
|
|
364
|
+
- `top`, `left`, `right`, `bottom`
|
|
365
|
+
- `margin`, `padding`
|
|
366
|
+
- `border-width`
|
|
367
|
+
|
|
368
|
+
### will-change
|
|
369
|
+
|
|
370
|
+
```html
|
|
371
|
+
<!-- Use sparingly for complex animations -->
|
|
372
|
+
<div class="will-change-transform hover:scale-105">
|
|
373
|
+
Optimized for transform
|
|
374
|
+
</div>
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### contain
|
|
378
|
+
|
|
379
|
+
```html
|
|
380
|
+
<!-- Isolate repaints -->
|
|
381
|
+
<div class="contain-layout">
|
|
382
|
+
Animation won't affect siblings
|
|
383
|
+
</div>
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
## Common Animation Recipes
|
|
387
|
+
|
|
388
|
+
### Modal Entrance
|
|
389
|
+
|
|
390
|
+
```html
|
|
391
|
+
<div class="
|
|
392
|
+
fixed inset-0 bg-black/50
|
|
393
|
+
animate-fade-in
|
|
394
|
+
">
|
|
395
|
+
<div class="
|
|
396
|
+
bg-white rounded-xl p-6
|
|
397
|
+
animate-scale-in
|
|
398
|
+
">
|
|
399
|
+
Modal content
|
|
400
|
+
</div>
|
|
401
|
+
</div>
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### Toast Notification
|
|
405
|
+
|
|
406
|
+
```html
|
|
407
|
+
<div class="
|
|
408
|
+
fixed bottom-4 right-4
|
|
409
|
+
animate-slide-up
|
|
410
|
+
bg-gray-900 text-white px-4 py-3 rounded-lg shadow-lg
|
|
411
|
+
">
|
|
412
|
+
Notification message
|
|
413
|
+
</div>
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### Menu Dropdown
|
|
417
|
+
|
|
418
|
+
```html
|
|
419
|
+
<div class="
|
|
420
|
+
absolute top-full left-0 mt-2
|
|
421
|
+
origin-top-left
|
|
422
|
+
animate-scale-in
|
|
423
|
+
bg-white rounded-lg shadow-xl
|
|
424
|
+
">
|
|
425
|
+
Menu items
|
|
426
|
+
</div>
|
|
427
|
+
```
|