cursor-kit-cli 1.2.0-beta → 1.2.0-beta.2
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/cli.cjs +333 -56
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +334 -57
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +39 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +33 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/commands/docs.md +5 -3
- package/templates/commands/explain.md +5 -3
- package/templates/commands/fix.md +5 -3
- package/templates/commands/implement.md +5 -3
- package/templates/commands/refactor.md +5 -3
- package/templates/commands/review.md +5 -3
- package/templates/commands/test.md +5 -3
- package/templates/manifest.json +11 -8
- package/templates/rules/git.mdc +0 -2
- package/templates/rules/toc.mdc +17 -9
- package/templates/skills/aesthetic/SKILL.md +121 -0
- package/templates/skills/aesthetic/assets/design-guideline-template.md +163 -0
- package/templates/skills/aesthetic/assets/design-story-template.md +135 -0
- package/templates/skills/aesthetic/references/design-principles.md +62 -0
- package/templates/skills/aesthetic/references/design-resources.md +75 -0
- package/templates/skills/aesthetic/references/micro-interactions.md +53 -0
- package/templates/skills/aesthetic/references/storytelling-design.md +50 -0
- package/templates/skills/backend-development/SKILL.mdc +95 -0
- package/templates/skills/backend-development/references/backend-api-design.md +495 -0
- package/templates/skills/backend-development/references/backend-architecture.md +454 -0
- package/templates/skills/backend-development/references/backend-authentication.md +338 -0
- package/templates/skills/backend-development/references/backend-code-quality.md +659 -0
- package/templates/skills/backend-development/references/backend-debugging.md +904 -0
- package/templates/skills/backend-development/references/backend-devops.md +494 -0
- package/templates/skills/backend-development/references/backend-mindset.md +387 -0
- package/templates/skills/backend-development/references/backend-performance.md +397 -0
- package/templates/skills/backend-development/references/backend-security.md +290 -0
- package/templates/skills/backend-development/references/backend-technologies.md +256 -0
- package/templates/skills/backend-development/references/backend-testing.md +429 -0
- package/templates/skills/frontend-design/SKILL.mdc +41 -0
- package/templates/skills/frontend-design/references/animejs.md +396 -0
- package/templates/skills/frontend-development/SKILL.mdc +399 -0
- package/templates/skills/frontend-development/resources/common-patterns.md +331 -0
- package/templates/skills/frontend-development/resources/complete-examples.md +872 -0
- package/templates/skills/frontend-development/resources/component-patterns.md +502 -0
- package/templates/skills/frontend-development/resources/data-fetching.md +767 -0
- package/templates/skills/frontend-development/resources/file-organization.md +502 -0
- package/templates/skills/frontend-development/resources/loading-and-error-states.md +501 -0
- package/templates/skills/frontend-development/resources/performance.md +406 -0
- package/templates/skills/frontend-development/resources/routing-guide.md +364 -0
- package/templates/skills/frontend-development/resources/styling-guide.md +428 -0
- package/templates/skills/frontend-development/resources/typescript-standards.md +418 -0
- package/templates/skills/problem-solving/SKILL.mdc +96 -0
- package/templates/skills/problem-solving/references/attribution.md +69 -0
- package/templates/skills/problem-solving/references/collision-zone-thinking.md +79 -0
- package/templates/skills/problem-solving/references/inversion-exercise.md +91 -0
- package/templates/skills/problem-solving/references/meta-pattern-recognition.md +87 -0
- package/templates/skills/problem-solving/references/scale-game.md +95 -0
- package/templates/skills/problem-solving/references/simplification-cascades.md +80 -0
- package/templates/skills/problem-solving/references/when-stuck.md +72 -0
- package/templates/skills/research/SKILL.mdc +168 -0
- package/templates/skills/sequential-thinking/.env.example +8 -0
- package/templates/skills/sequential-thinking/README.md +183 -0
- package/templates/skills/sequential-thinking/SKILL.mdc +94 -0
- package/templates/skills/sequential-thinking/package.json +31 -0
- package/templates/skills/sequential-thinking/references/advanced-strategies.md +79 -0
- package/templates/skills/sequential-thinking/references/advanced-techniques.md +76 -0
- package/templates/skills/sequential-thinking/references/core-patterns.md +95 -0
- package/templates/skills/sequential-thinking/references/examples-api.md +88 -0
- package/templates/skills/sequential-thinking/references/examples-architecture.md +94 -0
- package/templates/skills/sequential-thinking/references/examples-debug.md +90 -0
- package/templates/skills/sequential-thinking/scripts/format-thought.js +159 -0
- package/templates/skills/sequential-thinking/scripts/process-thought.js +236 -0
- package/templates/skills/sequential-thinking/tests/format-thought.test.js +133 -0
- package/templates/skills/sequential-thinking/tests/process-thought.test.js +215 -0
- package/templates/skills/ui-styling/LICENSE.txt +202 -0
- package/templates/skills/ui-styling/SKILL.mdc +321 -0
- package/templates/skills/ui-styling/references/canvas-design-system.md +320 -0
- package/templates/skills/ui-styling/references/shadcn-accessibility.md +471 -0
- package/templates/skills/ui-styling/references/shadcn-components.md +424 -0
- package/templates/skills/ui-styling/references/shadcn-theming.md +373 -0
- package/templates/skills/ui-styling/references/tailwind-customization.md +483 -0
- package/templates/skills/ui-styling/references/tailwind-responsive.md +382 -0
- package/templates/skills/ui-styling/references/tailwind-utilities.md +455 -0
- package/templates/rules/frontend-design.mdc +0 -48
- package/templates/rules/performance.mdc +0 -54
- package/templates/rules/react.mdc +0 -58
- package/templates/rules/security.mdc +0 -50
- package/templates/rules/testing.mdc +0 -54
- package/templates/rules/typescript.mdc +0 -36
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: frontend-design
|
|
3
|
+
description: Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
This skill guides creation of distinctive, production-grade frontend interfaces that avoid generic "AI slop" aesthetics. Implement real working code with exceptional attention to aesthetic details and creative choices.
|
|
7
|
+
|
|
8
|
+
The user provides frontend requirements: a component, page, application, or interface to build. They may include context about the purpose, audience, or technical constraints.
|
|
9
|
+
|
|
10
|
+
## Design Thinking
|
|
11
|
+
|
|
12
|
+
Before coding, understand the context and commit to a BOLD aesthetic direction:
|
|
13
|
+
- **Purpose**: What problem does this interface solve? Who uses it?
|
|
14
|
+
- **Tone**: Pick an extreme: brutally minimal, maximalist chaos, retro-futuristic, organic/natural, luxury/refined, playful/toy-like, editorial/magazine, brutalist/raw, art deco/geometric, soft/pastel, industrial/utilitarian, etc. There are so many flavors to choose from. Use these for inspiration but design one that is true to the aesthetic direction.
|
|
15
|
+
- **Constraints**: Technical requirements (framework, performance, accessibility).
|
|
16
|
+
- **Differentiation**: What makes this UNFORGETTABLE? What's the one thing someone will remember?
|
|
17
|
+
|
|
18
|
+
**CRITICAL**: Choose a clear conceptual direction and execute it with precision. Bold maximalism and refined minimalism both work - the key is intentionality, not intensity.
|
|
19
|
+
|
|
20
|
+
Then implement working code (HTML/CSS/JS, React, Vue, etc.) that is:
|
|
21
|
+
- Production-grade and functional
|
|
22
|
+
- Visually striking and memorable
|
|
23
|
+
- Cohesive with a clear aesthetic point-of-view
|
|
24
|
+
- Meticulously refined in every detail
|
|
25
|
+
|
|
26
|
+
## Frontend Aesthetics Guidelines
|
|
27
|
+
|
|
28
|
+
Focus on:
|
|
29
|
+
- **Typography**: Choose fonts that are beautiful, unique, and interesting. Avoid generic fonts like Arial and Inter; opt instead for distinctive choices that elevate the frontend's aesthetics; unexpected, characterful font choices. Pair a distinctive display font with a refined body font.
|
|
30
|
+
- **Color & Theme**: Commit to a cohesive aesthetic. Use CSS variables for consistency. Dominant colors with sharp accents outperform timid, evenly-distributed palettes.
|
|
31
|
+
- **Motion**: Use animations for effects and micro-interactions. Prioritize CSS-only solutions for HTML. Use Motion library for React when available (Use `anime.js` for animations: `./references/animejs.md`). Focus on high-impact moments: one well-orchestrated page load with staggered reveals (animation-delay) creates more delight than scattered micro-interactions. Use scroll-triggering and hover states that surprise.
|
|
32
|
+
- **Spatial Composition**: Unexpected layouts. Asymmetry. Overlap. Diagonal flow. Grid-breaking elements. Generous negative space OR controlled density.
|
|
33
|
+
- **Backgrounds & Visual Details**: Create atmosphere and depth rather than defaulting to solid colors. Add contextual effects and textures that match the overall aesthetic. Apply creative forms like gradient meshes, noise textures, geometric patterns, layered transparencies, dramatic shadows, decorative borders, custom cursors, and grain overlays.
|
|
34
|
+
|
|
35
|
+
NEVER use generic AI-generated aesthetics like overused font families (Inter, Roboto, Arial, system fonts), cliched color schemes (particularly purple gradients on white backgrounds), predictable layouts and component patterns, and cookie-cutter design that lacks context-specific character.
|
|
36
|
+
|
|
37
|
+
Interpret creatively and make unexpected choices that feel genuinely designed for the context. No design should be the same. Vary between light and dark themes, different fonts, different aesthetics. NEVER converge on common choices (Space Grotesk, for example) across generations.
|
|
38
|
+
|
|
39
|
+
**IMPORTANT**: Match implementation complexity to the aesthetic vision. Maximalist designs need elaborate code with extensive animations and effects. Minimalist or refined designs need restraint, precision, and careful attention to spacing, typography, and subtle details. Elegance comes from executing the vision well.
|
|
40
|
+
|
|
41
|
+
Remember: Claude is capable of extraordinary creative work. Don't hold back, show what can truly be created when thinking outside the box and committing fully to a distinctive vision.
|
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
# Anime.js v4 Reference Guide for AI Assistants
|
|
2
|
+
|
|
3
|
+
## 🚨 CRITICAL: ALWAYS USE ANIME.JS V4 SYNTAX 🚨
|
|
4
|
+
|
|
5
|
+
**This project uses Anime.js v4.x.x - DO NOT use v3 syntax under any circumstances**
|
|
6
|
+
|
|
7
|
+
**If you're about to write `import anime from 'animejs'` - STOP!**
|
|
8
|
+
**That's v3. This project uses v4. Use the correct import below.**
|
|
9
|
+
|
|
10
|
+
## 🚀 Quick Start - Essential Setup
|
|
11
|
+
|
|
12
|
+
### 1. Correct v4 Import (REQUIRED)
|
|
13
|
+
```javascript
|
|
14
|
+
// ✅ CORRECT v4 imports
|
|
15
|
+
import { animate, createTimeline, stagger, utils, svg, eases, engine } from 'animejs';
|
|
16
|
+
|
|
17
|
+
// ❌ WRONG v3 import - NEVER USE THIS
|
|
18
|
+
// import anime from 'animejs';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### 2. Configure Time Units to Seconds (SET ONCE IN APP ENTRY POINT)
|
|
22
|
+
```javascript
|
|
23
|
+
// ⚠️ IMPORTANT: Set this ONLY ONCE in your app's main entry point
|
|
24
|
+
// For React: App.js/App.tsx or index.js/index.tsx
|
|
25
|
+
// For Vue: main.js/main.ts
|
|
26
|
+
// For vanilla JS: The main script file that loads first
|
|
27
|
+
|
|
28
|
+
import { engine } from 'animejs';
|
|
29
|
+
|
|
30
|
+
// Set ONLY in the app's entry point, NOT in components
|
|
31
|
+
engine.timeUnit = 's';
|
|
32
|
+
|
|
33
|
+
// Now ALL durations use seconds everywhere: 1 = 1 second, 0.5 = 500ms
|
|
34
|
+
// DO NOT set this in individual components - it's a global setting!
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 3. Single-Line Format for Simple Animations (REQUIRED)
|
|
38
|
+
```javascript
|
|
39
|
+
// ✅ GOOD - Clean, readable, one line for simple tweens
|
|
40
|
+
animate('.element', { x: 250, duration: 1, ease: 'outQuad' });
|
|
41
|
+
|
|
42
|
+
// ❌ BAD - Unnecessary multi-line for simple tweens
|
|
43
|
+
animate('.element', {
|
|
44
|
+
x: 250,
|
|
45
|
+
duration: 1,
|
|
46
|
+
ease: 'outQuad'
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## ✅ Quick Validation Checklist
|
|
51
|
+
|
|
52
|
+
Before generating anime.js code, verify:
|
|
53
|
+
- [ ] Using `import { animate, ... } from 'animejs'` NOT `import anime`
|
|
54
|
+
- [ ] Set `engine.timeUnit = 's'` ONLY ONCE in app entry point (NOT in components)
|
|
55
|
+
- [ ] Using seconds for all durations (1 = 1 second)
|
|
56
|
+
- [ ] Simple animations on ONE LINE
|
|
57
|
+
- [ ] Using `animate()` NOT `anime()`
|
|
58
|
+
- [ ] Using `createTimeline()` NOT `anime.timeline()`
|
|
59
|
+
- [ ] Using `ease:` NOT `easing:`
|
|
60
|
+
- [ ] Using `to:` for values, NOT `value:`
|
|
61
|
+
- [ ] Using `on` prefix for callbacks (onUpdate, onComplete)
|
|
62
|
+
- [ ] Using `loop` and `alternate` NOT `direction`
|
|
63
|
+
- [ ] Using correct v4 stagger syntax with `stagger()`
|
|
64
|
+
- [ ] Using shorthand properties (x, y, z) when possible
|
|
65
|
+
|
|
66
|
+
## 🎯 Core API - Most Common Patterns
|
|
67
|
+
|
|
68
|
+
### Basic Animation (single line for simple tweens)
|
|
69
|
+
```javascript
|
|
70
|
+
// Simple tween - ALWAYS one line
|
|
71
|
+
animate('.element', { x: 250, rotate: 180, duration: 0.8, ease: 'inOutQuad' });
|
|
72
|
+
|
|
73
|
+
// Fade in - one line
|
|
74
|
+
animate('.element', { opacity: [0, 1], y: [20, 0], duration: 0.6, ease: 'outQuad' });
|
|
75
|
+
|
|
76
|
+
// Scale bounce - one line
|
|
77
|
+
animate('.element', { scale: [0, 1], duration: 0.8, ease: 'outElastic(1, 0.5)' });
|
|
78
|
+
|
|
79
|
+
// Infinite loop - one line
|
|
80
|
+
animate('.element', { rotate: 360, duration: 2, loop: true, ease: 'linear' });
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Timeline Creation
|
|
84
|
+
```javascript
|
|
85
|
+
const tl = createTimeline({ defaults: { duration: 1, ease: 'outQuad' } });
|
|
86
|
+
|
|
87
|
+
tl.add('.element1', { x: 250 })
|
|
88
|
+
.add('.element2', { y: 100 }, '+=0.2') // 0.2s after previous
|
|
89
|
+
.add('.element3', { rotate: 180 }, '<'); // at start of previous
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Stagger Animations (single line)
|
|
93
|
+
```javascript
|
|
94
|
+
animate('.elements', { x: 250, delay: stagger(0.1) }); // 0.1s between each
|
|
95
|
+
animate('.elements', { x: 250, delay: stagger(0.1, { from: 'center' }) });
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## ❌ Common AI Mistakes to Avoid
|
|
99
|
+
|
|
100
|
+
### MISTAKE #1: Using v3 Import Pattern
|
|
101
|
+
```javascript
|
|
102
|
+
// ❌ WRONG - This is v3
|
|
103
|
+
import anime from 'animejs';
|
|
104
|
+
anime({ targets: '.element', translateX: 250 });
|
|
105
|
+
|
|
106
|
+
// ✅ CORRECT - Always use v4
|
|
107
|
+
import { animate } from 'animejs';
|
|
108
|
+
animate('.element', { x: 250 });
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### MISTAKE #2: Using 'targets' Property
|
|
112
|
+
```javascript
|
|
113
|
+
// ❌ WRONG - 'targets' is v3
|
|
114
|
+
animate({ targets: '.element', translateX: 250 });
|
|
115
|
+
|
|
116
|
+
// ✅ CORRECT - First parameter is the target
|
|
117
|
+
animate('.element', { x: 250 });
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### MISTAKE #3: Using 'easing' Instead of 'ease'
|
|
121
|
+
```javascript
|
|
122
|
+
// ❌ WRONG
|
|
123
|
+
animate('.element', { x: 250, easing: 'easeInOutQuad' });
|
|
124
|
+
|
|
125
|
+
// ✅ CORRECT
|
|
126
|
+
animate('.element', { x: 250, ease: 'inOutQuad' });
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### MISTAKE #4: Using 'value' for Animation Values
|
|
130
|
+
```javascript
|
|
131
|
+
// ❌ WRONG - 'value' is v3
|
|
132
|
+
animate('.element', { x: { value: 250 } });
|
|
133
|
+
|
|
134
|
+
// ✅ CORRECT - Use 'to' for values
|
|
135
|
+
animate('.element', { x: { to: 250 } });
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### MISTAKE #5: Wrong Timeline Syntax
|
|
139
|
+
```javascript
|
|
140
|
+
// ❌ WRONG - anime.timeline() is v3
|
|
141
|
+
const tl = anime.timeline();
|
|
142
|
+
|
|
143
|
+
// ✅ CORRECT - Use createTimeline
|
|
144
|
+
import { createTimeline } from 'animejs';
|
|
145
|
+
const tl = createTimeline();
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## 📋 Property Syntax Reference (v3 → v4)
|
|
149
|
+
|
|
150
|
+
### Animation Values
|
|
151
|
+
```javascript
|
|
152
|
+
// ✅ v4: Use 'to' for target values
|
|
153
|
+
{ opacity: { to: 0.5 } }
|
|
154
|
+
{ x: { to: [0, 100] } }
|
|
155
|
+
|
|
156
|
+
// ❌ v3: DON'T use 'value'
|
|
157
|
+
// { opacity: { value: 0.5 } }
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Easing Functions
|
|
161
|
+
```javascript
|
|
162
|
+
// ✅ v4: Use 'ease' (no 'ease' prefix)
|
|
163
|
+
{ ease: 'inOutQuad' }
|
|
164
|
+
{ ease: 'outElastic(1, 0.5)' }
|
|
165
|
+
{ ease: 'cubicBezier(0.4, 0, 0.2, 1)' }
|
|
166
|
+
|
|
167
|
+
// ❌ v3: DON'T use 'easing' or 'ease' prefix
|
|
168
|
+
// { easing: 'easeInOutQuad' }
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Direction & Looping
|
|
172
|
+
```javascript
|
|
173
|
+
// ✅ v4
|
|
174
|
+
{
|
|
175
|
+
loop: true, // infinite loop
|
|
176
|
+
loop: 3, // loop 3 times
|
|
177
|
+
alternate: true, // alternate direction
|
|
178
|
+
reversed: true // play in reverse
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// ❌ v3: DON'T use 'direction'
|
|
182
|
+
// { direction: 'alternate' }
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Transform Properties (Shorthand Preferred)
|
|
186
|
+
```javascript
|
|
187
|
+
// ✅ Both syntaxes work in v4:
|
|
188
|
+
animate('.element', { x: 100, y: 50, z: 25 }); // shorthand (preferred)
|
|
189
|
+
animate('.element', { translateX: 100, translateY: 50, translateZ: 25 }); // explicit
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Callbacks (ALL prefixed with 'on')
|
|
193
|
+
```javascript
|
|
194
|
+
// ✅ v4: Simple callback - keep on one line
|
|
195
|
+
animate('.element', { x: 250, duration: 1, onComplete: () => console.log('Done!') });
|
|
196
|
+
|
|
197
|
+
// ✅ v4: Multiple callbacks - use multi-line
|
|
198
|
+
animate('.element', {
|
|
199
|
+
x: 250,
|
|
200
|
+
duration: 1,
|
|
201
|
+
onBegin: (anim) => console.log('Started'),
|
|
202
|
+
onUpdate: (anim) => console.log('Progress:', anim.progress),
|
|
203
|
+
onComplete: (anim) => console.log('Finished')
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
// ❌ v3: DON'T use unprefixed callbacks
|
|
207
|
+
// { update: () => {}, complete: () => {} }
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## 📝 Code Formatting Guidelines
|
|
211
|
+
|
|
212
|
+
### ALWAYS Use Single-Line Format for Simple Animations
|
|
213
|
+
**This is mandatory for readability** - Use for animations with ≤4 properties:
|
|
214
|
+
```javascript
|
|
215
|
+
// ✅ GOOD - Clean, readable, one line
|
|
216
|
+
animate('.element', { x: 250, duration: 1, ease: 'outQuad' });
|
|
217
|
+
animate('.box', { opacity: 0.5, scale: 0.8, duration: 0.3 });
|
|
218
|
+
|
|
219
|
+
// ❌ BAD - Unnecessary multi-line for simple tweens
|
|
220
|
+
animate('.element', {
|
|
221
|
+
x: 250,
|
|
222
|
+
duration: 1,
|
|
223
|
+
ease: 'outQuad'
|
|
224
|
+
});
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Multi-Line Format (Only for Complex Animations)
|
|
228
|
+
Use for animations with >4 properties or callbacks:
|
|
229
|
+
```javascript
|
|
230
|
+
// Complex animation with callbacks - multi-line is appropriate
|
|
231
|
+
animate('.element', {
|
|
232
|
+
x: { to: [0, 100, 50], duration: 2 },
|
|
233
|
+
y: { to: [0, -50, 0], duration: 2 },
|
|
234
|
+
scale: [0, 1.2, 1],
|
|
235
|
+
ease: 'outElastic(1, 0.5)',
|
|
236
|
+
onComplete: () => console.log('Done!')
|
|
237
|
+
});
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## 🎨 Common Animation Patterns
|
|
241
|
+
|
|
242
|
+
### Hover Animation (single line per animation)
|
|
243
|
+
```javascript
|
|
244
|
+
element.addEventListener('mouseenter', () => animate(element, { scale: 1.1, duration: 0.3, ease: 'outQuad' }));
|
|
245
|
+
element.addEventListener('mouseleave', () => animate(element, { scale: 1, duration: 0.3, ease: 'outQuad' }));
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Sequential Timeline
|
|
249
|
+
```javascript
|
|
250
|
+
const tl = createTimeline({ defaults: { duration: 0.5 } });
|
|
251
|
+
tl.add('.step1', { x: 100 })
|
|
252
|
+
.add('.step2', { y: 100 })
|
|
253
|
+
.add('.step3', { scale: 2 });
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Scroll-triggered Animation
|
|
257
|
+
```javascript
|
|
258
|
+
import { createScrollObserver } from 'animejs';
|
|
259
|
+
|
|
260
|
+
createScrollObserver({
|
|
261
|
+
target: '.scroll-element',
|
|
262
|
+
root: document.querySelector('.scroll-container'),
|
|
263
|
+
play: () => animate('.element', { x: 250, duration: 1 }),
|
|
264
|
+
visibility: 0.5
|
|
265
|
+
});
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## 🔧 Advanced Features
|
|
269
|
+
|
|
270
|
+
### SVG Animations
|
|
271
|
+
```javascript
|
|
272
|
+
import { animate, svg } from 'animejs';
|
|
273
|
+
|
|
274
|
+
// Morph path (single line)
|
|
275
|
+
animate('#path1', { d: svg.morphTo('#path2'), duration: 1 });
|
|
276
|
+
|
|
277
|
+
// Draw SVG line
|
|
278
|
+
const drawable = svg.createDrawable('.svg-path');
|
|
279
|
+
animate(drawable, { draw: '0% 100%', duration: 2 });
|
|
280
|
+
|
|
281
|
+
// Motion path (single line for simple usage)
|
|
282
|
+
const motionPath = svg.createMotionPath('#motion-path');
|
|
283
|
+
animate('.element', { x: motionPath.translateX, y: motionPath.translateY, rotate: motionPath.rotate });
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Utility Functions
|
|
287
|
+
```javascript
|
|
288
|
+
import { utils } from 'animejs';
|
|
289
|
+
|
|
290
|
+
// DOM selection
|
|
291
|
+
const elements = utils.$('.elements');
|
|
292
|
+
|
|
293
|
+
// Get current value
|
|
294
|
+
const currentX = utils.get('.element', 'translateX');
|
|
295
|
+
|
|
296
|
+
// Set values immediately
|
|
297
|
+
utils.set('.element', { x: 100, opacity: 0.5 });
|
|
298
|
+
|
|
299
|
+
// Remove animations
|
|
300
|
+
utils.remove('.element');
|
|
301
|
+
|
|
302
|
+
// Math utilities
|
|
303
|
+
utils.random(0, 100);
|
|
304
|
+
utils.shuffle([1, 2, 3, 4]);
|
|
305
|
+
utils.lerp(0, 100, 0.5); // 50
|
|
306
|
+
utils.clamp(150, 0, 100); // 100
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### TypeScript Support
|
|
310
|
+
```typescript
|
|
311
|
+
import { animate, createTimeline, JSAnimation, Timeline, AnimationParams, TimelineParams } from 'animejs';
|
|
312
|
+
|
|
313
|
+
// Single line for simple animations
|
|
314
|
+
const animation: JSAnimation = animate('.element', { x: 250, duration: 1 } as AnimationParams);
|
|
315
|
+
|
|
316
|
+
const timeline: Timeline = createTimeline({ defaults: { duration: 0.8 } } as TimelineParams);
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
## ⚡ Performance Tips
|
|
320
|
+
|
|
321
|
+
1. **Use transforms over position properties**
|
|
322
|
+
```javascript
|
|
323
|
+
// ✅ Good - uses transform
|
|
324
|
+
animate('.element', { x: 100 });
|
|
325
|
+
|
|
326
|
+
// ❌ Avoid - triggers layout
|
|
327
|
+
animate('.element', { left: 100 });
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
2. **Batch animations in timelines**
|
|
331
|
+
```javascript
|
|
332
|
+
// ✅ Good - single timeline
|
|
333
|
+
const tl = createTimeline();
|
|
334
|
+
elements.forEach(el => tl.add(el, { x: 100 }));
|
|
335
|
+
|
|
336
|
+
// ❌ Avoid - multiple animations
|
|
337
|
+
elements.forEach(el => animate(el, { x: 100 }));
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
3. **Use will-change CSS property for complex animations**
|
|
341
|
+
```css
|
|
342
|
+
.animated-element {
|
|
343
|
+
will-change: transform, opacity;
|
|
344
|
+
}
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
## 🚫 How to Identify V3 Code (DON'T USE)
|
|
348
|
+
|
|
349
|
+
If you see ANY of these patterns, it's v3 and MUST be updated:
|
|
350
|
+
|
|
351
|
+
```javascript
|
|
352
|
+
// All of these are V3 - NEVER USE:
|
|
353
|
+
anime({ ... })
|
|
354
|
+
anime.timeline()
|
|
355
|
+
anime.stagger()
|
|
356
|
+
anime.random()
|
|
357
|
+
anime.remove()
|
|
358
|
+
anime.get()
|
|
359
|
+
anime.set()
|
|
360
|
+
anime.running
|
|
361
|
+
{ targets: '...' }
|
|
362
|
+
{ easing: '...' }
|
|
363
|
+
{ value: ... }
|
|
364
|
+
{ direction: 'alternate' }
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
## 💡 AI Code Generation Rules
|
|
368
|
+
|
|
369
|
+
When asked to create animations with anime.js:
|
|
370
|
+
|
|
371
|
+
1. **ONLY** set `engine.timeUnit = 's'` ONCE in the app's main entry point (App.js, main.js, index.js) - NEVER in components
|
|
372
|
+
2. **ALWAYS** use seconds for all durations (1 = 1 second)
|
|
373
|
+
3. **ALWAYS** format simple animations on ONE LINE
|
|
374
|
+
4. **ALWAYS** start with v4 imports
|
|
375
|
+
5. **NEVER** use `anime()` function
|
|
376
|
+
6. **ALWAYS** use `animate()` for animations
|
|
377
|
+
7. **NEVER** include `targets` property
|
|
378
|
+
8. **ALWAYS** use `ease` not `easing`
|
|
379
|
+
9. **NEVER** use `value`, use `to` instead
|
|
380
|
+
10. **ALWAYS** prefix callbacks with `on`
|
|
381
|
+
11. **NEVER** use `direction`, use `alternate` and `reversed`
|
|
382
|
+
12. **ALWAYS** use `createTimeline()` for timelines
|
|
383
|
+
13. **PREFER** shorthand (`x`) over explicit (`translateX`)
|
|
384
|
+
14. **FORMAT** short animations on single line (≤4 properties)
|
|
385
|
+
15. **NEVER** generate v3 syntax under any circumstances
|
|
386
|
+
|
|
387
|
+
## NPM Installation
|
|
388
|
+
```bash
|
|
389
|
+
npm install animejs
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
## Version Check
|
|
393
|
+
```javascript
|
|
394
|
+
// Current version: 4.x.x
|
|
395
|
+
// If you see any code using anime({ targets: ... }), it's v3 and needs updating!
|
|
396
|
+
```
|