@istmx/skills 1.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 +49 -0
- package/bin/cli.js +251 -0
- package/istm/SKILL.md +65 -0
- package/istm-animate/SKILL.md +87 -0
- package/istm-animate/animations/animation_utils.md +280 -0
- package/istm-animate/animations/animations.md +220 -0
- package/istm-animate/animations/core_motion.md +250 -0
- package/istm-animate/animations/examples/README.md +29 -0
- package/istm-animate/animations/examples/nuxt/app/app.vue +3 -0
- package/istm-animate/animations/examples/nuxt/app/composables/useGSAP.ts +91 -0
- package/istm-animate/animations/examples/nuxt/app/pages/index.vue +55 -0
- package/istm-animate/animations/examples/nuxt/nuxt.config.ts +4 -0
- package/istm-animate/animations/examples/nuxt/package.json +18 -0
- package/istm-animate/animations/examples/react/App.jsx +46 -0
- package/istm-animate/animations/examples/react/index.html +12 -0
- package/istm-animate/animations/examples/react/main.jsx +9 -0
- package/istm-animate/animations/examples/react/package.json +21 -0
- package/istm-animate/animations/examples/react/vite.config.js +7 -0
- package/istm-animate/animations/examples/vanilla/index.html +33 -0
- package/istm-animate/animations/examples/vanilla/main.js +36 -0
- package/istm-animate/animations/examples/vue/app.vue +47 -0
- package/istm-animate/animations/examples/vue/index.html +15 -0
- package/istm-animate/animations/examples/vue/main.js +9 -0
- package/istm-animate/animations/examples/vue/package.json +19 -0
- package/istm-animate/animations/examples/vue/vite.config.js +7 -0
- package/istm-animate/animations/framework_motion.md +262 -0
- package/istm-animate/animations/motion.csv +17 -0
- package/istm-animate/animations/motion.md +11 -0
- package/istm-animate/animations/motion_catalog.json +226 -0
- package/istm-animate/animations/motion_performance.md +75 -0
- package/istm-animate/animations/motion_plugins.md +429 -0
- package/istm-animate/animations/react_animations.md +132 -0
- package/istm-animate/animations/scroll_trigger_effects.md +291 -0
- package/istm-animate/animations/timeline_sequencing.md +103 -0
- package/istm-architecture/SKILL.md +109 -0
- package/istm-architecture/frameworks/angular.csv +51 -0
- package/istm-architecture/frameworks/astro.csv +54 -0
- package/istm-architecture/frameworks/avalonia.csv +57 -0
- package/istm-architecture/frameworks/flutter.csv +53 -0
- package/istm-architecture/frameworks/javafx.csv +76 -0
- package/istm-architecture/frameworks/jetpack-compose.csv +53 -0
- package/istm-architecture/frameworks/laravel.csv +51 -0
- package/istm-architecture/frameworks/nextjs.csv +53 -0
- package/istm-architecture/frameworks/nuxtjs.csv +59 -0
- package/istm-architecture/frameworks/react-native.csv +52 -0
- package/istm-architecture/frameworks/react.csv +54 -0
- package/istm-architecture/frameworks/svelte.csv +54 -0
- package/istm-architecture/frameworks/swiftui.csv +51 -0
- package/istm-architecture/frameworks/uwp.csv +56 -0
- package/istm-architecture/frameworks/vue.csv +50 -0
- package/istm-architecture/frameworks/winui.csv +60 -0
- package/istm-architecture/frameworks/wpf.csv +57 -0
- package/istm-architecture/templates/agents.md +229 -0
- package/istm-architecture/templates/architecture.md +111 -0
- package/istm-architecture/templates/design.md +138 -0
- package/istm-architecture/templates/project-overview.md +215 -0
- package/istm-awwward-designer/SKILL.md +43 -0
- package/istm-awwward-designer/libraries/threejs.csv +54 -0
- package/istm-awwward-designer/references/accessibility.md +774 -0
- package/istm-awwward-designer/references/anim-anti-patterns.md +576 -0
- package/istm-awwward-designer/references/animation-map.md +166 -0
- package/istm-awwward-designer/references/animation-standards.md +86 -0
- package/istm-awwward-designer/references/anti-patterns.md +191 -0
- package/istm-awwward-designer/references/color-systems.md +604 -0
- package/istm-awwward-designer/references/css-performance.md +477 -0
- package/istm-awwward-designer/references/descender-safety.md +490 -0
- package/istm-awwward-designer/references/design-audit.md +93 -0
- package/istm-awwward-designer/references/font-loading.md +378 -0
- package/istm-awwward-designer/references/image-optimization.md +440 -0
- package/istm-awwward-designer/references/invention-gate.md +356 -0
- package/istm-awwward-designer/references/micro-interactions.md +825 -0
- package/istm-awwward-designer/references/page-transitions.md +365 -0
- package/istm-awwward-designer/references/performance-standards.md +79 -0
- package/istm-awwward-designer/references/quality-gate.md +103 -0
- package/istm-awwward-designer/references/responsive-design.md +778 -0
- package/istm-awwward-designer/references/scoring-guide.md +201 -0
- package/istm-awwward-designer/references/scroll-patterns.md +668 -0
- package/istm-awwward-designer/references/stitch-brief.md +124 -0
- package/istm-awwward-designer/references/tech-stack.md +204 -0
- package/istm-awwward-designer/references/technical-audit.md +133 -0
- package/istm-awwward-designer/references/technique-families.md +293 -0
- package/istm-awwward-designer/references/testing.md +535 -0
- package/istm-awwward-designer/references/text-animation.md +585 -0
- package/istm-awwward-designer/references/typography.md +504 -0
- package/istm-awwward-designer/references/usability-audit.md +108 -0
- package/istm-awwward-designer/references/visual-standards.md +97 -0
- package/istm-design/SKILL.md +98 -0
- package/istm-design/colors/color_theory.md +293 -0
- package/istm-design/colors/colors.csv +193 -0
- package/istm-design/colors/colors_catalog.json +4034 -0
- package/istm-design/colors/palette.json +21 -0
- package/istm-design/styles/design_system.md +288 -0
- package/istm-design/styles/html-tailwind.csv +56 -0
- package/istm-design/styles/nuxt-ui.csv +71 -0
- package/istm-design/styles/product_design.md +55 -0
- package/istm-design/styles/shadcn.csv +61 -0
- package/istm-design/styles/style.md +12 -0
- package/istm-design/styles/styles.csv +85 -0
- package/istm-design/styles/styles_catalog.json +2018 -0
- package/istm-design/styles/ui-reasoning.csv +162 -0
- package/istm-design/styles/uno.csv +60 -0
- package/istm-design/typography/font_and_font.md +10 -0
- package/istm-design/typography/google-fonts.csv +1924 -0
- package/istm-design/typography/sans_serif_fonts.md +112 -0
- package/istm-design/typography/typography.csv +75 -0
- package/istm-design/typography/typography_catalog.json +964 -0
- package/istm-design/ux/app-interface.csv +31 -0
- package/istm-design/ux/charts.csv +26 -0
- package/istm-design/ux/icons.csv +106 -0
- package/istm-design/ux/landing.csv +35 -0
- package/istm-design/ux/products.csv +193 -0
- package/istm-design/ux/react-performance.csv +45 -0
- package/istm-design/ux/responsive_rules.md +62 -0
- package/istm-design/ux/storytelling.md +47 -0
- package/istm-design/ux/ux-guidelines.csv +100 -0
- package/istm-design/ux/ux_guidelines.json +1190 -0
- package/istm-system-design/SKILL.md +88 -0
- package/istm-system-design/principles/01-architecture-patterns.md +24 -0
- package/istm-system-design/principles/02-database-selection.md +32 -0
- package/istm-system-design/principles/03-api-design.md +25 -0
- package/istm-system-design/principles/04-authentication-security.md +23 -0
- package/istm-system-design/principles/05-caching-performance.md +21 -0
- package/istm-system-design/principles/06-asynchronous-processing.md +17 -0
- package/istm-system-design/principles/07-infrastructure-deployment.md +22 -0
- package/istm-system-design/principles/08-low-level-design.md +35 -0
- package/istm-system-design/principles/09-state-management.md +14 -0
- package/istm-system-design/principles/10-error-handling-and-logging.md +26 -0
- package/istm-system-design/principles/11-testing-strategy.md +18 -0
- package/istm-system-design/principles/12-seo-and-web-vitals.md +18 -0
- package/istm-system-design/stacks/SETUP.md +82 -0
- package/istm-system-design/stacks/STACK.md +67 -0
- package/istm-system-design/stacks/WORKFLOW.md +84 -0
- package/istm-system-design/templates/api-route.ts.template +32 -0
- package/istm-system-design/templates/migrations.md.template +30 -0
- package/istm-system-design/templates/schema.drizzle.ts.template +17 -0
- package/istm-system-design/templates/schema.prisma.template +28 -0
- package/istm-system-design/templates/trpc-router.ts.template +22 -0
- package/istm-system-design/templates/zod-validators.ts.template +14 -0
- package/istm-workflow/istm-audit/SKILL.md +108 -0
- package/istm-workflow/istm-audit/agent-prompt.md +393 -0
- package/istm-workflow/istm-audit/agents/openai.yaml +7 -0
- package/istm-workflow/istm-audit/modes/area.md +19 -0
- package/istm-workflow/istm-audit/modes/gapfill.md +12 -0
- package/istm-workflow/istm-audit/modes/greenfield.md +24 -0
- package/istm-workflow/istm-audit/modes/tool-skills.md +39 -0
- package/istm-workflow/istm-audit/modes/whole-repo.md +5 -0
- package/istm-workflow/istm-audit/patterns/clean-architecture.md +15 -0
- package/istm-workflow/istm-audit/patterns/domain-driven.md +16 -0
- package/istm-workflow/istm-audit/patterns/functional.md +16 -0
- package/istm-workflow/istm-audit/patterns/solid-oop.md +17 -0
- package/istm-workflow/istm-check/SKILL.md +52 -0
- package/istm-workflow/istm-check/agents/openai.yaml +7 -0
- package/istm-workflow/istm-check/modes/review.md +156 -0
- package/istm-workflow/istm-check/modes/verify.md +197 -0
- package/istm-workflow/istm-check/review-agent-prompt.md +57 -0
- package/istm-workflow/istm-check/review-guide.md +133 -0
- package/istm-workflow/istm-craft/SKILL.md +37 -0
- package/istm-workflow/istm-craft/agent-modes/architecture.md +73 -0
- package/istm-workflow/istm-craft/agent-modes/cross-cutting.md +65 -0
- package/istm-workflow/istm-craft/agent-modes/enhancement.md +45 -0
- package/istm-workflow/istm-craft/agent-modes/feature.md +85 -0
- package/istm-workflow/istm-craft/agent-prompt.md +249 -0
- package/istm-workflow/istm-craft/agents/openai.yaml +7 -0
- package/istm-workflow/istm-craft/internal/after-subagent.md +90 -0
- package/istm-workflow/istm-craft/internal/design-conversation.md +140 -0
- package/istm-workflow/istm-craft/internal/tool-discovery.md +58 -0
- package/istm-workflow/istm-craft/spec-template.md +278 -0
- package/istm-workflow/istm-debug/SKILL.md +102 -0
- package/istm-workflow/istm-debug/agents/openai.yaml +7 -0
- package/istm-workflow/istm-develop/SKILL.md +144 -0
- package/istm-workflow/istm-develop/agents/openai.yaml +7 -0
- package/istm-workflow/istm-develop/checklist.md +95 -0
- package/istm-workflow/istm-develop/flow/build.md +133 -0
- package/istm-workflow/istm-develop/flow/git.md +34 -0
- package/istm-workflow/istm-develop/logical-guide.md +99 -0
- package/istm-workflow/istm-develop/ui/existing.md +23 -0
- package/istm-workflow/istm-develop/ui/generate.md +131 -0
- package/istm-workflow/istm-develop/ui/image.md +41 -0
- package/istm-workflow/istm-develop/ui/implementation.md +281 -0
- package/istm-workflow/istm-develop/ui/mcp.md +11 -0
- package/istm-workflow/istm-develop/ui-guide.md +164 -0
- package/istm-workflow/istm-document/SKILL.md +123 -0
- package/istm-workflow/istm-document/agent-prompt.md +57 -0
- package/istm-workflow/istm-document/agents/openai.yaml +7 -0
- package/istm-workflow/istm-document/templates/changelog.md +54 -0
- package/istm-workflow/istm-document/templates/postmortem.md +58 -0
- package/istm-workflow/istm-document/templates/pr.md +43 -0
- package/istm-workflow/istm-document/templates/release-note.md +41 -0
- package/istm-workflow/istm-scope/SKILL.md +100 -0
- package/istm-workflow/istm-scope/agents/openai.yaml +7 -0
- package/istm-workflow/istm-scope/approaches/facade.md +33 -0
- package/istm-workflow/istm-scope/approaches/journey.md +31 -0
- package/istm-workflow/istm-scope/approaches/skateboard.md +33 -0
- package/istm-workflow/istm-scope/approaches/tracer-bullet.md +34 -0
- package/istm-workflow/istm-scope/modes/add.md +14 -0
- package/istm-workflow/istm-scope/modes/plan-brownfield.md +11 -0
- package/istm-workflow/istm-scope/modes/plan-greenfield.md +20 -0
- package/istm-workflow/istm-scope/modes/plan-monorepo.md +8 -0
- package/istm-workflow/istm-scope/modes/plan.md +120 -0
- package/istm-workflow/istm-scope/modes/replan.md +13 -0
- package/istm-workflow/istm-scope/scope-template.md +148 -0
- package/istm-workflow/istm-sync/SKILL.md +166 -0
- package/istm-workflow/istm-sync/agent-prompt.md +211 -0
- package/istm-workflow/istm-sync/agents/openai.yaml +7 -0
- package/istm-workflow/istm-test/SKILL.md +233 -0
- package/istm-workflow/istm-test/agent-prompt.md +62 -0
- package/istm-workflow/istm-test/agents/openai.yaml +7 -0
- package/istm-workflow/istm-test/modes/setup.md +97 -0
- package/istm-workflow/istm-test/writing-guide.md +196 -0
- package/package.json +35 -0
|
@@ -0,0 +1,576 @@
|
|
|
1
|
+
# Anti-Patterns — The Definitive No-No List
|
|
2
|
+
|
|
3
|
+
Every pattern here is wrong. Every example shows what NOT to write and why.
|
|
4
|
+
These are hard failures in code review. Know them. Avoid them. Fix them on sight.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 1. `transition: all` — The Cardinal Sin
|
|
9
|
+
|
|
10
|
+
The single most destructive CSS mistake. Animating all properties causes
|
|
11
|
+
layout thrashing, janky performance, and unpredictable behavior.
|
|
12
|
+
|
|
13
|
+
### ❌ BAD
|
|
14
|
+
|
|
15
|
+
```css
|
|
16
|
+
/* NEVER DO THIS */
|
|
17
|
+
button {
|
|
18
|
+
transition: all 0.3s ease;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
a {
|
|
22
|
+
transition: all 0.2s;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
div {
|
|
26
|
+
transition: all 0.5s linear;
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### ✅ CORRECT
|
|
31
|
+
|
|
32
|
+
```css
|
|
33
|
+
/* Only animate what you need */
|
|
34
|
+
button {
|
|
35
|
+
transition:
|
|
36
|
+
transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
|
|
37
|
+
background-color 0.2s ease,
|
|
38
|
+
box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
a {
|
|
42
|
+
transition: color 0.2s ease, opacity 0.2s ease;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
div {
|
|
46
|
+
transition:
|
|
47
|
+
opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
|
|
48
|
+
transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Why It's Bad
|
|
53
|
+
|
|
54
|
+
- Animates `width`, `height`, `margin`, `padding`, `font-size`, etc. — all layout properties
|
|
55
|
+
- Causes reflow/repaint on every frame — destroys 60fps
|
|
56
|
+
- Unpredictable: hover on a `<div>` with `all` might animate `z-index`, `cursor`, `visibility`
|
|
57
|
+
- Makes debugging impossible — which property is causing the issue?
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 2. Animating Layout Properties
|
|
62
|
+
|
|
63
|
+
Animating `width`, `height`, `margin`, `top`, `left`, `font-size` triggers
|
|
64
|
+
expensive layout recalculations. Use `transform` instead.
|
|
65
|
+
|
|
66
|
+
### ❌ BAD
|
|
67
|
+
|
|
68
|
+
```css
|
|
69
|
+
/* DO NOT animate width/height */
|
|
70
|
+
.modal {
|
|
71
|
+
transition: width 0.4s ease, height 0.4s ease, opacity 0.3s ease;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.modal.is-open {
|
|
75
|
+
width: 500px;
|
|
76
|
+
height: 400px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* DO NOT animate margin */
|
|
80
|
+
.card {
|
|
81
|
+
transition: margin-top 0.3s ease, opacity 0.3s ease;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* DO NOT animate font-size directly */
|
|
85
|
+
.headline {
|
|
86
|
+
transition: font-size 0.3s ease;
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### ✅ CORRECT
|
|
91
|
+
|
|
92
|
+
```css
|
|
93
|
+
/* Use transform for size changes */
|
|
94
|
+
.modal {
|
|
95
|
+
transform: scale(0);
|
|
96
|
+
transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.modal.is-open {
|
|
100
|
+
transform: scale(1);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Use transform for position */
|
|
104
|
+
.card {
|
|
105
|
+
transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.card.is-active {
|
|
109
|
+
transform: translateY(-10px);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Use transform: scale() instead of font-size */
|
|
113
|
+
.headline {
|
|
114
|
+
transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.headline.is-enlarged {
|
|
118
|
+
transform: scale(1.2); /* instead of font-size: 72px */
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Performance Impact
|
|
123
|
+
|
|
124
|
+
| Property | Triggered | Cost |
|
|
125
|
+
|----------|-----------|------|
|
|
126
|
+
| `transform` | Composite only | ~0.5ms |
|
|
127
|
+
| `opacity` | Composite only | ~0.5ms |
|
|
128
|
+
| `width`, `height` | Layout + Paint | ~10-50ms |
|
|
129
|
+
| `margin`, `padding` | Layout | ~5-30ms |
|
|
130
|
+
| `top`, `left` | Layout | ~5-30ms |
|
|
131
|
+
| `font-size` | Layout + Paint | ~10-40ms |
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## 3. Blocking the Main Thread
|
|
136
|
+
|
|
137
|
+
Long-running JavaScript on the main thread causes jank, dropped frames,
|
|
138
|
+
and unresponsive UI. Animations must never block user input.
|
|
139
|
+
|
|
140
|
+
### ❌ BAD
|
|
141
|
+
|
|
142
|
+
```js
|
|
143
|
+
// Blocking animation loop — runs continuously, blocks scrolling
|
|
144
|
+
function animate() {
|
|
145
|
+
for (let i = 0; i < 1000000; i++) {
|
|
146
|
+
element.style.transform = `translateX(${i}px)`;
|
|
147
|
+
}
|
|
148
|
+
requestAnimationFrame(animate);
|
|
149
|
+
}
|
|
150
|
+
animate();
|
|
151
|
+
|
|
152
|
+
// Synchronous heavy computation in scroll handler
|
|
153
|
+
window.addEventListener('scroll', () => {
|
|
154
|
+
const result = expensiveComputation(); // blocks thread for 200ms+
|
|
155
|
+
updateUI(result);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// DOM thrashing in loop
|
|
159
|
+
function moveElements() {
|
|
160
|
+
for (let i = 0; i < 100; i++) {
|
|
161
|
+
elements[i].style.left = i * 10 + 'px'; // causes layout each iteration
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### ✅ CORRECT
|
|
167
|
+
|
|
168
|
+
```js
|
|
169
|
+
// Use RAF for animation loops — yields to browser between frames
|
|
170
|
+
function animate(timestamp) {
|
|
171
|
+
// Lightweight per-frame updates
|
|
172
|
+
element.style.transform = `translateX(${timestamp / 10}px)`;
|
|
173
|
+
requestAnimationFrame(animate);
|
|
174
|
+
}
|
|
175
|
+
requestAnimationFrame(animate);
|
|
176
|
+
|
|
177
|
+
// Throttle/debounce expensive scroll handlers
|
|
178
|
+
import { throttle } from 'lodash-es';
|
|
179
|
+
|
|
180
|
+
window.addEventListener('scroll', throttle(() => {
|
|
181
|
+
const result = getScrollPosition(); // cheap
|
|
182
|
+
requestAnimationFrame(() => updateUI(result)); // non-blocking
|
|
183
|
+
}, 16), { passive: true });
|
|
184
|
+
|
|
185
|
+
// Batch DOM reads/writes
|
|
186
|
+
function moveElements() {
|
|
187
|
+
// Read all first
|
|
188
|
+
const positions = elements.map(el => el.dataset.index * 10);
|
|
189
|
+
// Then write all
|
|
190
|
+
elements.forEach((el, i) => {
|
|
191
|
+
el.style.transform = `translateX(${positions[i]}px)`;
|
|
192
|
+
});
|
|
193
|
+
// Trigger one reflow by reading
|
|
194
|
+
document.body.offsetHeight; // force reflow
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Web Workers for heavy computation
|
|
198
|
+
const worker = new Worker('compute.js');
|
|
199
|
+
worker.postMessage({ data: bigArray });
|
|
200
|
+
worker.onmessage = (e) => updateUI(e.data);
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Warning Signs
|
|
204
|
+
|
|
205
|
+
- "Long task" entries in Chrome DevTools Performance tab
|
|
206
|
+
- `getComputedStyle` inside loops
|
|
207
|
+
- Synchronous `XMLHttpRequest` (use fetch instead)
|
|
208
|
+
- Heavy array operations on large datasets without debouncing
|
|
209
|
+
- Canvas/WebGL rendering without `requestAnimationFrame`
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## 4. Infinite Distracting Animations
|
|
214
|
+
|
|
215
|
+
Animations that loop forever without purpose drain battery, distract users,
|
|
216
|
+
and scream "amateur hour." Never animate something that doesn't need animating.
|
|
217
|
+
|
|
218
|
+
### ❌ BAD
|
|
219
|
+
|
|
220
|
+
```css
|
|
221
|
+
/* Floating animation that never stops */
|
|
222
|
+
.logo {
|
|
223
|
+
animation: float 3s ease-in-out infinite;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
@keyframes float {
|
|
227
|
+
0%, 100% { transform: translateY(0); }
|
|
228
|
+
50% { transform: translateY(-10px); }
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/* Pulsing glow that never stops */
|
|
232
|
+
.hero-bg {
|
|
233
|
+
animation: pulse 2s ease-in-out infinite;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/* Spinning loader that doesn't stop */
|
|
237
|
+
.spinner {
|
|
238
|
+
animation: spin 1s linear infinite;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/* Scrolling marquee text */
|
|
242
|
+
.marquee {
|
|
243
|
+
animation: marquee 20s linear infinite;
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### ✅ CORRECT
|
|
248
|
+
|
|
249
|
+
```css
|
|
250
|
+
/* Floating only during hero section — triggered, not looping */
|
|
251
|
+
.hero-logo.is-floating {
|
|
252
|
+
animation: float 3s ease-in-out 2; /* runs 2 times, stops */
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/* Pulse once on load */
|
|
256
|
+
.hero-glow {
|
|
257
|
+
animation: pulse-once 1s ease-out forwards;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/* Loaders MUST stop when content loads */
|
|
261
|
+
.spinner.is-hidden {
|
|
262
|
+
animation: spin 1s linear infinite; /* paused via display:none instead */
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/* Marquees: use only when appropriate, stop when off-screen */
|
|
266
|
+
.marquee {
|
|
267
|
+
animation: marquee 20s linear infinite;
|
|
268
|
+
animation-play-state: paused; /* start on hover or intersection */
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.marquee:hover {
|
|
272
|
+
animation-play-state: running;
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### When Infinite Animation IS OK
|
|
277
|
+
|
|
278
|
+
- **Loading spinners**: User is explicitly waiting
|
|
279
|
+
- **Background ambience**: Only when page is NOT the active tab (use `document.visibilityState`)
|
|
280
|
+
- **Decorative elements that user can dismiss**: Show once, offer to dismiss
|
|
281
|
+
|
|
282
|
+
```js
|
|
283
|
+
// Only animate when page is visible
|
|
284
|
+
document.addEventListener('visibilitychange', () => {
|
|
285
|
+
if (document.visibilityState === 'visible') {
|
|
286
|
+
document.querySelector('.ambient-bg').style.animationPlayState = 'running';
|
|
287
|
+
} else {
|
|
288
|
+
document.querySelector('.ambient-bg').style.animationPlayState = 'paused';
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## 5. Parallax Without Purpose
|
|
296
|
+
|
|
297
|
+
Parallax that exists "for visual interest" without functional purpose adds
|
|
298
|
+
complexity, performance cost, and often feels gimmicky. If parallax doesn't
|
|
299
|
+
reveal, emphasize, or create narrative, don't use it.
|
|
300
|
+
|
|
301
|
+
### ❌ BAD
|
|
302
|
+
|
|
303
|
+
```js
|
|
304
|
+
// Parallax on decorative elements that adds nothing
|
|
305
|
+
document.querySelectorAll('.decorative-circle').forEach(el => {
|
|
306
|
+
gsap.to(el, {
|
|
307
|
+
y: () => ScrollTrigger.scroll() * 0.1,
|
|
308
|
+
// No clear purpose — just "it moves"
|
|
309
|
+
});
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
// Parallax on ALL elements — overkill
|
|
313
|
+
gsap.utils.toArray('section > *').forEach(el => {
|
|
314
|
+
gsap.to(el, { y: -50, scrollTrigger: { ... } });
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
// Parallax that contradicts scroll direction — nauseating
|
|
318
|
+
gsap.to('.weird-element', {
|
|
319
|
+
y: () => -ScrollTrigger.scroll() * 0.3, // moves up while scrolling down
|
|
320
|
+
});
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### ✅ CORRECT
|
|
324
|
+
|
|
325
|
+
```js
|
|
326
|
+
// Parallax on a background image — creates depth hierarchy
|
|
327
|
+
gsap.to('.hero-bg', {
|
|
328
|
+
yPercent: 30, // background moves slower = depth
|
|
329
|
+
ease: 'none',
|
|
330
|
+
scrollTrigger: {
|
|
331
|
+
trigger: '.hero',
|
|
332
|
+
start: 'top top',
|
|
333
|
+
end: 'bottom top',
|
|
334
|
+
scrub: true,
|
|
335
|
+
},
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
// Parallax that reveals hidden content
|
|
339
|
+
gsap.to('.parallax-overlay', {
|
|
340
|
+
yPercent: -100, // scrolls away to reveal section beneath
|
|
341
|
+
scrollTrigger: {
|
|
342
|
+
trigger: '.parallax-overlay',
|
|
343
|
+
start: 'top top',
|
|
344
|
+
end: 'bottom top',
|
|
345
|
+
scrub: 1,
|
|
346
|
+
},
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
// Purposeful parallax: guide attention to next section
|
|
350
|
+
gsap.to('.scroll-indicator', {
|
|
351
|
+
y: 100,
|
|
352
|
+
opacity: 0,
|
|
353
|
+
scrollTrigger: {
|
|
354
|
+
trigger: '.hero',
|
|
355
|
+
start: 'top top',
|
|
356
|
+
end: 'bottom top',
|
|
357
|
+
scrub: true,
|
|
358
|
+
// Indicator fades as user scrolls — guides "there's more below"
|
|
359
|
+
},
|
|
360
|
+
});
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### Quick Purpose Test
|
|
364
|
+
|
|
365
|
+
Ask: "What does this parallax communicate?" If the answer is "nothing," remove it.
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
## 6. Linear Easing Everywhere
|
|
370
|
+
|
|
371
|
+
Linear easing makes animations feel robotic, mechanical, and cheap.
|
|
372
|
+
Everything in nature has non-linear motion. Every UI animation needs easing.
|
|
373
|
+
|
|
374
|
+
### ❌ BAD
|
|
375
|
+
|
|
376
|
+
```css
|
|
377
|
+
/* All linear — everywhere */
|
|
378
|
+
.modal {
|
|
379
|
+
transition: all 0.3s linear;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.card {
|
|
383
|
+
transition: transform 0.5s linear, opacity 0.5s linear;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.nav-link {
|
|
387
|
+
transition: color 0.2s linear;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/* GSAP linear — never use for user-facing animations */
|
|
391
|
+
gsap.to('.element', {
|
|
392
|
+
x: 100,
|
|
393
|
+
duration: 1,
|
|
394
|
+
ease: 'none', // linear
|
|
395
|
+
});
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### ✅ CORRECT
|
|
399
|
+
|
|
400
|
+
```css
|
|
401
|
+
/* Non-linear easing for every transition */
|
|
402
|
+
.modal {
|
|
403
|
+
transition:
|
|
404
|
+
transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
|
|
405
|
+
opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.card {
|
|
409
|
+
transition:
|
|
410
|
+
transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
|
|
411
|
+
opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.nav-link {
|
|
415
|
+
transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/* GSAP — always use named eases */
|
|
419
|
+
gsap.to('.element', {
|
|
420
|
+
x: 100,
|
|
421
|
+
duration: 1,
|
|
422
|
+
ease: 'power4.out', // fast start, smooth landing
|
|
423
|
+
});
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
### When Linear IS OK
|
|
427
|
+
|
|
428
|
+
- **Scrub-based animations**: `scrub: 1` in ScrollTrigger — linear is correct because it's tied to scroll position
|
|
429
|
+
- **Progress indicators**: Loading bars, timelines where uniform speed is intentional
|
|
430
|
+
- **CSS `linear()` function**: For specific UI patterns (sliders, volume controls)
|
|
431
|
+
|
|
432
|
+
```js
|
|
433
|
+
// Scrub = linear is correct
|
|
434
|
+
gsap.to('.progress-bar', {
|
|
435
|
+
scaleX: progress,
|
|
436
|
+
ease: 'none', // linear — tied 1:1 to scroll
|
|
437
|
+
scrollTrigger: {
|
|
438
|
+
trigger: '.scroll-progress',
|
|
439
|
+
start: 'top top',
|
|
440
|
+
end: 'bottom bottom',
|
|
441
|
+
scrub: 0.5,
|
|
442
|
+
},
|
|
443
|
+
});
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
---
|
|
447
|
+
|
|
448
|
+
## 7. No `prefers-reduced-motion` Support
|
|
449
|
+
|
|
450
|
+
Animations that play regardless of user preference are inaccessible and
|
|
451
|
+
potentially harmful. WCAG 2.1 Level AA requires respecting this preference.
|
|
452
|
+
|
|
453
|
+
### ❌ BAD
|
|
454
|
+
|
|
455
|
+
```css
|
|
456
|
+
/* No reduced motion handling */
|
|
457
|
+
.hero {
|
|
458
|
+
animation: hero-entrance 1.2s ease-out;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
.content {
|
|
462
|
+
transition: all 0.5s;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/* Everything loops and animates, always */
|
|
466
|
+
.floating {
|
|
467
|
+
animation: float 3s ease-in-out infinite;
|
|
468
|
+
}
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
### ✅ CORRECT
|
|
472
|
+
|
|
473
|
+
```css
|
|
474
|
+
/* Respect reduced motion at the CSS level */
|
|
475
|
+
@media (prefers-reduced-motion: reduce) {
|
|
476
|
+
*,
|
|
477
|
+
*::before,
|
|
478
|
+
*::after {
|
|
479
|
+
animation-duration: 0.01ms !important;
|
|
480
|
+
animation-iteration-count: 1 !important;
|
|
481
|
+
transition-duration: 0.01ms !important;
|
|
482
|
+
scroll-behavior: auto !important;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/* Exception: essential motion only */
|
|
486
|
+
.loading-spinner {
|
|
487
|
+
animation-duration: 2s !important; /* user expects spinner */
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/* For animations that ARE essential, allow them selectively */
|
|
492
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
493
|
+
.hero {
|
|
494
|
+
animation: hero-entrance 1.2s ease-out;
|
|
495
|
+
}
|
|
496
|
+
.floating {
|
|
497
|
+
animation: float 3s ease-in-out infinite;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
```js
|
|
503
|
+
// Respect reduced motion in JavaScript
|
|
504
|
+
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
505
|
+
|
|
506
|
+
// Scroll animations
|
|
507
|
+
if (!prefersReducedMotion) {
|
|
508
|
+
gsap.registerPlugin(ScrollTrigger);
|
|
509
|
+
|
|
510
|
+
// These animations only run if user has no motion preference
|
|
511
|
+
gsap.from('.hero-title', {
|
|
512
|
+
y: 50,
|
|
513
|
+
opacity: 0,
|
|
514
|
+
duration: 0.8,
|
|
515
|
+
scrollTrigger: {
|
|
516
|
+
trigger: '.hero-title',
|
|
517
|
+
start: 'top 80%',
|
|
518
|
+
},
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// Or check dynamically
|
|
523
|
+
window.matchMedia('(prefers-reduced-motion: reduce)')
|
|
524
|
+
.addEventListener('change', (e) => {
|
|
525
|
+
if (e.matches) {
|
|
526
|
+
// User just enabled reduced motion — kill active animations
|
|
527
|
+
gsap.killTweensOf('*');
|
|
528
|
+
ScrollTrigger.getAll().forEach(t => t.kill());
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
### What "Reduced Motion" Means
|
|
534
|
+
|
|
535
|
+
| Motion Type | Full Behavior | Reduced Motion |
|
|
536
|
+
|-------------|--------------|---------------|
|
|
537
|
+
| Entrance animation | Full choreographed reveal | Instant or minimal |
|
|
538
|
+
| Scroll parallax | Active | Disabled |
|
|
539
|
+
| Hover animations | Full | Minimal or disabled |
|
|
540
|
+
| Page transitions | Animated | Instant cut or fade |
|
|
541
|
+
| Loading spinners | Animated | Static or "Loading..." |
|
|
542
|
+
| Carousels | Auto-advance | User-controlled only |
|
|
543
|
+
|
|
544
|
+
---
|
|
545
|
+
|
|
546
|
+
## Anti-Pattern Quick Reference
|
|
547
|
+
|
|
548
|
+
| Anti-Pattern | What to Do Instead |
|
|
549
|
+
|-------------|-------------------|
|
|
550
|
+
| `transition: all` | List specific properties only |
|
|
551
|
+
| Animate `width`/`height` | Use `transform: scale()` |
|
|
552
|
+
| `linear` easing | Use `power4.out`, `back.out`, etc. |
|
|
553
|
+
| Infinite floating loops | Trigger once, or remove entirely |
|
|
554
|
+
| Parallax without purpose | Remove, or articulate the purpose |
|
|
555
|
+
| No reduced-motion | Add `@media` queries + JS check |
|
|
556
|
+
| Blocking main thread | RAF, Web Workers, batch DOM ops |
|
|
557
|
+
| No cleanup on unmount | Kill ScrollTrigger, remove listeners |
|
|
558
|
+
|
|
559
|
+
---
|
|
560
|
+
|
|
561
|
+
## Code Review Checklist
|
|
562
|
+
|
|
563
|
+
Before shipping any animation work:
|
|
564
|
+
|
|
565
|
+
- [ ] Zero instances of `transition: all` or `transition: all 0.xs`
|
|
566
|
+
- [ ] Zero instances of `linear` in production animation code
|
|
567
|
+
- [ ] All layout property animations converted to `transform`
|
|
568
|
+
- [ ] `prefers-reduced-motion` handled in both CSS and JS
|
|
569
|
+
- [ ] ScrollTrigger instances killed on component unmount
|
|
570
|
+
- [ ] No `setInterval` or `setTimeout` loops for animations
|
|
571
|
+
- [ ] No blocking operations in scroll/RAF callbacks
|
|
572
|
+
- [ ] Parallax elements have a documented purpose
|
|
573
|
+
- [ ] No infinite animations that aren't loaders
|
|
574
|
+
- [ ] DevTools Performance tab shows no "Long tasks" during animation
|
|
575
|
+
|
|
576
|
+
Run this checklist. Every violation is a hard failure.
|