mishi-pet 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 +21 -0
- package/README.md +125 -0
- package/dist/mishi-pet.cjs +1564 -0
- package/dist/mishi-pet.mjs +17606 -0
- package/package.json +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
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,125 @@
|
|
|
1
|
+
# 🐾 Mishi Pet
|
|
2
|
+
|
|
3
|
+
Drop-in animated desktop pet for any website. A Shimeji-style PixiJS companion that walks, crawls, jumps, waves, and responds to dragging — all with zero configuration.
|
|
4
|
+
|
|
5
|
+
 
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
### NPM
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install mishi-pet
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import { MishiPet } from 'mishi-pet';
|
|
17
|
+
|
|
18
|
+
// One line — creates a fullscreen overlay with the pet
|
|
19
|
+
const pet = MishiPet.summon();
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### CDN (Script Tag)
|
|
23
|
+
|
|
24
|
+
```html
|
|
25
|
+
<script src="https://unpkg.com/mishi-pet"></script>
|
|
26
|
+
<script>
|
|
27
|
+
const pet = MishiPet.summon();
|
|
28
|
+
</script>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
That's it! The pet appears on your page and starts playing random animations.
|
|
32
|
+
|
|
33
|
+
## Options
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
const pet = MishiPet.summon({
|
|
37
|
+
autoStart: true, // Start auto-pilot immediately (default: true)
|
|
38
|
+
scale: 0.95, // Sprite scale (default: 0.95)
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Interaction
|
|
43
|
+
|
|
44
|
+
- **Drag** the pet with your mouse — it reacts to speed and direction
|
|
45
|
+
- **Throw** it — it falls with gravity and bounces
|
|
46
|
+
- **Right-click** to open the control menu (if using the sandbox)
|
|
47
|
+
|
|
48
|
+
## API
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
// Change state manually
|
|
52
|
+
pet.changeState('walk-right');
|
|
53
|
+
pet.changeState('sit');
|
|
54
|
+
pet.changeState('wave');
|
|
55
|
+
|
|
56
|
+
// Auto-pilot
|
|
57
|
+
pet.startAuto(); // Start random behavior
|
|
58
|
+
pet.stopAuto(); // Stop and idle
|
|
59
|
+
pet.toggleAuto(); // Toggle on/off
|
|
60
|
+
pet.isAuto; // Check if auto-pilot is running
|
|
61
|
+
|
|
62
|
+
// Cleanup
|
|
63
|
+
pet.destroy(); // Remove pet and clean up
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Available States
|
|
67
|
+
|
|
68
|
+
| State | Description |
|
|
69
|
+
|---|---|
|
|
70
|
+
| `idle` | Standing still |
|
|
71
|
+
| `walk-left` / `walk-right` | Walking |
|
|
72
|
+
| `crawl-left` / `crawl-right` | Belly crawl |
|
|
73
|
+
| `crawl_top` | Ceiling crawl |
|
|
74
|
+
| `sit` | Sitting |
|
|
75
|
+
| `say_hi` | Walking + greeting bubble |
|
|
76
|
+
| `wave` | Wave gesture |
|
|
77
|
+
| `summon` | Fall-from-sky entrance |
|
|
78
|
+
| `jump-grab-right` | Jump arc to right wall |
|
|
79
|
+
| `walk-grab-right` | Walk to wall and grab |
|
|
80
|
+
| `grab-right` | Wall crawl |
|
|
81
|
+
| `tv_clone` | TV clone animation |
|
|
82
|
+
| `remove_cap` | Cap removal animation |
|
|
83
|
+
|
|
84
|
+
## Auto-Pilot
|
|
85
|
+
|
|
86
|
+
The auto-pilot uses a **state transition table** — each state defines what can come next, and the pet picks randomly. Looping states (walk, sit) play for a random duration; one-shot states (tv_clone, remove_cap) play all frames before transitioning.
|
|
87
|
+
|
|
88
|
+
## Development
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Dev server with hot reload
|
|
92
|
+
npm run dev
|
|
93
|
+
|
|
94
|
+
# Build the sandbox
|
|
95
|
+
npm run build
|
|
96
|
+
|
|
97
|
+
# Build the NPM library (ES + UMD)
|
|
98
|
+
npm run build:lib
|
|
99
|
+
|
|
100
|
+
# Regenerate inlined sprites
|
|
101
|
+
npm run inline-sprites
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Project Structure
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
src/
|
|
108
|
+
├── index.js ← NPM entry-point (MishiPet.summon())
|
|
109
|
+
├── MishiPet.js ← Main class (state machine, auto-pilot)
|
|
110
|
+
├── constants.js ← Physics & timing constants
|
|
111
|
+
├── animations.js ← Frame mappings (46 sprites)
|
|
112
|
+
├── transitions.js ← Auto-pilot state transition table
|
|
113
|
+
├── bubble.js ← Speech bubble factory
|
|
114
|
+
├── interaction.js ← Drag/throw input handling
|
|
115
|
+
├── states/
|
|
116
|
+
│ ├── walk.js ← Walk, crawl, ceiling, say-hi
|
|
117
|
+
│ ├── wall.js ← Wall-grab, jump-to-wall
|
|
118
|
+
│ ├── drag.js ← Drag, fall, landing
|
|
119
|
+
│ └── summon.js ← Summon entrance
|
|
120
|
+
└── main.js ← Sandbox entry-point
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
MIT
|