@umituz/react-native-mascot 1.0.1
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 +21 -0
- package/README.md +370 -0
- package/package.json +89 -0
- package/skills/SKILL.md +188 -0
- package/src/assets/index.ts +104 -0
- package/src/domain/entities/Mascot.ts +216 -0
- package/src/domain/interfaces/IAnimationController.ts +78 -0
- package/src/domain/interfaces/IAssetManager.ts +51 -0
- package/src/domain/interfaces/IMascotRepository.ts +39 -0
- package/src/domain/types/MascotTypes.ts +75 -0
- package/src/index.ts +99 -0
- package/src/infrastructure/assets/lottie/dance.json +61 -0
- package/src/infrastructure/assets/lottie/error.json +48 -0
- package/src/infrastructure/assets/lottie/idle.json +49 -0
- package/src/infrastructure/assets/lottie/jump.json +48 -0
- package/src/infrastructure/assets/lottie/success.json +46 -0
- package/src/infrastructure/assets/lottie/wave.json +46 -0
- package/src/infrastructure/assets/svg/cartoon-bot.svg +20 -0
- package/src/infrastructure/assets/svg/minimal-cat.svg +19 -0
- package/src/infrastructure/controllers/AnimationController.ts +163 -0
- package/src/infrastructure/managers/AssetManager.ts +159 -0
- package/src/infrastructure/managers/MascotFactory.ts +239 -0
- package/src/infrastructure/repositories/MascotRepository.ts +93 -0
- package/src/presentation/components/MascotView.tsx +296 -0
- package/src/presentation/contexts/MascotContext.tsx +141 -0
- package/src/presentation/hooks/useMascot.ts +224 -0
- package/src/presentation/hooks/useMascotAnimation.ts +168 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ümit UZ
|
|
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,370 @@
|
|
|
1
|
+
# @umituz/react-native-mascot
|
|
2
|
+
|
|
3
|
+
Interactive mascot system for React Native apps - Customizable animated characters with Lottie and SVG support, mood system, and easy integration.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- ✅ **Pre-built Templates** - Ready-to-use mascot characters
|
|
8
|
+
- ✅ **Lottie Animations** - Professional JSON animations
|
|
9
|
+
- ✅ **SVG Rendering** - Custom vector graphics
|
|
10
|
+
- ✅ **Mood System** - Dynamic personality and emotions
|
|
11
|
+
- ✅ **Interactive** - Touch-enabled mascots
|
|
12
|
+
- ✅ **Animation Queue** - Sequence animations
|
|
13
|
+
- ✅ **Custom Accessories** - Add glasses, hats, etc.
|
|
14
|
+
- ✅ **Dynamic Colors** - Customize appearance
|
|
15
|
+
- ✅ **Type-Safe** - Full TypeScript support
|
|
16
|
+
- ✅ **DDD Architecture** - Domain-driven design
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @umituz/react-native-mascot
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Dependencies
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install lottie-react-native react-native-reanimated react-native-svg
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
### Basic Usage
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import React from 'react';
|
|
36
|
+
import { View } from 'react-native';
|
|
37
|
+
import { useMascot, MascotView } from '@umituz/react-native-mascot';
|
|
38
|
+
|
|
39
|
+
function MyApp() {
|
|
40
|
+
const mascot = useMascot({
|
|
41
|
+
template: 'friendly-bot',
|
|
42
|
+
autoInitialize: true
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<View>
|
|
47
|
+
<MascotView
|
|
48
|
+
mascot={mascot.mascot}
|
|
49
|
+
size={200}
|
|
50
|
+
onPress={() => mascot.playAnimation('wave')}
|
|
51
|
+
/>
|
|
52
|
+
</View>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Using Template
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
import { MascotFactory, MascotView } from '@umituz/react-native-mascot';
|
|
61
|
+
|
|
62
|
+
function MyScreen() {
|
|
63
|
+
const mascot = MascotFactory.createFromTemplate('cute-pet', {
|
|
64
|
+
appearance: {
|
|
65
|
+
baseColor: '#FFB6C1',
|
|
66
|
+
accentColor: '#FF69B4'
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
return <MascotView mascot={mascot} size={150} />;
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Custom Mascot
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
import { Mascot, MascotView } from '@umituz/react-native-mascot';
|
|
78
|
+
|
|
79
|
+
function CustomMascotScreen() {
|
|
80
|
+
const mascot = new Mascot({
|
|
81
|
+
id: 'my-mascot',
|
|
82
|
+
name: 'My Mascot',
|
|
83
|
+
type: 'svg',
|
|
84
|
+
personality: {
|
|
85
|
+
mood: 'happy',
|
|
86
|
+
energy: 0.8,
|
|
87
|
+
friendliness: 0.9,
|
|
88
|
+
playfulness: 0.7
|
|
89
|
+
},
|
|
90
|
+
appearance: {
|
|
91
|
+
baseColor: '#4A90E2',
|
|
92
|
+
accentColor: '#50E3C2',
|
|
93
|
+
accessories: [],
|
|
94
|
+
style: 'cartoon',
|
|
95
|
+
scale: 1
|
|
96
|
+
},
|
|
97
|
+
animations: [],
|
|
98
|
+
interactive: true,
|
|
99
|
+
touchEnabled: true
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
return <MascotView mascot={mascot} />;
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Available Templates
|
|
107
|
+
|
|
108
|
+
| Template | Style | Personality |
|
|
109
|
+
|----------|-------|-------------|
|
|
110
|
+
| `friendly-bot` | Cartoon | Happy & Friendly |
|
|
111
|
+
| `cute-pet` | Cartoon | Excited & Playful |
|
|
112
|
+
| `wise-owl` | Realistic | Thinking & Calm |
|
|
113
|
+
| `pixel-hero` | Pixel Art | Happy & Brave |
|
|
114
|
+
|
|
115
|
+
## API Reference
|
|
116
|
+
|
|
117
|
+
### useMascot Hook
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
const mascot = useMascot({
|
|
121
|
+
config?: MascotConfig,
|
|
122
|
+
template?: string,
|
|
123
|
+
autoInitialize?: boolean
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**Returns:**
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
{
|
|
131
|
+
mascot: Mascot | null,
|
|
132
|
+
isReady: boolean,
|
|
133
|
+
isPlaying: boolean,
|
|
134
|
+
currentAnimation: string | null,
|
|
135
|
+
initialize: (config: MascotConfig) => void,
|
|
136
|
+
initializeFromTemplate: (template: string) => void,
|
|
137
|
+
setMood: (mood: MascotMood) => void,
|
|
138
|
+
setEnergy: (energy: number) => void,
|
|
139
|
+
playAnimation: (animationId: string) => Promise<void>,
|
|
140
|
+
stopAnimation: () => void,
|
|
141
|
+
updateAppearance: (appearance: Partial<MascotAppearance>) => void,
|
|
142
|
+
setBaseColor: (color: string) => void,
|
|
143
|
+
setAccentColor: (color: string) => void,
|
|
144
|
+
addAccessory: (accessory) => void,
|
|
145
|
+
removeAccessory: (accessoryId: string) => void,
|
|
146
|
+
setVisible: (visible: boolean) => void,
|
|
147
|
+
setPosition: (position: { x: number, y: number }) => void
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### MascotView Component
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
<MascotView
|
|
155
|
+
mascot={mascot}
|
|
156
|
+
animation={animation}
|
|
157
|
+
size={200}
|
|
158
|
+
style={style}
|
|
159
|
+
onPress={() => {}}
|
|
160
|
+
onLongPress={() => {}}
|
|
161
|
+
onAnimationFinish={() => {}}
|
|
162
|
+
resizeMode="contain"
|
|
163
|
+
/>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### MascotFactory
|
|
167
|
+
|
|
168
|
+
```tsx
|
|
169
|
+
// Create from template
|
|
170
|
+
const mascot = MascotFactory.createFromTemplate('friendly-bot', customizations);
|
|
171
|
+
|
|
172
|
+
// Create custom
|
|
173
|
+
const mascot = MascotFactory.createCustom(config);
|
|
174
|
+
|
|
175
|
+
// Create simple
|
|
176
|
+
const mascot = MascotFactory.createSimple({
|
|
177
|
+
id: 'my-mascot',
|
|
178
|
+
name: 'My Mascot',
|
|
179
|
+
baseColor: '#FF6B6B'
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Mood System
|
|
184
|
+
|
|
185
|
+
```tsx
|
|
186
|
+
// Change mascot mood
|
|
187
|
+
mascot.setMood('excited');
|
|
188
|
+
|
|
189
|
+
// Available moods
|
|
190
|
+
type MascotMood =
|
|
191
|
+
| 'happy'
|
|
192
|
+
| 'sad'
|
|
193
|
+
| 'excited'
|
|
194
|
+
| 'thinking'
|
|
195
|
+
| 'angry'
|
|
196
|
+
| 'neutral'
|
|
197
|
+
| 'surprised';
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Animation Control
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
// Play animation
|
|
204
|
+
await mascot.playAnimation('jump');
|
|
205
|
+
|
|
206
|
+
// Built-in animations: 'idle', 'wave', 'jump', 'success', 'error', 'dance'
|
|
207
|
+
|
|
208
|
+
// Stop animation
|
|
209
|
+
mascot.stopAnimation();
|
|
210
|
+
|
|
211
|
+
// With options
|
|
212
|
+
await mascot.playAnimation('wave', {
|
|
213
|
+
speed: 1.5,
|
|
214
|
+
loop: false,
|
|
215
|
+
onStart: () => console.log('Started'),
|
|
216
|
+
onFinish: () => console.log('Finished')
|
|
217
|
+
});
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Customization
|
|
221
|
+
|
|
222
|
+
### Appearance
|
|
223
|
+
|
|
224
|
+
```tsx
|
|
225
|
+
// Update appearance
|
|
226
|
+
mascot.updateAppearance({
|
|
227
|
+
baseColor: '#FF6B6B',
|
|
228
|
+
accentColor: '#4ECDC4',
|
|
229
|
+
scale: 1.2
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
// Set colors
|
|
233
|
+
mascot.setBaseColor('#FF6B6B');
|
|
234
|
+
mascot.setAccentColor('#4ECDC4');
|
|
235
|
+
|
|
236
|
+
// Add accessories
|
|
237
|
+
mascot.addAccessory({
|
|
238
|
+
id: 'glasses',
|
|
239
|
+
type: 'glasses',
|
|
240
|
+
color: '#333',
|
|
241
|
+
position: { x: 0, y: -10 }
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
// Remove accessory
|
|
245
|
+
mascot.removeAccessory('glasses');
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Personality
|
|
249
|
+
|
|
250
|
+
```tsx
|
|
251
|
+
// Set mood
|
|
252
|
+
mascot.setMood('happy');
|
|
253
|
+
|
|
254
|
+
// Set energy (0-1)
|
|
255
|
+
mascot.setEnergy(0.9);
|
|
256
|
+
|
|
257
|
+
// Set friendliness (0-1)
|
|
258
|
+
mascot.setFriendliness(1.0);
|
|
259
|
+
|
|
260
|
+
// Set playfulness (0-1)
|
|
261
|
+
mascot.setPlayfulness(0.8);
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Context Provider
|
|
265
|
+
|
|
266
|
+
```tsx
|
|
267
|
+
import { MascotProvider, useMascotContext } from '@umituz/react-native-mascot';
|
|
268
|
+
|
|
269
|
+
function App() {
|
|
270
|
+
return (
|
|
271
|
+
<MascotProvider template="friendly-bot">
|
|
272
|
+
<MyScreen />
|
|
273
|
+
</MascotProvider>
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function MyScreen() {
|
|
278
|
+
const { mascot, playAnimation, setMood } = useMascotContext();
|
|
279
|
+
|
|
280
|
+
return (
|
|
281
|
+
<>
|
|
282
|
+
<MascotView mascot={mascot} />
|
|
283
|
+
<Button onPress={() => playAnimation('wave')} title="Wave" />
|
|
284
|
+
<Button onPress={() => setMood('excited')} title="Get Excited" />
|
|
285
|
+
</>
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Examples
|
|
291
|
+
|
|
292
|
+
### Animated Mascot Response
|
|
293
|
+
|
|
294
|
+
```tsx
|
|
295
|
+
function SuccessScreen() {
|
|
296
|
+
const mascot = useMascot({ template: 'friendly-bot' });
|
|
297
|
+
|
|
298
|
+
const handleSuccess = async () => {
|
|
299
|
+
mascot.setMood('happy');
|
|
300
|
+
await mascot.playAnimation('success');
|
|
301
|
+
await mascot.playAnimation('dance');
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
return (
|
|
305
|
+
<View>
|
|
306
|
+
<MascotView mascot={mascot.mascot} size={200} />
|
|
307
|
+
<Button onPress={handleSuccess} title="Success!" />
|
|
308
|
+
</View>
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Interactive Mascot
|
|
314
|
+
|
|
315
|
+
```tsx
|
|
316
|
+
function InteractiveMascot() {
|
|
317
|
+
const mascot = useMascot({ template: 'cute-pet' });
|
|
318
|
+
|
|
319
|
+
return (
|
|
320
|
+
<View>
|
|
321
|
+
<MascotView
|
|
322
|
+
mascot={mascot.mascot}
|
|
323
|
+
size={250}
|
|
324
|
+
onPress={() => mascot.playAnimation('jump')}
|
|
325
|
+
onLongPress={() => mascot.setMood('excited')}
|
|
326
|
+
/>
|
|
327
|
+
</View>
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### Custom Animated Mascot
|
|
333
|
+
|
|
334
|
+
```tsx
|
|
335
|
+
import { useMascotAnimation } from '@umituz/react-native-mascot';
|
|
336
|
+
|
|
337
|
+
function AnimatedMascot() {
|
|
338
|
+
const mascot = useMascot({ template: 'pixel-hero' });
|
|
339
|
+
const { play, queueAnimation, playSequence } = useMascotAnimation({
|
|
340
|
+
mascot: mascot.mascot
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
const performSequence = async () => {
|
|
344
|
+
await playSequence(['wave', 'jump', 'dance']);
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
return (
|
|
348
|
+
<View>
|
|
349
|
+
<MascotView mascot={mascot.mascot} />
|
|
350
|
+
<Button onPress={performSequence} title="Perform Sequence" />
|
|
351
|
+
</View>
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
## Architecture
|
|
357
|
+
|
|
358
|
+
This package follows **Domain-Driven Design (DDD)** principles:
|
|
359
|
+
|
|
360
|
+
- **Domain Layer**: Entities, value objects, interfaces
|
|
361
|
+
- **Infrastructure Layer**: Repositories, controllers, managers
|
|
362
|
+
- **Presentation Layer**: Components, hooks, contexts
|
|
363
|
+
|
|
364
|
+
## Contributing
|
|
365
|
+
|
|
366
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
367
|
+
|
|
368
|
+
## License
|
|
369
|
+
|
|
370
|
+
MIT © Ümit UZ
|
package/package.json
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@umituz/react-native-mascot",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Interactive mascot system for React Native apps - Customizable animated characters with Lottie and SVG support, mood system, and easy integration",
|
|
5
|
+
"main": "./src/index.ts",
|
|
6
|
+
"types": "./src/index.ts",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"react-native": "./src/index.ts",
|
|
11
|
+
"types": "./src/index.ts",
|
|
12
|
+
"default": "./src/index.ts"
|
|
13
|
+
},
|
|
14
|
+
"./assets": {
|
|
15
|
+
"react-native": "./src/assets/index.ts",
|
|
16
|
+
"types": "./src/assets/index.ts",
|
|
17
|
+
"default": "./src/assets/index.ts"
|
|
18
|
+
},
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"typecheck": "tsc --noEmit --skipLibCheck",
|
|
23
|
+
"lint": "eslint src --ext .ts,.tsx --max-warnings 0",
|
|
24
|
+
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
25
|
+
"version:patch": "npm version patch -m 'chore: release v%s'",
|
|
26
|
+
"version:minor": "npm version minor -m 'chore: release v%s'",
|
|
27
|
+
"version:major": "npm version major -m 'chore: release v%s'",
|
|
28
|
+
"setup:skill": "node -e \"const fs = require('fs'); const path = require('path'); const skillDir = path.join(process.env.HOME, '.claude', 'skills', 'react-native-mascot'); fs.mkdirSync(skillDir, {recursive: true}); fs.copyFileSync(path.join(__dirname, 'skills/SKILL.md'), path.join(skillDir, 'SKILL.md')); console.log('✅ @umituz/react-native-mascot setup skill installed to Claude Code!');\""
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"react-native",
|
|
32
|
+
"mascot",
|
|
33
|
+
"avatar",
|
|
34
|
+
"character",
|
|
35
|
+
"animation",
|
|
36
|
+
"lottie",
|
|
37
|
+
"svg",
|
|
38
|
+
"interactive",
|
|
39
|
+
"gamification",
|
|
40
|
+
"engagement",
|
|
41
|
+
"ddd",
|
|
42
|
+
"domain-driven-design",
|
|
43
|
+
"type-safe"
|
|
44
|
+
],
|
|
45
|
+
"author": "Ümit UZ <umit@umituz.com>",
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "https://github.com/umituz/react-native-mascot"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"lottie-react-native": "^7.3.4",
|
|
53
|
+
"react-native-reanimated": "^3.16.2"
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"@umituz/react-native-design-system": "*",
|
|
57
|
+
"expo": ">=54.0.0",
|
|
58
|
+
"react": ">=19.0.0",
|
|
59
|
+
"react-native": "*",
|
|
60
|
+
"react-native-svg": ">=15.0.0"
|
|
61
|
+
},
|
|
62
|
+
"peerDependenciesMeta": {
|
|
63
|
+
"@umituz/react-native-design-system": {
|
|
64
|
+
"optional": true
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@types/react": "~19.1.0",
|
|
69
|
+
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
70
|
+
"@typescript-eslint/parser": "^7.0.0",
|
|
71
|
+
"eslint": "^8.57.0",
|
|
72
|
+
"eslint-plugin-react": "^7.37.5",
|
|
73
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
74
|
+
"eslint-plugin-react-native": "^5.0.0",
|
|
75
|
+
"react": "19.1.0",
|
|
76
|
+
"react-native": "0.81.4",
|
|
77
|
+
"react-native-svg": "^15.12.1",
|
|
78
|
+
"typescript": "~5.9.2"
|
|
79
|
+
},
|
|
80
|
+
"publishConfig": {
|
|
81
|
+
"access": "public"
|
|
82
|
+
},
|
|
83
|
+
"files": [
|
|
84
|
+
"src",
|
|
85
|
+
"skills",
|
|
86
|
+
"README.md",
|
|
87
|
+
"LICENSE"
|
|
88
|
+
]
|
|
89
|
+
}
|
package/skills/SKILL.md
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# react-native-mascot
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
Interactive mascot system for React Native apps - Customizable animated characters with Lottie and SVG support, mood system, and easy integration.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @umituz/react-native-mascot
|
|
10
|
+
# or
|
|
11
|
+
yarn add @umituz/react-native-mascot
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Dependencies
|
|
15
|
+
```bash
|
|
16
|
+
npm install lottie-react-native react-native-reanimated react-native-svg
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
### Basic Usage
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { useMascot, MascotView } from '@umituz/react-native-mascot';
|
|
25
|
+
|
|
26
|
+
function MyApp() {
|
|
27
|
+
const mascot = useMascot({
|
|
28
|
+
template: 'friendly-bot',
|
|
29
|
+
autoInitialize: true
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<MascotView
|
|
34
|
+
mascot={mascot.mascot}
|
|
35
|
+
animation={mascot.currentAnimation}
|
|
36
|
+
size={200}
|
|
37
|
+
onPress={() => mascot.playAnimation('wave')}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Using Template
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { MascotFactory, MascotView } from '@umituz/react-native-mascot';
|
|
47
|
+
|
|
48
|
+
function MyScreen() {
|
|
49
|
+
const mascot = MascotFactory.createFromTemplate('cute-pet', {
|
|
50
|
+
appearance: {
|
|
51
|
+
baseColor: '#FFB6C1',
|
|
52
|
+
accentColor: '#FF69B4'
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return <MascotView mascot={mascot} size={150} />;
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Custom Mascot
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
import { Mascot, MascotView } from '@umituz/react-native-mascot';
|
|
64
|
+
|
|
65
|
+
function CustomMascotScreen() {
|
|
66
|
+
const mascot = new Mascot({
|
|
67
|
+
id: 'my-mascot',
|
|
68
|
+
name: 'My Mascot',
|
|
69
|
+
type: 'svg',
|
|
70
|
+
personality: {
|
|
71
|
+
mood: 'happy',
|
|
72
|
+
energy: 0.8,
|
|
73
|
+
friendliness: 0.9,
|
|
74
|
+
playfulness: 0.7
|
|
75
|
+
},
|
|
76
|
+
appearance: {
|
|
77
|
+
baseColor: '#4A90E2',
|
|
78
|
+
accentColor: '#50E3C2',
|
|
79
|
+
accessories: [],
|
|
80
|
+
style: 'cartoon',
|
|
81
|
+
scale: 1
|
|
82
|
+
},
|
|
83
|
+
animations: [],
|
|
84
|
+
interactive: true,
|
|
85
|
+
touchEnabled: true
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
return <MascotView mascot={mascot} />;
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Available Templates
|
|
93
|
+
|
|
94
|
+
- `friendly-bot` - Friendly robot mascot
|
|
95
|
+
- `cute-pet` - Adorable pet character
|
|
96
|
+
- `wise-owl` - Wise owl mentor
|
|
97
|
+
- `pixel-hero` - Pixel art style hero
|
|
98
|
+
|
|
99
|
+
## Mood System
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
// Change mascot mood
|
|
103
|
+
mascot.setMood('excited');
|
|
104
|
+
|
|
105
|
+
// Available moods: 'happy', 'sad', 'excited', 'thinking', 'angry', 'neutral', 'surprised'
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Animation Control
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
// Play animation
|
|
112
|
+
await mascot.playAnimation('jump');
|
|
113
|
+
|
|
114
|
+
// Stop animation
|
|
115
|
+
mascot.stopAnimation();
|
|
116
|
+
|
|
117
|
+
// Built-in animations: 'idle', 'wave', 'jump', 'success', 'error', 'dance'
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Customization
|
|
121
|
+
|
|
122
|
+
### Appearance
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
mascot.updateAppearance({
|
|
126
|
+
baseColor: '#FF6B6B',
|
|
127
|
+
accentColor: '#4ECDC4'
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// Add accessories
|
|
131
|
+
mascot.addAccessory({
|
|
132
|
+
id: 'glasses',
|
|
133
|
+
type: 'glasses',
|
|
134
|
+
color: '#333'
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// Remove accessory
|
|
138
|
+
mascot.removeAccessory('glasses');
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Personality
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
mascot.setEnergy(0.9);
|
|
145
|
+
mascot.setFriendliness(1.0);
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Context Provider
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
import { MascotProvider, useMascotContext } from '@umituz/react-native-mascot';
|
|
152
|
+
|
|
153
|
+
function App() {
|
|
154
|
+
return (
|
|
155
|
+
<MascotProvider template="friendly-bot">
|
|
156
|
+
<MyScreen />
|
|
157
|
+
</MascotProvider>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function MyScreen() {
|
|
162
|
+
const { mascot, playAnimation, setMood } = useMascotContext();
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<>
|
|
166
|
+
<MascotView mascot={mascot} />
|
|
167
|
+
<Button onPress={() => playAnimation('wave')} title="Wave" />
|
|
168
|
+
</>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Features
|
|
174
|
+
|
|
175
|
+
✅ Pre-built mascot templates
|
|
176
|
+
✅ Lottie animation support
|
|
177
|
+
✅ SVG rendering
|
|
178
|
+
✅ Mood and personality system
|
|
179
|
+
✅ Interactive touch support
|
|
180
|
+
✅ Animation queuing
|
|
181
|
+
✅ Custom accessories
|
|
182
|
+
✅ Dynamic color customization
|
|
183
|
+
✅ Type-safe TypeScript
|
|
184
|
+
✅ DDD architecture
|
|
185
|
+
|
|
186
|
+
## License
|
|
187
|
+
|
|
188
|
+
MIT
|