@plupin/character 0.0.0-stage → 0.3.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.
Files changed (53) hide show
  1. package/dist/anime-face.d.ts +42 -0
  2. package/dist/anime-face.js +14 -0
  3. package/dist/blob.d.ts +32 -0
  4. package/dist/blob.js +18 -0
  5. package/dist/body-presets.d.ts +85 -0
  6. package/dist/canvas.d.ts +79 -0
  7. package/dist/canvas.js +315 -0
  8. package/dist/chunk-09c5tps4.js +337 -0
  9. package/dist/chunk-60p135hw.js +103 -0
  10. package/dist/chunk-aa5nstet.js +39 -0
  11. package/dist/chunk-dpb0rnw9.js +37 -0
  12. package/dist/chunk-g1c0wdcj.js +825 -0
  13. package/dist/chunk-kber92gm.js +415 -0
  14. package/dist/chunk-sa2r1cxz.js +342 -0
  15. package/dist/chunk-yd5zzkkg.js +313 -0
  16. package/dist/clip-bake.d.ts +48 -0
  17. package/dist/clip-bake.js +132 -0
  18. package/dist/clips.d.ts +40 -0
  19. package/dist/dress.d.ts +4 -0
  20. package/dist/emote.d.ts +25 -0
  21. package/dist/faces.d.ts +10 -0
  22. package/dist/faces.js +12 -0
  23. package/dist/gaze.d.ts +81 -0
  24. package/dist/gaze.js +113 -0
  25. package/dist/hair3d.d.ts +3 -0
  26. package/dist/index.d.ts +19 -0
  27. package/dist/index.js +176 -0
  28. package/dist/listing.d.ts +195 -0
  29. package/dist/listing.js +763 -0
  30. package/dist/named-faces.d.ts +22 -0
  31. package/dist/platform-body-data.d.ts +9 -0
  32. package/dist/platform-body.d.ts +91 -0
  33. package/dist/plup2d.d.ts +29 -0
  34. package/dist/plup3d.d.ts +121 -0
  35. package/dist/png.d.ts +78 -0
  36. package/dist/pose.d.ts +49 -0
  37. package/dist/pose.js +18 -0
  38. package/dist/proportions.d.ts +31 -0
  39. package/dist/ragdoll.d.ts +51 -0
  40. package/dist/resolution.d.ts +21 -0
  41. package/dist/rig.d.ts +29 -0
  42. package/dist/skin-map.d.ts +155 -0
  43. package/dist/skin-map.js +55 -0
  44. package/dist/skin-native.d.ts +301 -0
  45. package/dist/skin.d.ts +35 -0
  46. package/dist/texture.d.ts +8 -0
  47. package/dist/three.d.ts +25 -0
  48. package/dist/three.js +2302 -0
  49. package/dist/wear3d.d.ts +99 -0
  50. package/dist/wearables.d.ts +203 -0
  51. package/dist/wearables.js +26 -0
  52. package/package.json +78 -4
  53. package/README.md +0 -3
@@ -0,0 +1,337 @@
1
+ // src/anime-face.ts
2
+ var ANIME_FACE_SIZE = { width: 512, height: 256 };
3
+ var ANIME_FACE_UV = { u0: 0.07, u1: 0.43, v0: 0.37, v1: 0.7 };
4
+ var PARTS = {
5
+ idle: { eyes: "open", mouth: "smile", brows: "calm", blush: 0.55 },
6
+ blink: { eyes: "closed", mouth: "smile", brows: "calm", blush: 0.55 },
7
+ happy: { eyes: "happy", mouth: "open", brows: "up", blush: 0.8 },
8
+ surprised: { eyes: "wide", mouth: "o", brows: "up", blush: 0.4 },
9
+ sad: { eyes: "sad", mouth: "frown", brows: "sad", blush: 0.3 },
10
+ wee: { eyes: "happy", mouth: "o", brows: "up", blush: 0.9 },
11
+ sparkle: { eyes: "stars", mouth: "open", brows: "up", blush: 0.9 },
12
+ shock: { eyes: "wide", mouth: "o", brows: "up", blush: 0.2 },
13
+ yell: { eyes: "angry", mouth: "yell", brows: "angry", blush: 0.3 },
14
+ pain: { eyes: "closed", mouth: "frown", brows: "sad", blush: 0.2 },
15
+ dead: { eyes: "dead", mouth: "flat", brows: "none", blush: 0 },
16
+ rage: { eyes: "angry", mouth: "grin", brows: "angry", blush: 0.2 },
17
+ speechless: { eyes: "half", mouth: "flat", brows: "calm", blush: 0.2 },
18
+ idea: { eyes: "wide", mouth: "smile", brows: "up", blush: 0.5 },
19
+ smug: { eyes: "half", mouth: "cat", brows: "calm", blush: 0.6 },
20
+ cry: { eyes: "cry", mouth: "frown", brows: "sad", blush: 0.5, tears: true },
21
+ smirk: { eyes: "wink", mouth: "smirk", brows: "calm", blush: 0.6 },
22
+ tongue: { eyes: "wink", mouth: "tongue", brows: "up", blush: 0.7 },
23
+ cool: { eyes: "half", mouth: "smirk", brows: "calm", blush: 0.2 },
24
+ serious: { eyes: "angry", mouth: "flat", brows: "angry", blush: 0 },
25
+ stars: { eyes: "stars", mouth: "grin", brows: "up", blush: 0.9 },
26
+ licik: { eyes: "half", mouth: "grin", brows: "angry", blush: 0.3 },
27
+ tidur: { eyes: "closed", mouth: "o", brows: "calm", blush: 0.5 },
28
+ teriak: { eyes: "angry", mouth: "yell", brows: "angry", blush: 0.3 },
29
+ ngomel: { eyes: "angry", mouth: "frown", brows: "angry", blush: 0.3 }
30
+ };
31
+ var INK = "#1d1430";
32
+ var LASH = "#24152e";
33
+ function animeFaceParts(face) {
34
+ return PARTS[face] ?? PARTS.idle ?? { eyes: "open", mouth: "smile", brows: "calm", blush: 0.5 };
35
+ }
36
+ var W = ANIME_FACE_SIZE.width;
37
+ var H = ANIME_FACE_SIZE.height;
38
+ var EYE_Y = 112;
39
+ var EYE_X = 88;
40
+ var EYE_W = 74;
41
+ var EYE_H = 100;
42
+ var MOUTH_Y = 192;
43
+ var ANIME_EYE_LINE = EYE_Y / H;
44
+ var mix = (a, b, t) => {
45
+ const ch = (hex, i) => Number.parseInt(hex.slice(1 + i * 2, 3 + i * 2), 16);
46
+ return `#${[0, 1, 2].map((i) => Math.round(ch(a, i) + (ch(b, i) - ch(a, i)) * t).toString(16).padStart(2, "0")).join("")}`;
47
+ };
48
+ function ellipse(ctx, x, y, rx, ry) {
49
+ ctx.beginPath();
50
+ ctx.ellipse(x, y, Math.max(0.5, rx), Math.max(0.5, ry), 0, 0, Math.PI * 2);
51
+ }
52
+ function eyeShape(ctx, x, y, side) {
53
+ const w = EYE_W / 2;
54
+ const h = EYE_H / 2;
55
+ ctx.beginPath();
56
+ ctx.moveTo(x - w, y - h * 0.25);
57
+ ctx.bezierCurveTo(x - w * 0.9, y - h * 1.05, x + w * 0.9, y - h * 1.12 - side * 2, x + w, y - h * 0.3);
58
+ ctx.bezierCurveTo(x + w * 1.05, y + h * 0.75, x + w * 0.5, y + h, x, y + h);
59
+ ctx.bezierCurveTo(x - w * 0.55, y + h, x - w * 1.05, y + h * 0.7, x - w, y - h * 0.25);
60
+ ctx.closePath();
61
+ }
62
+ function lashes(ctx, x, y, side, lift = 0) {
63
+ const w = EYE_W / 2;
64
+ const h = EYE_H / 2;
65
+ const outer = side;
66
+ ctx.fillStyle = LASH;
67
+ ctx.beginPath();
68
+ ctx.moveTo(x - outer * w * 1.02, y - h * 0.2 + lift);
69
+ ctx.bezierCurveTo(x - outer * w * 0.9, y - h * 1.12 + lift, x + outer * w * 0.85, y - h * 1.2 + lift, x + outer * w * 1.22, y - h * 0.62 + lift);
70
+ ctx.lineTo(x + outer * w * 1.42, y - h * 0.72 + lift);
71
+ ctx.lineTo(x + outer * w * 1.08, y - h * 0.3 + lift);
72
+ ctx.bezierCurveTo(x + outer * w * 0.8, y - h * 0.92 + lift, x - outer * w * 0.8, y - h * 0.86 + lift, x - outer * w * 1.02, y - h * 0.2 + lift);
73
+ ctx.closePath();
74
+ ctx.fill();
75
+ }
76
+ function lowerLash(ctx, x, y, side) {
77
+ const w = EYE_W / 2;
78
+ const h = EYE_H / 2;
79
+ ctx.strokeStyle = LASH;
80
+ ctx.lineWidth = 3;
81
+ ctx.lineCap = "round";
82
+ ctx.beginPath();
83
+ ctx.moveTo(x + side * w * 0.95, y + h * 0.35);
84
+ ctx.quadraticCurveTo(x + side * w * 0.6, y + h * 0.95, x + side * w * 0.05, y + h * 1);
85
+ ctx.stroke();
86
+ }
87
+ function openEye(ctx, x, y, side, iris, { pupil = 1, wet = false, catchlights = 2, squint = 0 } = {}) {
88
+ ctx.save();
89
+ eyeShape(ctx, x, y, side);
90
+ ctx.fillStyle = "#fffaff";
91
+ ctx.fill();
92
+ ctx.clip();
93
+ const ix = x + side * 2;
94
+ const iy = y + 6;
95
+ const irx = EYE_W * 0.4;
96
+ const iry = EYE_H * 0.47;
97
+ const gradient = ctx.createLinearGradient(0, iy - iry, 0, iy + iry);
98
+ gradient.addColorStop(0, mix(iris, "#100818", 0.55));
99
+ gradient.addColorStop(0.55, iris);
100
+ gradient.addColorStop(1, mix(iris, "#ffffff", 0.55));
101
+ ellipse(ctx, ix, iy, irx, iry);
102
+ ctx.fillStyle = gradient;
103
+ ctx.fill();
104
+ ctx.lineWidth = 3;
105
+ ctx.strokeStyle = mix(iris, "#100818", 0.6);
106
+ ctx.stroke();
107
+ ellipse(ctx, ix, iy + 2, irx * 0.42 * pupil, iry * 0.46 * pupil);
108
+ ctx.fillStyle = mix(iris, "#0a0410", 0.8);
109
+ ctx.fill();
110
+ ellipse(ctx, ix, iy + iry * 0.5, irx * 0.6, iry * 0.28);
111
+ ctx.fillStyle = `${mix(iris, "#ffffff", 0.7)}88`;
112
+ ctx.fill();
113
+ ctx.fillStyle = "rgba(40, 20, 70, 0.35)";
114
+ ctx.fillRect(x - EYE_W, y - EYE_H, EYE_W * 2, EYE_H * 0.42 + squint);
115
+ ctx.restore();
116
+ ctx.fillStyle = "#ffffff";
117
+ if (catchlights > 0) {
118
+ ellipse(ctx, ix - side * irx * 0.4, iy - iry * 0.4, irx * 0.34, iry * 0.26);
119
+ ctx.fill();
120
+ }
121
+ if (catchlights > 1) {
122
+ ellipse(ctx, ix + side * irx * 0.42, iy + iry * 0.38, irx * 0.14, iry * 0.1);
123
+ ctx.fill();
124
+ }
125
+ if (wet) {
126
+ ctx.globalAlpha = 0.8;
127
+ ellipse(ctx, ix, iy + iry * 0.62, irx * 0.75, iry * 0.12);
128
+ ctx.fill();
129
+ ctx.globalAlpha = 1;
130
+ }
131
+ lashes(ctx, x, y, side, squint);
132
+ lowerLash(ctx, x, y, side);
133
+ }
134
+ function closedEye(ctx, x, y, side, happy) {
135
+ const w = EYE_W / 2;
136
+ ctx.strokeStyle = LASH;
137
+ ctx.lineWidth = 7;
138
+ ctx.lineCap = "round";
139
+ ctx.beginPath();
140
+ if (happy) {
141
+ ctx.moveTo(x - w, y + 10);
142
+ ctx.quadraticCurveTo(x, y - 26, x + w, y + 10);
143
+ } else {
144
+ ctx.moveTo(x - w, y + 2);
145
+ ctx.quadraticCurveTo(x, y + 22, x + w, y + 2);
146
+ ctx.moveTo(x + side * w, y + 2);
147
+ ctx.lineTo(x + side * w * 1.3, y - 6);
148
+ }
149
+ ctx.stroke();
150
+ }
151
+ function star(ctx, x, y, r, color) {
152
+ ctx.beginPath();
153
+ for (let i = 0;i < 10; i += 1) {
154
+ const a = i / 10 * Math.PI * 2 - Math.PI / 2;
155
+ const k = i % 2 ? r * 0.45 : r;
156
+ ctx.lineTo(x + Math.cos(a) * k, y + Math.sin(a) * k);
157
+ }
158
+ ctx.closePath();
159
+ ctx.fillStyle = color;
160
+ ctx.fill();
161
+ }
162
+ function eye(ctx, side, parts, iris) {
163
+ const x = W / 2 + side * EYE_X;
164
+ const y = EYE_Y;
165
+ switch (parts.eyes) {
166
+ case "closed":
167
+ return closedEye(ctx, x, y, side, false);
168
+ case "happy":
169
+ return closedEye(ctx, x, y, side, true);
170
+ case "wink":
171
+ return side > 0 ? closedEye(ctx, x, y, side, true) : openEye(ctx, x, y, side, iris);
172
+ case "wide":
173
+ return openEye(ctx, x, y, side, iris, { pupil: 0.45, catchlights: 1 });
174
+ case "sad":
175
+ case "cry":
176
+ return openEye(ctx, x, y, side, iris, { wet: true, pupil: 1.1 });
177
+ case "half":
178
+ openEye(ctx, x, y, side, iris, { squint: 26 });
179
+ return;
180
+ case "angry":
181
+ openEye(ctx, x, y, side, iris, { catchlights: 0, squint: 14, pupil: 0.7 });
182
+ return;
183
+ case "stars":
184
+ openEye(ctx, x, y, side, iris, { catchlights: 0 });
185
+ star(ctx, x + side * 2, y + 6, 22, "#fff4a8");
186
+ return;
187
+ case "dead": {
188
+ ctx.strokeStyle = LASH;
189
+ ctx.lineWidth = 7;
190
+ ctx.lineCap = "round";
191
+ ctx.beginPath();
192
+ ctx.moveTo(x - 20, y - 20);
193
+ ctx.lineTo(x + 20, y + 20);
194
+ ctx.moveTo(x + 20, y - 20);
195
+ ctx.lineTo(x - 20, y + 20);
196
+ ctx.stroke();
197
+ return;
198
+ }
199
+ default:
200
+ openEye(ctx, x, y, side, iris);
201
+ }
202
+ }
203
+ function brow(ctx, side, brows) {
204
+ if (brows === "none")
205
+ return;
206
+ const x = W / 2 + side * EYE_X;
207
+ const y = EYE_Y - EYE_H * 0.72;
208
+ const tilt = brows === "angry" ? 16 : brows === "sad" ? -12 : 0;
209
+ const lift = brows === "up" ? -6 : 0;
210
+ ctx.strokeStyle = mix(LASH, "#ffffff", 0.15);
211
+ ctx.lineWidth = 4;
212
+ ctx.lineCap = "round";
213
+ ctx.beginPath();
214
+ ctx.moveTo(x - side * 22, y + lift + tilt);
215
+ ctx.quadraticCurveTo(x, y + lift - 6, x + side * 22, y + lift - tilt * 0.2);
216
+ ctx.stroke();
217
+ }
218
+ function mouth(ctx, shape) {
219
+ const x = W / 2;
220
+ const y = MOUTH_Y;
221
+ ctx.strokeStyle = INK;
222
+ ctx.lineWidth = 4;
223
+ ctx.lineCap = "round";
224
+ ctx.lineJoin = "round";
225
+ const fillOpen = (w, h, round = false) => {
226
+ ctx.beginPath();
227
+ if (round)
228
+ ctx.ellipse(x, y + h / 2, w, h / 2 + 2, 0, 0, Math.PI * 2);
229
+ else {
230
+ ctx.moveTo(x - w, y);
231
+ ctx.quadraticCurveTo(x, y + h * 2, x + w, y);
232
+ ctx.closePath();
233
+ }
234
+ ctx.fillStyle = "#8a2a3e";
235
+ ctx.fill();
236
+ ctx.stroke();
237
+ ctx.save();
238
+ ctx.clip();
239
+ ellipse(ctx, x, y + h * 1.05, w * 0.6, h * 0.5);
240
+ ctx.fillStyle = "#f07a95";
241
+ ctx.fill();
242
+ ctx.restore();
243
+ };
244
+ ctx.beginPath();
245
+ switch (shape) {
246
+ case "smile":
247
+ ctx.moveTo(x - 10, y);
248
+ ctx.quadraticCurveTo(x, y + 8, x + 10, y);
249
+ ctx.stroke();
250
+ return;
251
+ case "cat":
252
+ ctx.moveTo(x - 14, y - 2);
253
+ ctx.quadraticCurveTo(x - 7, y + 9, x, y);
254
+ ctx.quadraticCurveTo(x + 7, y + 9, x + 14, y - 2);
255
+ ctx.stroke();
256
+ return;
257
+ case "open":
258
+ return fillOpen(13, 11);
259
+ case "grin":
260
+ return fillOpen(18, 12);
261
+ case "yell":
262
+ return fillOpen(16, 22, true);
263
+ case "o":
264
+ return fillOpen(8, 14, true);
265
+ case "frown":
266
+ ctx.moveTo(x - 10, y + 6);
267
+ ctx.quadraticCurveTo(x, y - 3, x + 10, y + 6);
268
+ ctx.stroke();
269
+ return;
270
+ case "smirk":
271
+ ctx.moveTo(x - 8, y + 3);
272
+ ctx.quadraticCurveTo(x + 6, y + 6, x + 14, y - 4);
273
+ ctx.stroke();
274
+ return;
275
+ case "tongue":
276
+ ctx.moveTo(x - 12, y);
277
+ ctx.quadraticCurveTo(x, y + 8, x + 12, y);
278
+ ctx.stroke();
279
+ ellipse(ctx, x + 4, y + 8, 7, 8);
280
+ ctx.fillStyle = "#f07a95";
281
+ ctx.fill();
282
+ ctx.stroke();
283
+ return;
284
+ default:
285
+ ctx.moveTo(x - 9, y + 2);
286
+ ctx.lineTo(x + 9, y + 2);
287
+ ctx.stroke();
288
+ }
289
+ }
290
+ function blush(ctx, amount) {
291
+ if (amount <= 0)
292
+ return;
293
+ for (const side of [-1, 1]) {
294
+ const x = W / 2 + side * (EYE_X + 14);
295
+ const y = EYE_Y + EYE_H * 0.72;
296
+ const glow = ctx.createRadialGradient(x, y, 2, x, y, 34);
297
+ glow.addColorStop(0, `rgba(255, 120, 150, ${0.55 * amount})`);
298
+ glow.addColorStop(1, "rgba(255, 120, 150, 0)");
299
+ ctx.fillStyle = glow;
300
+ ctx.fillRect(x - 40, y - 26, 80, 52);
301
+ ctx.strokeStyle = `rgba(230, 80, 120, ${0.7 * amount})`;
302
+ ctx.lineWidth = 2.5;
303
+ ctx.lineCap = "round";
304
+ for (let i = -1;i <= 1; i += 1) {
305
+ ctx.beginPath();
306
+ ctx.moveTo(x + i * 10 - 3, y + 5);
307
+ ctx.lineTo(x + i * 10 + 4, y - 5);
308
+ ctx.stroke();
309
+ }
310
+ }
311
+ }
312
+ function tears(ctx) {
313
+ for (const side of [-1, 1]) {
314
+ const x = W / 2 + side * (EYE_X - 8);
315
+ const y = EYE_Y + EYE_H * 0.5;
316
+ ctx.fillStyle = "rgba(140, 220, 255, 0.85)";
317
+ ctx.beginPath();
318
+ ctx.moveTo(x, y);
319
+ ctx.quadraticCurveTo(x + side * 10, y + 30, x, y + 44);
320
+ ctx.quadraticCurveTo(x - side * 8, y + 30, x, y);
321
+ ctx.fill();
322
+ }
323
+ }
324
+ function drawAnimeFace(ctx, face, iris = "#6a4cff") {
325
+ ctx.clearRect(0, 0, W, H);
326
+ const parts = animeFaceParts(face);
327
+ blush(ctx, parts.blush);
328
+ for (const side of [-1, 1]) {
329
+ eye(ctx, side, parts, iris);
330
+ brow(ctx, side, parts.brows);
331
+ }
332
+ if (parts.tears)
333
+ tears(ctx);
334
+ mouth(ctx, parts.mouth);
335
+ }
336
+
337
+ export { ANIME_FACE_SIZE, ANIME_FACE_UV, animeFaceParts, ANIME_EYE_LINE, drawAnimeFace };
@@ -0,0 +1,103 @@
1
+ // src/wearables.ts
2
+ var WEARABLES = {
3
+ "fluffy-bob": {
4
+ slot: "hair",
5
+ name: "Fluffy Bob",
6
+ rarity: "common",
7
+ sigmaPrice: 40,
8
+ volume: 0.06
9
+ },
10
+ "twin-tails": { slot: "hair", name: "Twin Tails", rarity: "rare", sigmaPrice: 70, volume: 0.05 },
11
+ "spiky-hero": { slot: "hair", name: "Spiky Hero", rarity: "rare", sigmaPrice: 65, volume: 0.12 },
12
+ afro: { slot: "hair", name: "Afro", rarity: "rare", sigmaPrice: 60, volume: 0.2 },
13
+ "swoosh-quiff": {
14
+ slot: "hair",
15
+ name: "Swoosh Quiff",
16
+ rarity: "common",
17
+ sigmaPrice: 35,
18
+ volume: 0.08
19
+ },
20
+ "long-waves": {
21
+ slot: "hair",
22
+ name: "Long Waves",
23
+ rarity: "epic",
24
+ sigmaPrice: 110,
25
+ volume: 0.05,
26
+ view: -0.9
27
+ },
28
+ ponytail: {
29
+ slot: "hair",
30
+ name: "Ponytail",
31
+ rarity: "common",
32
+ sigmaPrice: 45,
33
+ volume: 0.05,
34
+ view: -1.2
35
+ },
36
+ mohawk: {
37
+ slot: "hair",
38
+ name: "Mohawk",
39
+ rarity: "rare",
40
+ sigmaPrice: 55,
41
+ volume: 0.14,
42
+ view: -0.8
43
+ },
44
+ "space-buns": { slot: "hair", name: "Space Buns", rarity: "rare", sigmaPrice: 60, volume: 0.06 },
45
+ "hime-cut": {
46
+ slot: "hair",
47
+ name: "Hime Cut",
48
+ rarity: "epic",
49
+ sigmaPrice: 120,
50
+ volume: 0.06,
51
+ view: -0.6
52
+ },
53
+ "bunny-ears": { slot: "hat", name: "Bunny Ears", rarity: "rare", sigmaPrice: 60 },
54
+ "cat-ears": { slot: "hat", name: "Cat Ears", rarity: "common", sigmaPrice: 45 },
55
+ "top-hat": { slot: "hat", name: "Top Hat", rarity: "rare", sigmaPrice: 70 },
56
+ crown: { slot: "hat", name: "Crown", rarity: "epic", sigmaPrice: 150 },
57
+ "party-hat": { slot: "hat", name: "Party Hat", rarity: "common", sigmaPrice: 35 },
58
+ halo: { slot: "hat", name: "Halo", rarity: "epic", sigmaPrice: 120 },
59
+ bow: { slot: "hat", name: "Bow", rarity: "common", sigmaPrice: 30 },
60
+ "pleated-skirt": { slot: "accessory", name: "Pleated Skirt", rarity: "common", sigmaPrice: 50 },
61
+ tuxedo: { slot: "accessory", name: "Tuxedo", rarity: "epic", sigmaPrice: 140 },
62
+ "hero-cape": { slot: "accessory", name: "Hero Cape", rarity: "rare", sigmaPrice: 90, view: 2.6 },
63
+ scarf: { slot: "accessory", name: "Scarf", rarity: "common", sigmaPrice: 40 },
64
+ sunglasses: { slot: "accessory", name: "Sunglasses", rarity: "rare", sigmaPrice: 65 }
65
+ };
66
+ var WEAR_KEYS = Object.keys(WEARABLES);
67
+ var PREFIX = "wear-";
68
+ var entry = (key) => WEARABLES[key];
69
+ var isWearKey = (value) => typeof value === "string" && Object.hasOwn(WEARABLES, value);
70
+ var isHairKey = (key) => entry(key).slot === "hair";
71
+ var hairVolume = (key) => entry(key).volume ?? 0;
72
+ var wearSlotOf = (key) => entry(key).slot;
73
+ function wearKeyOf(itemId) {
74
+ if (!itemId?.startsWith(PREFIX))
75
+ return null;
76
+ const key = itemId.slice(PREFIX.length);
77
+ return isWearKey(key) ? key : null;
78
+ }
79
+ var wearItemId = (key) => `${PREFIX}${key}`;
80
+ function wearKeysOf(itemIds) {
81
+ const keys = new Set;
82
+ for (const id of itemIds) {
83
+ const key = wearKeyOf(id);
84
+ if (key)
85
+ keys.add(key);
86
+ }
87
+ return WEAR_KEYS.filter((key) => keys.has(key));
88
+ }
89
+ function wearableItems() {
90
+ return WEAR_KEYS.map((key) => ({
91
+ id: wearItemId(key),
92
+ slot: entry(key).slot,
93
+ name: entry(key).name,
94
+ rarity: entry(key).rarity,
95
+ sigmaPrice: entry(key).sigmaPrice,
96
+ assetConfig: { wear: key }
97
+ }));
98
+ }
99
+ function wearView(key) {
100
+ return key ? entry(key).view ?? -0.3 : -0.3;
101
+ }
102
+
103
+ export { WEARABLES, WEAR_KEYS, isWearKey, isHairKey, hairVolume, wearSlotOf, wearKeyOf, wearItemId, wearKeysOf, wearableItems, wearView };
@@ -0,0 +1,39 @@
1
+ // src/named-faces.ts
2
+ var NAMED_FACE_STAMPS = {
3
+ sparkle: [".ew..we.", ".ee..ee.", "p..mm..p", "........"],
4
+ shock: [".ee..ee.", ".ew..we.", "...mm...", "...mm..."],
5
+ yell: ["..e..e..", ".ew..we.", ".mmmmmm.", ".mttttm."],
6
+ pain: [".ee..ee.", "........", ".m.mm.m.", "..mmmm.."],
7
+ dead: ["www..www", "www..www", "..mmmm..", "........"],
8
+ rage: ["ee....ee", ".ee..ee.", ".mwwwwm.", "..mmmm.."],
9
+ speechless: ["........", ".e....e.", "........", "...mm..."],
10
+ idea: [".ee..ee.", ".ew..ew.", "..m..m..", "...mm..."],
11
+ smug: ["........", "eee..eee", "........", "..mmmm.."],
12
+ cry: ["eee..eee", "c......c", "c.mmmm.c", "..mttm.."],
13
+ smirk: [".ee..ee.", "........", "....mmm.", "........"],
14
+ tongue: ["........", ".ee..ee.", "...mm...", "...tt..."],
15
+ cool: ["eeeeeeee", ".ee..ee.", "..m..m..", "...mm..."],
16
+ serious: ["eee..eee", "ewe..ewe", "........", "..mmmm.."],
17
+ stars: [".y....y.", "yyy..yyy", "..mmmm..", "..mttm.."],
18
+ licik: [".ee..ee.", "........", ".mm..mm.", "..mmmm.."],
19
+ tidur: ["........", ".ee..ee.", "...mm...", "...mm..."],
20
+ teriak: ["..e..e..", ".e....e.", ".mmmmmm.", "..mttm.."],
21
+ ngomel: ["ee....ee", ".e....e.", "...mm...", "..m..m.."]
22
+ };
23
+
24
+ // src/faces.ts
25
+ var NAMED_FACES = Object.keys(NAMED_FACE_STAMPS);
26
+ var FACE_STAMP_PALETTE = {
27
+ e: "#161923",
28
+ w: "#ffffff",
29
+ m: "#5a1f2a",
30
+ t: "#e8607a",
31
+ p: "#f08aa8",
32
+ y: "#f2d24b",
33
+ c: "#4cc9e2"
34
+ };
35
+ function isNamedFace(name) {
36
+ return Object.hasOwn(NAMED_FACE_STAMPS, name);
37
+ }
38
+
39
+ export { NAMED_FACE_STAMPS, NAMED_FACES, FACE_STAMP_PALETTE, isNamedFace };
@@ -0,0 +1,37 @@
1
+ // src/blob.ts
2
+ import { SphereGeometry } from "three";
3
+ var BLOB_RADIUS = { x: 0.6, y: 0.56, z: 0.58 };
4
+ var BLOB_HEIGHT = BLOB_RADIUS.y * (1 + 0.62 + (1 - 0.62) * 0.3);
5
+ var ROUND = { shoulders: 1, waist: 1, hips: 1 };
6
+ var bump = (at, centre, spread) => Math.exp(-(((at - centre) / spread) ** 2));
7
+ function silhouetteAt(unitY, silhouette = ROUND) {
8
+ const shoulders = bump(unitY, -0.2, 0.2);
9
+ const waist = bump(unitY, -0.42, 0.12);
10
+ const hips = bump(unitY, -0.58, 0.14);
11
+ const rest = 0.35;
12
+ return (rest + shoulders * silhouette.shoulders + waist * silhouette.waist + hips * silhouette.hips) / (rest + shoulders + waist + hips);
13
+ }
14
+ var BLOB_SEAT = BLOB_RADIUS.y * (0.62 + (1 - 0.62) * 0.3);
15
+ function blobRadiusAt(y, silhouette = ROUND) {
16
+ const unit = Math.max(-0.62, Math.min(1, (y - BLOB_SEAT) / BLOB_RADIUS.y));
17
+ return Math.sqrt(Math.max(0, 1 - unit * unit)) * (1 + 0.16 * -unit) * BLOB_RADIUS.x * silhouetteAt(unit, silhouette);
18
+ }
19
+ function buildBlobGeometry(silhouette = ROUND) {
20
+ const geometry = new SphereGeometry(1, 40, 28);
21
+ const position = geometry.attributes.position;
22
+ let minY = Number.POSITIVE_INFINITY;
23
+ for (let i = 0;i < position.count; i += 1) {
24
+ let y = position.getY(i);
25
+ const spread = (1 + 0.16 * -y) * silhouetteAt(y, silhouette);
26
+ if (y < -0.62)
27
+ y = -0.62 + (y + 0.62) * 0.3;
28
+ position.setXYZ(i, position.getX(i) * spread * BLOB_RADIUS.x, y * BLOB_RADIUS.y, position.getZ(i) * spread * BLOB_RADIUS.z);
29
+ minY = Math.min(minY, y * BLOB_RADIUS.y);
30
+ }
31
+ geometry.translate(0, -minY, 0);
32
+ geometry.computeBoundingBox();
33
+ geometry.computeVertexNormals();
34
+ return geometry;
35
+ }
36
+
37
+ export { BLOB_RADIUS, BLOB_HEIGHT, ROUND, silhouetteAt, BLOB_SEAT, blobRadiusAt, buildBlobGeometry };