@klex/mascot 0.4.0 → 0.5.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/README.md +13 -0
- package/package.json +1 -1
- package/src/emotes.ts +3 -1
- package/src/glide.ts +108 -21
- package/src/index.ts +11 -0
- package/src/inflate/atlas.ts +74 -0
- package/src/inflate/params.ts +302 -0
- package/src/inflate/renderer.ts +762 -0
- package/src/inflate/shaders.ts +447 -0
- package/src/inflate/shared.ts +39 -0
- package/src/inflate/support.ts +54 -0
- package/src/inflate/turn.ts +198 -0
- package/src/inflate/use-inflated-body.ts +229 -0
- package/src/klex.tsx +123 -33
- package/src/presets.ts +35 -0
package/src/presets.ts
CHANGED
|
@@ -1,9 +1,30 @@
|
|
|
1
|
+
/** Cross-section of the inflated body from its edge inwards. */
|
|
2
|
+
export type InflateProfile = 'pillow' | 'dome' | 'gummy';
|
|
3
|
+
|
|
4
|
+
/** Extra height as a soft 2D blob, e.g. a belly or cheeks. */
|
|
5
|
+
export type InflateBump = {
|
|
6
|
+
/** Rest position in the 160×140 frame of the right-facing outline. */
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
radius: number;
|
|
10
|
+
/** Added height in frame units. Negative values dent the surface. */
|
|
11
|
+
height: number;
|
|
12
|
+
/** `face` follows the eyes, `body` the deformed silhouette's bounds. */
|
|
13
|
+
anchor?: 'face' | 'body';
|
|
14
|
+
};
|
|
15
|
+
|
|
1
16
|
export type BodyShape = {
|
|
2
17
|
id: string;
|
|
3
18
|
name: string;
|
|
4
19
|
outline: readonly (readonly [number, number])[];
|
|
5
20
|
eyeX: number;
|
|
6
21
|
eyeY: number;
|
|
22
|
+
/** Inflated look only: 0 is a flat cookie, 1 a round marshmallow. */
|
|
23
|
+
puffiness?: number;
|
|
24
|
+
/** Inflated look only. Defaults to `dome`. */
|
|
25
|
+
edgeProfile?: InflateProfile;
|
|
26
|
+
/** Inflated look only. At most four bumps are drawn. */
|
|
27
|
+
bumps?: readonly InflateBump[];
|
|
7
28
|
};
|
|
8
29
|
|
|
9
30
|
export type KlexPalette = {
|
|
@@ -19,6 +40,12 @@ export const BODY_SHAPES = [
|
|
|
19
40
|
name: 'Klex',
|
|
20
41
|
eyeX: 23.294,
|
|
21
42
|
eyeY: 56.824,
|
|
43
|
+
puffiness: 0.6,
|
|
44
|
+
edgeProfile: 'dome',
|
|
45
|
+
bumps: [
|
|
46
|
+
{ x: 90.3, y: 67, radius: 6, height: 1.5, anchor: 'face' },
|
|
47
|
+
{ x: 116.3, y: 67, radius: 6, height: 1.5, anchor: 'face' },
|
|
48
|
+
],
|
|
22
49
|
// Logo contour from packages/ui/src/components/ui/klex-logo.tsx, scaled
|
|
23
50
|
// uniformly to 110px high, with three sole points at y=128 for ground contact.
|
|
24
51
|
outline: [
|
|
@@ -125,6 +152,9 @@ export const BODY_SHAPES = [
|
|
|
125
152
|
name: 'Blob',
|
|
126
153
|
eyeX: 23,
|
|
127
154
|
eyeY: 65,
|
|
155
|
+
puffiness: 0.75,
|
|
156
|
+
edgeProfile: 'pillow',
|
|
157
|
+
bumps: [{ x: 84, y: 100, radius: 24, height: 5, anchor: 'body' }],
|
|
128
158
|
outline: [
|
|
129
159
|
[88, 28],
|
|
130
160
|
[115, 33],
|
|
@@ -147,6 +177,8 @@ export const BODY_SHAPES = [
|
|
|
147
177
|
name: 'Slime',
|
|
148
178
|
eyeX: 31,
|
|
149
179
|
eyeY: 87,
|
|
180
|
+
puffiness: 0.45,
|
|
181
|
+
edgeProfile: 'gummy',
|
|
150
182
|
outline: [
|
|
151
183
|
[100, 58],
|
|
152
184
|
[123, 64],
|
|
@@ -169,6 +201,9 @@ export const BODY_SHAPES = [
|
|
|
169
201
|
name: 'Drop',
|
|
170
202
|
eyeX: 18,
|
|
171
203
|
eyeY: 63,
|
|
204
|
+
puffiness: 0.7,
|
|
205
|
+
edgeProfile: 'dome',
|
|
206
|
+
bumps: [{ x: 86, y: 104, radius: 20, height: 3, anchor: 'body' }],
|
|
172
207
|
outline: [
|
|
173
208
|
[92, 12],
|
|
174
209
|
[108, 26],
|