bloub-to-vue-and-react 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jérémy Perret
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,111 @@
1
+ # bloub
2
+
3
+ An SVG recreation of the x.ai bot avatar: **one filled black shape** that morphs
4
+ between 14 states, **two white shapes** for the eyes that morph independently, on
5
+ a plain background. No animation library.
6
+
7
+ ![The avatar going through idle, wink, orbit and burst](docs/demo.gif)
8
+
9
+ ## Running it
10
+
11
+ ```bash
12
+ pnpm install
13
+ pnpm dev
14
+ ```
15
+
16
+ Then open http://localhost:5190.
17
+
18
+ ```bash
19
+ pnpm test # vitest
20
+ pnpm build # vue-tsc --noEmit && vite build
21
+ ```
22
+
23
+ Vue 3, Vite, TypeScript, Tailwind 4. No ESLint and no Prettier: `vue-tsc` is the
24
+ only gate, so run `pnpm build` before you call something done.
25
+
26
+ ## What's in it
27
+
28
+ The rail on the left switches between three views. **Customise** offers 8 body
29
+ shapes, 12 colours and 16 rest expressions, kept between visits. **Animations** is
30
+ a small editor: arrange states into a timeline, set how long each is held, save the
31
+ result. **Settings** holds the language (French, English or Chinese) and the
32
+ credits.
33
+
34
+ Anything on screen can be exported: the avatar as SVG, PNG or an animated GIF, and
35
+ a whole timeline as GIF or MP4. The still formats need no library at all, and the
36
+ video encoder is only fetched the first time you ask for one.
37
+
38
+ Two URLs are worth knowing:
39
+
40
+ - `#planche`: the 14 states side by side, frozen. Quick visual check.
41
+ - `#etat=orbit&stop`: opens one state directly, playback paused.
42
+
43
+ ![The 14 states, frozen side by side](docs/states.png)
44
+
45
+ ## Why the numbers look arbitrary
46
+
47
+ They're measured, not chosen. The reference video was cut at 10 fps and each
48
+ state measured off the frames: silhouettes by sub-pixel ray casting, eyes by
49
+ capsule fitting, colours and stroke widths by direct sampling.
50
+
51
+ So the constants in the code are **measurements**, and rounding them to friendlier
52
+ values breaks the resemblance, which is the only thing this project is trying to
53
+ get right. A few are counter-intuitive enough to be worth knowing before you
54
+ correct anything:
55
+
56
+ | What you'd assume | What the video shows |
57
+ |---|---|
58
+ | The eyes lean `//` | They lean `\\`, around 26° off vertical |
59
+ | The body is a squircle | It's a perfect circle, radial deviation under 0.7% |
60
+ | Transitions are springs | Exponential ease-outs; the body never overshoots |
61
+ | The comet crosses the screen | The dot stays put, the trail orbits it |
62
+ | The avatar floats at rest | It doesn't. The life is gaze drift and blinking |
63
+
64
+ [docs/measurements.md](docs/measurements.md) has the rest, including how to
65
+ regenerate the extracted profiles.
66
+
67
+ ## How it's put together
68
+
69
+ `src/bot/` is framework-free and clock-free: `engine.sample(t)` is a pure
70
+ function of time. Pausing, resuming, jumping to an arbitrary date and running
71
+ tests all produce the same image, which is what makes the frozen state board and
72
+ the DOM-less test suite possible.
73
+
74
+ | | |
75
+ |---|---|
76
+ | [docs/architecture.md](docs/architecture.md) | The engine, radial-profile morphing, eyes as mask holes |
77
+ | [docs/measurements.md](docs/measurements.md) | What was measured, and regenerating `profiles.ts` |
78
+ | [docs/intro.md](docs/intro.md) | The arrival sequence, and why it only plays one state |
79
+ | [docs/interface.md](docs/interface.md) | Layout, the three-column scene, CSS traps |
80
+ | [docs/export.md](docs/export.md) | Exporting to SVG, PNG, GIF and MP4 |
81
+ | [docs/i18n.md](docs/i18n.md) | The hand-rolled translation layer |
82
+
83
+ ## Using the component
84
+
85
+ ```vue
86
+ <BloubBot v-model:block="block" v-model:state="state" v-model:playing="playing" />
87
+ <BloubBot state="orbit" :size="120" :frozen-at="1.2" />
88
+ ```
89
+
90
+ `block` is the playback cursor: a montage can play the same state twice, so the
91
+ index is what identifies where you are; `state` follows it as an output. Pass
92
+ `frozenAt` and the component renders one exact frame with no animation loop, which
93
+ is how the thumbnails and the state board are drawn.
94
+
95
+ Props: `size`, `shape`, `color`, `expression`, `paper`, `frozenAt`, `cycle`,
96
+ `follow`, `gaze`. Models: `block`, `state`, `playing`, `elapsed`. See
97
+ [BloubBot.vue](src/components/BloubBot.vue) for the details.
98
+
99
+ ## Changes
100
+
101
+ [CHANGELOG.md](CHANGELOG.md), one entry per release — which is how you tell whether the
102
+ copy you have carries a given fix.
103
+
104
+ ## License
105
+
106
+ MIT. See [LICENSE](LICENSE).
107
+
108
+ Not affiliated with, endorsed by or connected to x.ai. It recreates the visual
109
+ behaviour of their bot avatar as an exercise; "Grok" and "x.ai" belong to their
110
+ owners. The MIT licence covers the code in this repository, not the design it
111
+ imitates.