ai-react-animations 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 AI Animation Framework Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # ai-react-animations
2
+
3
+ Beautiful AI loading animation components for React/Next.js. Shows AI processing states with a friendly robot character.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install ai-react-animations
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```tsx
14
+ import AiCreating from 'ai-react-animations';
15
+ import 'ai-react-animations/styles.css';
16
+
17
+ function MyComponent() {
18
+ const [isLoading, setIsLoading] = useState(false);
19
+
20
+ return (
21
+ <AiCreating
22
+ isLoading={isLoading}
23
+ size="md"
24
+ onComplete={() => console.log('Done!')}
25
+ />
26
+ );
27
+ }
28
+ ```
29
+
30
+ ## Props
31
+
32
+ | Prop | Type | Default | Description |
33
+ |------|------|---------|-------------|
34
+ | `isLoading` | `boolean` | required | Controls the animation state |
35
+ | `size` | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'full'` | `'md'` | Size of the animation |
36
+ | `onComplete` | `() => void` | - | Callback when animation completes |
37
+
38
+ ## Sizes
39
+
40
+ - `xs` - 100px height (for buttons)
41
+ - `sm` - 160px height (for small cards)
42
+ - `md` - 240px height (default)
43
+ - `lg` - 340px height (for large displays)
44
+ - `full` - 100% height (fills container)
45
+
46
+ ## Animation Stages
47
+
48
+ The component shows 4 stages when `isLoading={true}`:
49
+
50
+ 1. **Reading** - Robot reads the request
51
+ 2. **Processing** - Gears spin, sparkles appear
52
+ 3. **Delivering** - Result card slides in
53
+ 4. **Complete** - Success state with green checkmark
54
+
55
+ ## Features
56
+
57
+ - Pure CSS animations (no external dependencies)
58
+ - Responsive design
59
+ - Accessibility support (prefers-reduced-motion)
60
+ - TypeScript support
61
+ - Works with React 17+
62
+
63
+ ## Example with API Call
64
+
65
+ ```tsx
66
+ const [loading, setLoading] = useState(false);
67
+
68
+ async function handleSubmit() {
69
+ setLoading(true);
70
+ await fetch('/api/generate');
71
+ setLoading(false); // Triggers completion animation
72
+ }
73
+
74
+ return (
75
+ <div>
76
+ <button onClick={handleSubmit}>Generate</button>
77
+ <AiCreating isLoading={loading} />
78
+ </div>
79
+ );
80
+ ```
81
+
82
+ ## License
83
+
84
+ MIT
@@ -0,0 +1,10 @@
1
+ import { FC } from 'react';
2
+
3
+ export interface AiCreatingProps {
4
+ isLoading: boolean;
5
+ onComplete?: () => void;
6
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'full';
7
+ }
8
+
9
+ declare const AiCreating: FC<AiCreatingProps>;
10
+ export default AiCreating;
package/dist/index.js ADDED
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const { useEffect, useState } = require('react');
4
+
5
+ /**
6
+ * AiCreating - AI Assistant Processing Animation
7
+ * Shows AI helping user with their tasks/requests
8
+ * Relatable user scenario: AI reading, processing, delivering results
9
+ */
10
+
11
+
12
+
13
+
14
+ // CSS must be imported separately: import 'ai-react-animations/styles.css'
15
+
16
+ interface AiCreatingProps {
17
+ isLoading: boolean;
18
+ onComplete?: () => void;
19
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'full';
20
+ }
21
+
22
+ function AiCreating({
23
+ isLoading,
24
+ onComplete,
25
+ size = 'md'
26
+ }: AiCreatingProps) {
27
+ const [stage, setStage] = useState<'idle' | 'reading' | 'processing' | 'delivering' | 'complete'>('idle');
28
+
29
+ useEffect(() => {
30
+ if (isLoading) {
31
+ setStage('reading');
32
+ const t1 = setTimeout(() => setStage('processing'), 1800);
33
+ const t2 = setTimeout(() => setStage('delivering'), 3600);
34
+ return () => { clearTimeout(t1); clearTimeout(t2); };
35
+ } else if (stage !== 'idle' && stage !== 'reading') {
36
+ setStage('complete');
37
+ const t = setTimeout(() => {
38
+ onComplete?.();
39
+ setStage('idle');
40
+ }, 1200);
41
+ return () => clearTimeout(t);
42
+ }
43
+ }, [isLoading]);
44
+
45
+ const stageText = {
46
+ idle: '',
47
+ reading: 'Reading your request',
48
+ processing: 'Working on it',
49
+ delivering: 'Almost there',
50
+ complete: 'Done!'
51
+ };
52
+
53
+ return (
54
+ <div className={`ai-creating-wrapper size-${size}`}>
55
+ <div className={`ai-creating-container stage-${stage}`}>
56
+
57
+ {/* Animated Background Particles */}
58
+ <div className="particles">
59
+ <span></span><span></span><span></span>
60
+ <span></span><span></span><span></span>
61
+ </div>
62
+
63
+ {/* Main Content */}
64
+ <div className="ai-scene">
65
+
66
+ {/* AI Robot Character */}
67
+ <div className={`ai-robot ${stage}`}>
68
+ <div className="robot-head">
69
+ <div className="robot-face">
70
+ <div className="robot-eyes">
71
+ <div className="eye left">
72
+ <div className="pupil"></div>
73
+ </div>
74
+ <div className="eye right">
75
+ <div className="pupil"></div>
76
+ </div>
77
+ </div>
78
+ <div className="robot-mouth"></div>
79
+ </div>
80
+ <div className="antenna">
81
+ <div className="antenna-ball"></div>
82
+ </div>
83
+ </div>
84
+ <div className="robot-body">
85
+ <div className="chest-light"></div>
86
+ </div>
87
+ </div>
88
+
89
+ {/* User Request Card - Reading Stage */}
90
+ {(stage === 'reading' || stage === 'processing') && (
91
+ <div className={`request-card ${stage}`}>
92
+ <div className="card-icon">📝</div>
93
+ <div className="card-lines">
94
+ <span className="line"></span>
95
+ <span className="line short"></span>
96
+ </div>
97
+ </div>
98
+ )}
99
+
100
+ {/* Processing Gears - Processing Stage */}
101
+ {stage === 'processing' && (
102
+ <div className="processing-visual">
103
+ <div className="gear gear-1">⚙️</div>
104
+ <div className="gear gear-2">⚙️</div>
105
+ <div className="sparkles">
106
+ <span>✨</span><span>✨</span><span>✨</span>
107
+ </div>
108
+ </div>
109
+ )}
110
+
111
+ {/* Result Card - Delivering Stage */}
112
+ {(stage === 'delivering' || stage === 'complete') && (
113
+ <div className={`result-card ${stage}`}>
114
+ <div className="result-icon">{stage === 'complete' ? '✅' : '📄'}</div>
115
+ <div className="result-lines">
116
+ <span className="line"></span>
117
+ <span className="line"></span>
118
+ <span className="line short"></span>
119
+ </div>
120
+ </div>
121
+ )}
122
+
123
+ {/* Status Text */}
124
+ {stage !== 'idle' && (
125
+ <div className="status-area">
126
+ <span className={`status-text ${stage}`}>{stageText[stage]}</span>
127
+ {stage !== 'complete' && (
128
+ <span className="dots">
129
+ <span>.</span><span>.</span><span>.</span>
130
+ </span>
131
+ )}
132
+ </div>
133
+ )}
134
+
135
+ {/* Progress Indicator */}
136
+ <div className="progress-track">
137
+ <div className={`progress-bar stage-${stage}`}></div>
138
+ <div className="progress-steps">
139
+ <div className={`step ${stage !== 'idle' ? 'active' : ''}`}></div>
140
+ <div className={`step ${stage === 'processing' || stage === 'delivering' || stage === 'complete' ? 'active' : ''}`}></div>
141
+ <div className={`step ${stage === 'delivering' || stage === 'complete' ? 'active' : ''}`}></div>
142
+ <div className={`step ${stage === 'complete' ? 'active' : ''}`}></div>
143
+ </div>
144
+ </div>
145
+
146
+ </div>
147
+ </div>
148
+ </div>
149
+ );
150
+ }
151
+
152
+
153
+ module.exports = AiCreating;
154
+ module.exports.default = AiCreating;
package/dist/index.mjs ADDED
@@ -0,0 +1,147 @@
1
+ /**
2
+ * AiCreating - AI Assistant Processing Animation
3
+ * Shows AI helping user with their tasks/requests
4
+ * Relatable user scenario: AI reading, processing, delivering results
5
+ */
6
+
7
+ 'use client';
8
+
9
+ import { useEffect, useState } from 'react';
10
+ // CSS must be imported separately: import 'ai-react-animations/styles.css'
11
+
12
+ export interface AiCreatingProps {
13
+ isLoading: boolean;
14
+ onComplete?: () => void;
15
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'full';
16
+ }
17
+
18
+ export default function AiCreating({
19
+ isLoading,
20
+ onComplete,
21
+ size = 'md'
22
+ }: AiCreatingProps) {
23
+ const [stage, setStage] = useState<'idle' | 'reading' | 'processing' | 'delivering' | 'complete'>('idle');
24
+
25
+ useEffect(() => {
26
+ if (isLoading) {
27
+ setStage('reading');
28
+ const t1 = setTimeout(() => setStage('processing'), 1800);
29
+ const t2 = setTimeout(() => setStage('delivering'), 3600);
30
+ return () => { clearTimeout(t1); clearTimeout(t2); };
31
+ } else if (stage !== 'idle' && stage !== 'reading') {
32
+ setStage('complete');
33
+ const t = setTimeout(() => {
34
+ onComplete?.();
35
+ setStage('idle');
36
+ }, 1200);
37
+ return () => clearTimeout(t);
38
+ }
39
+ }, [isLoading]);
40
+
41
+ const stageText = {
42
+ idle: '',
43
+ reading: 'Reading your request',
44
+ processing: 'Working on it',
45
+ delivering: 'Almost there',
46
+ complete: 'Done!'
47
+ };
48
+
49
+ return (
50
+ <div className={`ai-creating-wrapper size-${size}`}>
51
+ <div className={`ai-creating-container stage-${stage}`}>
52
+
53
+ {/* Animated Background Particles */}
54
+ <div className="particles">
55
+ <span></span><span></span><span></span>
56
+ <span></span><span></span><span></span>
57
+ </div>
58
+
59
+ {/* Main Content */}
60
+ <div className="ai-scene">
61
+
62
+ {/* AI Robot Character */}
63
+ <div className={`ai-robot ${stage}`}>
64
+ <div className="robot-head">
65
+ <div className="robot-face">
66
+ <div className="robot-eyes">
67
+ <div className="eye left">
68
+ <div className="pupil"></div>
69
+ </div>
70
+ <div className="eye right">
71
+ <div className="pupil"></div>
72
+ </div>
73
+ </div>
74
+ <div className="robot-mouth"></div>
75
+ </div>
76
+ <div className="antenna">
77
+ <div className="antenna-ball"></div>
78
+ </div>
79
+ </div>
80
+ <div className="robot-body">
81
+ <div className="chest-light"></div>
82
+ </div>
83
+ </div>
84
+
85
+ {/* User Request Card - Reading Stage */}
86
+ {(stage === 'reading' || stage === 'processing') && (
87
+ <div className={`request-card ${stage}`}>
88
+ <div className="card-icon">📝</div>
89
+ <div className="card-lines">
90
+ <span className="line"></span>
91
+ <span className="line short"></span>
92
+ </div>
93
+ </div>
94
+ )}
95
+
96
+ {/* Processing Gears - Processing Stage */}
97
+ {stage === 'processing' && (
98
+ <div className="processing-visual">
99
+ <div className="gear gear-1">⚙️</div>
100
+ <div className="gear gear-2">⚙️</div>
101
+ <div className="sparkles">
102
+ <span>✨</span><span>✨</span><span>✨</span>
103
+ </div>
104
+ </div>
105
+ )}
106
+
107
+ {/* Result Card - Delivering Stage */}
108
+ {(stage === 'delivering' || stage === 'complete') && (
109
+ <div className={`result-card ${stage}`}>
110
+ <div className="result-icon">{stage === 'complete' ? '✅' : '📄'}</div>
111
+ <div className="result-lines">
112
+ <span className="line"></span>
113
+ <span className="line"></span>
114
+ <span className="line short"></span>
115
+ </div>
116
+ </div>
117
+ )}
118
+
119
+ {/* Status Text */}
120
+ {stage !== 'idle' && (
121
+ <div className="status-area">
122
+ <span className={`status-text ${stage}`}>{stageText[stage]}</span>
123
+ {stage !== 'complete' && (
124
+ <span className="dots">
125
+ <span>.</span><span>.</span><span>.</span>
126
+ </span>
127
+ )}
128
+ </div>
129
+ )}
130
+
131
+ {/* Progress Indicator */}
132
+ <div className="progress-track">
133
+ <div className={`progress-bar stage-${stage}`}></div>
134
+ <div className="progress-steps">
135
+ <div className={`step ${stage !== 'idle' ? 'active' : ''}`}></div>
136
+ <div className={`step ${stage === 'processing' || stage === 'delivering' || stage === 'complete' ? 'active' : ''}`}></div>
137
+ <div className={`step ${stage === 'delivering' || stage === 'complete' ? 'active' : ''}`}></div>
138
+ <div className={`step ${stage === 'complete' ? 'active' : ''}`}></div>
139
+ </div>
140
+ </div>
141
+
142
+ </div>
143
+ </div>
144
+ </div>
145
+ );
146
+ }
147
+
@@ -0,0 +1,638 @@
1
+ /**
2
+ * AiCreating - AI Assistant Animation Styles
3
+ * Friendly, user-focused design showing AI processing requests
4
+ */
5
+
6
+ /* ============================================
7
+ SIZE VARIANTS
8
+ ============================================ */
9
+ .ai-creating-wrapper {
10
+ width: 100%;
11
+ height: 100%;
12
+ display: inline-block;
13
+ }
14
+
15
+ .ai-creating-wrapper.size-xs .ai-creating-container { height: 100px; }
16
+ .ai-creating-wrapper.size-sm .ai-creating-container { height: 160px; }
17
+ .ai-creating-wrapper.size-md .ai-creating-container { height: 240px; }
18
+ .ai-creating-wrapper.size-lg .ai-creating-container { height: 340px; }
19
+ .ai-creating-wrapper.size-full .ai-creating-container { height: 100%; min-height: 240px; }
20
+
21
+ /* ============================================
22
+ CONTAINER
23
+ ============================================ */
24
+ .ai-creating-container {
25
+ width: 100%;
26
+ height: 240px;
27
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
28
+ border-radius: 20px;
29
+ position: relative;
30
+ overflow: hidden;
31
+ transition: all 0.5s ease;
32
+ }
33
+
34
+ .ai-creating-container.stage-reading {
35
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
36
+ }
37
+
38
+ .ai-creating-container.stage-processing {
39
+ background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
40
+ }
41
+
42
+ .ai-creating-container.stage-delivering {
43
+ background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
44
+ }
45
+
46
+ .ai-creating-container.stage-complete {
47
+ background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
48
+ }
49
+
50
+ .ai-scene {
51
+ position: relative;
52
+ width: 100%;
53
+ height: 100%;
54
+ display: flex;
55
+ align-items: center;
56
+ justify-content: center;
57
+ }
58
+
59
+ /* ============================================
60
+ BACKGROUND PARTICLES
61
+ ============================================ */
62
+ .particles {
63
+ position: absolute;
64
+ inset: 0;
65
+ overflow: hidden;
66
+ pointer-events: none;
67
+ }
68
+
69
+ .particles span {
70
+ position: absolute;
71
+ width: 10px;
72
+ height: 10px;
73
+ background: rgba(255,255,255,0.3);
74
+ border-radius: 50%;
75
+ animation: float 4s ease-in-out infinite;
76
+ }
77
+
78
+ .particles span:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; }
79
+ .particles span:nth-child(2) { left: 20%; top: 60%; animation-delay: 0.5s; width: 8px; height: 8px; }
80
+ .particles span:nth-child(3) { left: 70%; top: 30%; animation-delay: 1s; width: 12px; height: 12px; }
81
+ .particles span:nth-child(4) { left: 80%; top: 70%; animation-delay: 1.5s; width: 6px; height: 6px; }
82
+ .particles span:nth-child(5) { left: 50%; top: 10%; animation-delay: 2s; }
83
+ .particles span:nth-child(6) { left: 90%; top: 50%; animation-delay: 2.5s; width: 8px; height: 8px; }
84
+
85
+ @keyframes float {
86
+ 0%, 100% { transform: translateY(0) scale(1); opacity: 0.3; }
87
+ 50% { transform: translateY(-20px) scale(1.2); opacity: 0.6; }
88
+ }
89
+
90
+ /* ============================================
91
+ AI ROBOT CHARACTER
92
+ ============================================ */
93
+ .ai-robot {
94
+ position: absolute;
95
+ left: 50%;
96
+ top: 50%;
97
+ transform: translate(-50%, -60%);
98
+ transition: all 0.5s ease;
99
+ }
100
+
101
+ .size-xs .ai-robot { transform: translate(-50%, -60%) scale(0.5); }
102
+ .size-sm .ai-robot { transform: translate(-50%, -60%) scale(0.7); }
103
+ .size-lg .ai-robot { transform: translate(-50%, -60%) scale(1.2); }
104
+
105
+ .ai-robot.reading { animation: robotBob 1s ease-in-out infinite; }
106
+ .ai-robot.processing { animation: robotWork 0.5s ease-in-out infinite; }
107
+ .ai-robot.delivering { animation: robotHappy 0.8s ease-in-out infinite; }
108
+ .ai-robot.complete { animation: robotCelebrate 0.6s ease-out forwards; }
109
+
110
+ @keyframes robotBob {
111
+ 0%, 100% { transform: translate(-50%, -60%) rotate(0); }
112
+ 50% { transform: translate(-50%, -63%) rotate(-3deg); }
113
+ }
114
+
115
+ @keyframes robotWork {
116
+ 0%, 100% { transform: translate(-50%, -60%) scale(1); }
117
+ 50% { transform: translate(-50%, -60%) scale(1.05); }
118
+ }
119
+
120
+ @keyframes robotHappy {
121
+ 0%, 100% { transform: translate(-50%, -60%); }
122
+ 25% { transform: translate(-50%, -63%) rotate(-5deg); }
123
+ 75% { transform: translate(-50%, -63%) rotate(5deg); }
124
+ }
125
+
126
+ @keyframes robotCelebrate {
127
+ 0% { transform: translate(-50%, -60%) scale(1); }
128
+ 50% { transform: translate(-50%, -70%) scale(1.15); }
129
+ 100% { transform: translate(-50%, -60%) scale(1); }
130
+ }
131
+
132
+ /* Robot Head */
133
+ .robot-head {
134
+ width: 70px;
135
+ height: 60px;
136
+ background: linear-gradient(180deg, #e8e8e8, #c0c0c0);
137
+ border-radius: 15px;
138
+ position: relative;
139
+ box-shadow: 0 5px 15px rgba(0,0,0,0.2);
140
+ }
141
+
142
+ .robot-face {
143
+ position: absolute;
144
+ inset: 8px;
145
+ background: #1a1a2e;
146
+ border-radius: 10px;
147
+ display: flex;
148
+ flex-direction: column;
149
+ align-items: center;
150
+ justify-content: center;
151
+ gap: 8px;
152
+ }
153
+
154
+ /* Robot Eyes */
155
+ .robot-eyes {
156
+ display: flex;
157
+ gap: 12px;
158
+ }
159
+
160
+ .eye {
161
+ width: 16px;
162
+ height: 16px;
163
+ background: #00d4ff;
164
+ border-radius: 50%;
165
+ display: flex;
166
+ align-items: center;
167
+ justify-content: center;
168
+ box-shadow: 0 0 10px #00d4ff;
169
+ animation: eyeGlow 2s ease-in-out infinite;
170
+ }
171
+
172
+ .ai-robot.processing .eye {
173
+ background: #ff6b6b;
174
+ box-shadow: 0 0 10px #ff6b6b;
175
+ }
176
+
177
+ .ai-robot.complete .eye {
178
+ background: #51cf66;
179
+ box-shadow: 0 0 10px #51cf66;
180
+ }
181
+
182
+ @keyframes eyeGlow {
183
+ 0%, 100% { box-shadow: 0 0 10px currentColor; }
184
+ 50% { box-shadow: 0 0 20px currentColor, 0 0 30px currentColor; }
185
+ }
186
+
187
+ .pupil {
188
+ width: 6px;
189
+ height: 6px;
190
+ background: #fff;
191
+ border-radius: 50%;
192
+ animation: look 3s ease-in-out infinite;
193
+ }
194
+
195
+ @keyframes look {
196
+ 0%, 100% { transform: translateX(0); }
197
+ 25% { transform: translateX(-3px); }
198
+ 75% { transform: translateX(3px); }
199
+ }
200
+
201
+ /* Robot Mouth */
202
+ .robot-mouth {
203
+ width: 20px;
204
+ height: 4px;
205
+ background: #00d4ff;
206
+ border-radius: 2px;
207
+ transition: all 0.3s ease;
208
+ }
209
+
210
+ .ai-robot.processing .robot-mouth {
211
+ width: 15px;
212
+ height: 15px;
213
+ border-radius: 50%;
214
+ background: transparent;
215
+ border: 3px solid #ff6b6b;
216
+ animation: mouthSpin 1s linear infinite;
217
+ }
218
+
219
+ .ai-robot.complete .robot-mouth {
220
+ width: 24px;
221
+ height: 12px;
222
+ border-radius: 0 0 12px 12px;
223
+ background: #51cf66;
224
+ }
225
+
226
+ @keyframes mouthSpin {
227
+ from { transform: rotate(0); }
228
+ to { transform: rotate(360deg); }
229
+ }
230
+
231
+ /* Antenna */
232
+ .antenna {
233
+ position: absolute;
234
+ top: -15px;
235
+ left: 50%;
236
+ transform: translateX(-50%);
237
+ width: 4px;
238
+ height: 15px;
239
+ background: #888;
240
+ }
241
+
242
+ .antenna-ball {
243
+ position: absolute;
244
+ top: -8px;
245
+ left: 50%;
246
+ transform: translateX(-50%);
247
+ width: 12px;
248
+ height: 12px;
249
+ background: #ff6b6b;
250
+ border-radius: 50%;
251
+ animation: antennaPulse 1s ease-in-out infinite;
252
+ }
253
+
254
+ .ai-robot.complete .antenna-ball {
255
+ background: #51cf66;
256
+ }
257
+
258
+ @keyframes antennaPulse {
259
+ 0%, 100% { transform: translateX(-50%) scale(1); box-shadow: 0 0 5px currentColor; }
260
+ 50% { transform: translateX(-50%) scale(1.2); box-shadow: 0 0 15px currentColor; }
261
+ }
262
+
263
+ /* Robot Body */
264
+ .robot-body {
265
+ width: 50px;
266
+ height: 35px;
267
+ background: linear-gradient(180deg, #c0c0c0, #909090);
268
+ border-radius: 0 0 10px 10px;
269
+ margin: 0 auto;
270
+ position: relative;
271
+ box-shadow: 0 5px 10px rgba(0,0,0,0.2);
272
+ }
273
+
274
+ .chest-light {
275
+ position: absolute;
276
+ top: 50%;
277
+ left: 50%;
278
+ transform: translate(-50%, -50%);
279
+ width: 12px;
280
+ height: 12px;
281
+ background: #00d4ff;
282
+ border-radius: 50%;
283
+ animation: chestPulse 1.5s ease-in-out infinite;
284
+ }
285
+
286
+ .ai-robot.processing .chest-light {
287
+ background: #ff6b6b;
288
+ animation: chestFast 0.3s ease-in-out infinite;
289
+ }
290
+
291
+ .ai-robot.complete .chest-light {
292
+ background: #51cf66;
293
+ }
294
+
295
+ @keyframes chestPulse {
296
+ 0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
297
+ 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
298
+ }
299
+
300
+ @keyframes chestFast {
301
+ 0%, 100% { opacity: 0.5; }
302
+ 50% { opacity: 1; }
303
+ }
304
+
305
+ /* ============================================
306
+ REQUEST CARD
307
+ ============================================ */
308
+ .request-card {
309
+ position: absolute;
310
+ left: 15%;
311
+ top: 25%;
312
+ width: 60px;
313
+ background: white;
314
+ border-radius: 8px;
315
+ padding: 10px;
316
+ box-shadow: 0 5px 20px rgba(0,0,0,0.2);
317
+ animation: cardFloat 0.5s ease-out, cardHover 2s ease-in-out infinite 0.5s;
318
+ }
319
+
320
+ .size-xs .request-card { width: 40px; padding: 6px; left: 10%; }
321
+ .size-sm .request-card { width: 50px; padding: 8px; }
322
+ .size-lg .request-card { width: 80px; padding: 14px; }
323
+
324
+ .request-card.processing {
325
+ animation: cardToRobot 0.8s ease-in-out forwards;
326
+ }
327
+
328
+ @keyframes cardFloat {
329
+ from { opacity: 0; transform: translateY(-20px) scale(0.8); }
330
+ to { opacity: 1; transform: translateY(0) scale(1); }
331
+ }
332
+
333
+ @keyframes cardHover {
334
+ 0%, 100% { transform: translateY(0); }
335
+ 50% { transform: translateY(-5px); }
336
+ }
337
+
338
+ @keyframes cardToRobot {
339
+ to { transform: translateX(80px) scale(0.5); opacity: 0; }
340
+ }
341
+
342
+ .card-icon {
343
+ font-size: 20px;
344
+ text-align: center;
345
+ margin-bottom: 6px;
346
+ }
347
+
348
+ .size-xs .card-icon { font-size: 14px; }
349
+ .size-lg .card-icon { font-size: 26px; }
350
+
351
+ .card-lines .line {
352
+ display: block;
353
+ height: 4px;
354
+ background: #e0e0e0;
355
+ border-radius: 2px;
356
+ margin-bottom: 4px;
357
+ animation: lineLoad 0.6s ease-out forwards;
358
+ }
359
+
360
+ .card-lines .line.short { width: 60%; }
361
+
362
+ @keyframes lineLoad {
363
+ from { width: 0; }
364
+ to { width: 100%; }
365
+ }
366
+
367
+ .card-lines .line.short {
368
+ animation: lineLoadShort 0.6s ease-out forwards;
369
+ }
370
+
371
+ @keyframes lineLoadShort {
372
+ from { width: 0; }
373
+ to { width: 60%; }
374
+ }
375
+
376
+ /* ============================================
377
+ PROCESSING VISUAL
378
+ ============================================ */
379
+ .processing-visual {
380
+ position: absolute;
381
+ top: 20%;
382
+ left: 50%;
383
+ transform: translateX(-50%);
384
+ }
385
+
386
+ .gear {
387
+ position: absolute;
388
+ font-size: 24px;
389
+ animation: spin 2s linear infinite;
390
+ }
391
+
392
+ .size-xs .gear { font-size: 16px; }
393
+ .size-lg .gear { font-size: 32px; }
394
+
395
+ .gear-1 { left: -30px; top: 0; }
396
+ .gear-2 { left: 10px; top: 5px; animation-direction: reverse; font-size: 18px; }
397
+
398
+ @keyframes spin {
399
+ from { transform: rotate(0); }
400
+ to { transform: rotate(360deg); }
401
+ }
402
+
403
+ .sparkles {
404
+ position: absolute;
405
+ top: -20px;
406
+ left: -20px;
407
+ width: 80px;
408
+ display: flex;
409
+ justify-content: space-around;
410
+ }
411
+
412
+ .sparkles span {
413
+ animation: sparkle 0.8s ease-in-out infinite;
414
+ font-size: 14px;
415
+ }
416
+
417
+ .sparkles span:nth-child(1) { animation-delay: 0s; }
418
+ .sparkles span:nth-child(2) { animation-delay: 0.2s; }
419
+ .sparkles span:nth-child(3) { animation-delay: 0.4s; }
420
+
421
+ @keyframes sparkle {
422
+ 0%, 100% { opacity: 0; transform: scale(0) translateY(0); }
423
+ 50% { opacity: 1; transform: scale(1) translateY(-10px); }
424
+ }
425
+
426
+ /* ============================================
427
+ RESULT CARD
428
+ ============================================ */
429
+ .result-card {
430
+ position: absolute;
431
+ right: 15%;
432
+ top: 25%;
433
+ width: 70px;
434
+ background: white;
435
+ border-radius: 8px;
436
+ padding: 10px;
437
+ box-shadow: 0 5px 20px rgba(0,0,0,0.2);
438
+ animation: resultAppear 0.5s ease-out;
439
+ }
440
+
441
+ .size-xs .result-card { width: 45px; padding: 6px; right: 10%; }
442
+ .size-sm .result-card { width: 55px; padding: 8px; }
443
+ .size-lg .result-card { width: 90px; padding: 14px; }
444
+
445
+ .result-card.complete {
446
+ box-shadow: 0 5px 25px rgba(81, 207, 102, 0.4);
447
+ animation: resultSuccess 0.5s ease-out;
448
+ }
449
+
450
+ @keyframes resultAppear {
451
+ from { opacity: 0; transform: translateX(20px) scale(0.8); }
452
+ to { opacity: 1; transform: translateX(0) scale(1); }
453
+ }
454
+
455
+ @keyframes resultSuccess {
456
+ 0% { transform: scale(1); }
457
+ 50% { transform: scale(1.1); }
458
+ 100% { transform: scale(1); }
459
+ }
460
+
461
+ .result-icon {
462
+ font-size: 22px;
463
+ text-align: center;
464
+ margin-bottom: 6px;
465
+ }
466
+
467
+ .size-xs .result-icon { font-size: 14px; }
468
+ .size-lg .result-icon { font-size: 28px; }
469
+
470
+ .result-lines .line {
471
+ display: block;
472
+ height: 4px;
473
+ background: linear-gradient(90deg, #667eea, #764ba2);
474
+ border-radius: 2px;
475
+ margin-bottom: 4px;
476
+ animation: resultLine 0.4s ease-out forwards;
477
+ opacity: 0;
478
+ }
479
+
480
+ .result-lines .line:nth-child(1) { animation-delay: 0.1s; }
481
+ .result-lines .line:nth-child(2) { animation-delay: 0.2s; }
482
+ .result-lines .line:nth-child(3) { animation-delay: 0.3s; }
483
+
484
+ .result-card.complete .result-lines .line {
485
+ background: linear-gradient(90deg, #43e97b, #38f9d7);
486
+ }
487
+
488
+ @keyframes resultLine {
489
+ from { width: 0; opacity: 0; }
490
+ to { width: 100%; opacity: 1; }
491
+ }
492
+
493
+ .result-lines .line.short {
494
+ animation: resultLineShort 0.4s ease-out forwards;
495
+ }
496
+
497
+ @keyframes resultLineShort {
498
+ from { width: 0; opacity: 0; }
499
+ to { width: 70%; opacity: 1; }
500
+ }
501
+
502
+ /* ============================================
503
+ STATUS TEXT
504
+ ============================================ */
505
+ .status-area {
506
+ position: absolute;
507
+ bottom: 45px;
508
+ left: 50%;
509
+ transform: translateX(-50%);
510
+ display: flex;
511
+ align-items: center;
512
+ white-space: nowrap;
513
+ }
514
+
515
+ .status-text {
516
+ font-size: 14px;
517
+ font-weight: 600;
518
+ color: white;
519
+ text-shadow: 0 2px 4px rgba(0,0,0,0.2);
520
+ }
521
+
522
+ .size-xs .status-text { font-size: 10px; }
523
+ .size-sm .status-text { font-size: 12px; }
524
+ .size-lg .status-text { font-size: 16px; }
525
+
526
+ .status-text.complete {
527
+ animation: textPop 0.4s ease-out;
528
+ }
529
+
530
+ @keyframes textPop {
531
+ 0% { transform: scale(1); }
532
+ 50% { transform: scale(1.2); }
533
+ 100% { transform: scale(1); }
534
+ }
535
+
536
+ .dots {
537
+ display: flex;
538
+ margin-left: 2px;
539
+ }
540
+
541
+ .dots span {
542
+ animation: dotBlink 1.4s ease-in-out infinite;
543
+ font-size: inherit;
544
+ color: white;
545
+ }
546
+
547
+ .dots span:nth-child(1) { animation-delay: 0s; }
548
+ .dots span:nth-child(2) { animation-delay: 0.2s; }
549
+ .dots span:nth-child(3) { animation-delay: 0.4s; }
550
+
551
+ @keyframes dotBlink {
552
+ 0%, 60%, 100% { opacity: 0; }
553
+ 30% { opacity: 1; }
554
+ }
555
+
556
+ /* ============================================
557
+ PROGRESS TRACK
558
+ ============================================ */
559
+ .progress-track {
560
+ position: absolute;
561
+ bottom: 15px;
562
+ left: 20px;
563
+ right: 20px;
564
+ height: 6px;
565
+ background: rgba(255,255,255,0.2);
566
+ border-radius: 3px;
567
+ overflow: visible;
568
+ }
569
+
570
+ .size-xs .progress-track { bottom: 10px; left: 10px; right: 10px; height: 4px; }
571
+ .size-lg .progress-track { bottom: 20px; height: 8px; }
572
+
573
+ .progress-bar {
574
+ height: 100%;
575
+ background: white;
576
+ border-radius: 3px;
577
+ transition: width 0.5s ease;
578
+ box-shadow: 0 0 10px rgba(255,255,255,0.5);
579
+ }
580
+
581
+ .progress-bar.stage-idle { width: 0; }
582
+ .progress-bar.stage-reading { width: 25%; animation: progressPulse 1s ease-in-out infinite; }
583
+ .progress-bar.stage-processing { width: 50%; animation: progressPulse 0.5s ease-in-out infinite; }
584
+ .progress-bar.stage-delivering { width: 75%; animation: progressPulse 1s ease-in-out infinite; }
585
+ .progress-bar.stage-complete { width: 100%; animation: none; }
586
+
587
+ @keyframes progressPulse {
588
+ 0%, 100% { opacity: 1; }
589
+ 50% { opacity: 0.7; }
590
+ }
591
+
592
+ .progress-steps {
593
+ position: absolute;
594
+ top: 50%;
595
+ left: 0;
596
+ right: 0;
597
+ transform: translateY(-50%);
598
+ display: flex;
599
+ justify-content: space-between;
600
+ padding: 0 2px;
601
+ }
602
+
603
+ .step {
604
+ width: 10px;
605
+ height: 10px;
606
+ background: rgba(255,255,255,0.3);
607
+ border-radius: 50%;
608
+ transition: all 0.3s ease;
609
+ }
610
+
611
+ .size-xs .step { width: 6px; height: 6px; }
612
+ .size-lg .step { width: 12px; height: 12px; }
613
+
614
+ .step.active {
615
+ background: white;
616
+ box-shadow: 0 0 10px white;
617
+ transform: scale(1.2);
618
+ }
619
+
620
+ /* ============================================
621
+ RESPONSIVE
622
+ ============================================ */
623
+ @media (max-width: 640px) {
624
+ .request-card { left: 8%; }
625
+ .result-card { right: 8%; }
626
+ .status-text { font-size: 12px; }
627
+ }
628
+
629
+ /* ============================================
630
+ ACCESSIBILITY
631
+ ============================================ */
632
+ @media (prefers-reduced-motion: reduce) {
633
+ *, *::before, *::after {
634
+ animation-duration: 0.01ms !important;
635
+ animation-iteration-count: 1 !important;
636
+ transition-duration: 0.01ms !important;
637
+ }
638
+ }
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "ai-react-animations",
3
+ "version": "1.0.0",
4
+ "description": "Beautiful AI loading animation components for React/Next.js. Shows AI processing states with friendly robot character.",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.mjs",
11
+ "require": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ },
14
+ "./styles.css": "./dist/styles.css"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md",
19
+ "LICENSE"
20
+ ],
21
+ "scripts": {
22
+ "dev": "next dev",
23
+ "build": "next build",
24
+ "start": "next start",
25
+ "build:lib": "node scripts/build.js",
26
+ "prepublishOnly": "npm run build:lib"
27
+ },
28
+ "keywords": [
29
+ "react",
30
+ "nextjs",
31
+ "animation",
32
+ "ai",
33
+ "loading",
34
+ "spinner",
35
+ "typescript",
36
+ "components"
37
+ ],
38
+ "author": "johnbekele",
39
+ "license": "MIT",
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "https://github.com/johnbekele/ai-react-animations"
43
+ },
44
+ "peerDependencies": {
45
+ "react": ">=17.0.0",
46
+ "react-dom": ">=17.0.0"
47
+ },
48
+ "devDependencies": {
49
+ "@types/node": "^20.11.0",
50
+ "@types/react": "^18.2.48",
51
+ "@types/react-dom": "^18.2.18",
52
+ "typescript": "^5.3.3",
53
+ "tailwindcss": "^3.4.1",
54
+ "postcss": "^8.4.33",
55
+ "autoprefixer": "^10.4.17",
56
+ "eslint": "^8.56.0",
57
+ "eslint-config-next": "^14.2.0",
58
+ "next": "^14.2.0",
59
+ "react": "^18.3.1",
60
+ "react-dom": "^18.3.1"
61
+ }
62
+ }