@algorisys/tinyfly 0.95.0 → 0.98.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 +8 -8
- package/docs/acting.md +165 -0
- package/docs/character-appearance.md +281 -0
- package/docs/editor-guide.md +14 -6
- package/docs/examples.md +1 -1
- package/docs/getting-started.md +1 -1
- package/docs/gsap-compat.md +1 -1
- package/docs/llm-guide.md +44 -2
- package/docs/maps.md +2 -2
- package/docs/props.md +8 -6
- package/docs/teaching.md +1 -1
- package/lib/addons/characters.js +6266 -4087
- package/lib/browser/tinyfly.iife.js +16 -14
- package/lib/browser/tinyfly.js +8441 -6262
- package/lib/browser/tinyfly.umd.js +16 -14
- package/lib/types/characters/acting/index.d.ts +1 -0
- package/lib/types/characters/acting/surface-script.d.ts +92 -0
- package/lib/types/characters/capabilities.d.ts +20 -0
- package/lib/types/characters/cast.d.ts +284 -0
- package/lib/types/characters/character.d.ts +22 -4
- package/lib/types/characters/chart.d.ts +108 -0
- package/lib/types/characters/code-panel.d.ts +21 -46
- package/lib/types/characters/hands/held-items.d.ts +88 -0
- package/lib/types/characters/hands/index.d.ts +1 -0
- package/lib/types/characters/head/ears.d.ts +10 -0
- package/lib/types/characters/head/facial-hair.d.ts +118 -0
- package/lib/types/characters/head/glasses.d.ts +24 -0
- package/lib/types/characters/head/hair.d.ts +560 -0
- package/lib/types/characters/head/hats.d.ts +58 -0
- package/lib/types/characters/head/head-look.d.ts +53 -0
- package/lib/types/characters/head/index.d.ts +5 -0
- package/lib/types/characters/head/shell.d.ts +64 -0
- package/lib/types/characters/index.d.ts +7 -1
- package/lib/types/characters/interactions.d.ts +69 -0
- package/lib/types/characters/props/families/animals.d.ts +6 -0
- package/lib/types/characters/props/index.d.ts +1 -0
- package/lib/types/characters/props/prop-surface.d.ts +63 -0
- package/lib/types/characters/species/human-motion.d.ts +5 -2
- package/lib/types/characters/species/human.d.ts +111 -4
- package/lib/types/characters/surface/edit-log.d.ts +47 -0
- package/lib/types/characters/surface/index.d.ts +11 -0
- package/lib/types/characters/surface/pieces.d.ts +61 -0
- package/lib/types/characters/surface/ride.d.ts +31 -0
- package/lib/types/characters/surface/surface-box.d.ts +18 -0
- package/lib/types/characters/surface/surface.d.ts +79 -0
- package/lib/types/characters/wardrobe/basic-outfit.d.ts +19 -5
- package/lib/types/characters/whiteboard.d.ts +131 -0
- package/llms-full.txt +625 -28
- package/llms.txt +29 -28
- package/package.json +1 -1
- package/skills/tinyfly/SKILL.md +38 -9
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
import type { SolvedHead } from '../rig/skeleton';
|
|
2
|
+
import type { Pen } from '../look/pen';
|
|
3
|
+
import { type ShellRegion } from './shell';
|
|
4
|
+
/**
|
|
5
|
+
* Hair for the human character, as plain data: a cap of hair on the head
|
|
6
|
+
* (how far it stands off the head, where its hairline runs, its texture),
|
|
7
|
+
* optional length that hangs below the head, and ties (ponytails, buns,
|
|
8
|
+
* braids). Every style is the same handful of numbers, so a style is a
|
|
9
|
+
* preset of them and any field can be changed on its own.
|
|
10
|
+
*
|
|
11
|
+
* Hair is a region on the head's surface (see `shell.ts`), so it turns with
|
|
12
|
+
* the head: the parting and the fringe stay on their own side through a
|
|
13
|
+
* turn, the back view shows the back of the hair, and a ponytail stays tied
|
|
14
|
+
* to the same place. The part facing away is drawn before the head, the part
|
|
15
|
+
* facing the viewer after it.
|
|
16
|
+
*/
|
|
17
|
+
export type HairTexture = 'smooth' | 'spiky' | 'curly' | 'wavy' | 'locs';
|
|
18
|
+
/** Detail lines drawn on the hair: none, a parting, strands swept from a parting, combed back, hanging strands, a few thin strands */
|
|
19
|
+
export type HairStrands = 'none' | 'part' | 'sweep' | 'combed' | 'hanging' | 'thin';
|
|
20
|
+
export interface HairTie {
|
|
21
|
+
kind: 'ponytail' | 'bun' | 'braid';
|
|
22
|
+
/** Where it is tied: on top, high at the back, low at the back, or over one ear (the character's left or right) */
|
|
23
|
+
at: 'top' | 'high' | 'low' | 'left' | 'right';
|
|
24
|
+
/** Ponytails and braids: how far it hangs, head radii (default 1.8) */
|
|
25
|
+
length?: number;
|
|
26
|
+
/** Buns: radius; ponytails and braids: width at the tie, head radii (default 0.32 bun, 0.34 ponytail, 0.2 braid) */
|
|
27
|
+
size?: number;
|
|
28
|
+
}
|
|
29
|
+
/** A hairstyle, every field resolved: plain data, so it can be saved, synced and generated. */
|
|
30
|
+
export interface Hair {
|
|
31
|
+
/** Fill colour (in the silhouette look, the ink) */
|
|
32
|
+
color: string;
|
|
33
|
+
/** How far the hair stands off the head, head radii */
|
|
34
|
+
volume: number;
|
|
35
|
+
/** The hairline's height (head radii, +up from the centre) at the forehead, at the temples and at the nape */
|
|
36
|
+
hairline: {
|
|
37
|
+
front: number;
|
|
38
|
+
side: number;
|
|
39
|
+
back: number;
|
|
40
|
+
};
|
|
41
|
+
/** A side fringe: the hairline drops toward the character's left (+) or right (−) */
|
|
42
|
+
sweep: number;
|
|
43
|
+
/** Temples pushed back (0 none, 0.4 well receded) */
|
|
44
|
+
recede: number;
|
|
45
|
+
/** Long hair: where it ends, head radii below the head's centre (0: short hair) */
|
|
46
|
+
length: number;
|
|
47
|
+
/** Long hair: half the opening it leaves for the face, degrees around from the middle of the face */
|
|
48
|
+
opening: number;
|
|
49
|
+
texture: HairTexture;
|
|
50
|
+
/** How strong the texture is, head radii */
|
|
51
|
+
textureAmount: number;
|
|
52
|
+
/** Volume lifted up and forward over the forehead (a quiff) */
|
|
53
|
+
quiff: number;
|
|
54
|
+
/** A flat top: how far above the crown the flat top sits, head radii (0: round) */
|
|
55
|
+
flat: number;
|
|
56
|
+
/** Where a parting sits, degrees around from the middle of the face toward the character's left (null: none) */
|
|
57
|
+
part: number | null;
|
|
58
|
+
strands: HairStrands;
|
|
59
|
+
/** `solid` filled hair; `stipple` close-cropped hair drawn as dots on the scalp */
|
|
60
|
+
fill: 'solid' | 'stipple';
|
|
61
|
+
ties: HairTie[];
|
|
62
|
+
/** Hair falls over the ears, so the ears are hidden */
|
|
63
|
+
coversEars: boolean;
|
|
64
|
+
}
|
|
65
|
+
/** A hairstyle: a named preset, any fields changed from it. */
|
|
66
|
+
export type HairSpec = Partial<Omit<Hair, 'hairline'>> & {
|
|
67
|
+
style?: HairStyleName;
|
|
68
|
+
hairline?: Partial<Hair['hairline']>;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Ready-made hairstyles: short cuts and hairlines, then medium and long hair.
|
|
72
|
+
* They are starting points, not restrictions: any style suits anyone, and
|
|
73
|
+
* every field can be changed (`{ style: 'bob', length: 1.4 }`).
|
|
74
|
+
*/
|
|
75
|
+
export declare const HAIR_STYLES: {
|
|
76
|
+
bald: {
|
|
77
|
+
volume: number;
|
|
78
|
+
hairline: {
|
|
79
|
+
front: number;
|
|
80
|
+
side: number;
|
|
81
|
+
back: number;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
buzzCut: {
|
|
85
|
+
volume: number;
|
|
86
|
+
fill: "stipple";
|
|
87
|
+
hairline: {
|
|
88
|
+
front: number;
|
|
89
|
+
side: number;
|
|
90
|
+
back: number;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
crewCut: {
|
|
94
|
+
volume: number;
|
|
95
|
+
texture: "spiky";
|
|
96
|
+
textureAmount: number;
|
|
97
|
+
hairline: {
|
|
98
|
+
front: number;
|
|
99
|
+
side: number;
|
|
100
|
+
back: number;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
short: {
|
|
104
|
+
volume: number;
|
|
105
|
+
texture: "spiky";
|
|
106
|
+
textureAmount: number;
|
|
107
|
+
hairline: {
|
|
108
|
+
front: number;
|
|
109
|
+
side: number;
|
|
110
|
+
back: number;
|
|
111
|
+
};
|
|
112
|
+
sweep: number;
|
|
113
|
+
};
|
|
114
|
+
sidePart: {
|
|
115
|
+
volume: number;
|
|
116
|
+
part: number;
|
|
117
|
+
strands: "sweep";
|
|
118
|
+
sweep: number;
|
|
119
|
+
hairline: {
|
|
120
|
+
front: number;
|
|
121
|
+
side: number;
|
|
122
|
+
back: number;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
sideSwept: {
|
|
126
|
+
volume: number;
|
|
127
|
+
part: number;
|
|
128
|
+
strands: "sweep";
|
|
129
|
+
sweep: number;
|
|
130
|
+
hairline: {
|
|
131
|
+
front: number;
|
|
132
|
+
side: number;
|
|
133
|
+
back: number;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
slickBack: {
|
|
137
|
+
volume: number;
|
|
138
|
+
strands: "combed";
|
|
139
|
+
hairline: {
|
|
140
|
+
front: number;
|
|
141
|
+
side: number;
|
|
142
|
+
back: number;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
quiff: {
|
|
146
|
+
volume: number;
|
|
147
|
+
quiff: number;
|
|
148
|
+
strands: "combed";
|
|
149
|
+
hairline: {
|
|
150
|
+
front: number;
|
|
151
|
+
side: number;
|
|
152
|
+
back: number;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
spiky: {
|
|
156
|
+
volume: number;
|
|
157
|
+
texture: "spiky";
|
|
158
|
+
textureAmount: number;
|
|
159
|
+
hairline: {
|
|
160
|
+
front: number;
|
|
161
|
+
side: number;
|
|
162
|
+
back: number;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
undercut: {
|
|
166
|
+
volume: number;
|
|
167
|
+
quiff: number;
|
|
168
|
+
part: number;
|
|
169
|
+
strands: "sweep";
|
|
170
|
+
sweep: number;
|
|
171
|
+
hairline: {
|
|
172
|
+
front: number;
|
|
173
|
+
side: number;
|
|
174
|
+
back: number;
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
curlyCrop: {
|
|
178
|
+
volume: number;
|
|
179
|
+
texture: "curly";
|
|
180
|
+
textureAmount: number;
|
|
181
|
+
hairline: {
|
|
182
|
+
front: number;
|
|
183
|
+
side: number;
|
|
184
|
+
back: number;
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
afro: {
|
|
188
|
+
volume: number;
|
|
189
|
+
texture: "curly";
|
|
190
|
+
textureAmount: number;
|
|
191
|
+
hairline: {
|
|
192
|
+
front: number;
|
|
193
|
+
side: number;
|
|
194
|
+
back: number;
|
|
195
|
+
};
|
|
196
|
+
coversEars: true;
|
|
197
|
+
};
|
|
198
|
+
wavyCrop: {
|
|
199
|
+
volume: number;
|
|
200
|
+
texture: "wavy";
|
|
201
|
+
textureAmount: number;
|
|
202
|
+
part: number;
|
|
203
|
+
hairline: {
|
|
204
|
+
front: number;
|
|
205
|
+
side: number;
|
|
206
|
+
back: number;
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
shortLocs: {
|
|
210
|
+
volume: number;
|
|
211
|
+
texture: "locs";
|
|
212
|
+
textureAmount: number;
|
|
213
|
+
hairline: {
|
|
214
|
+
front: number;
|
|
215
|
+
side: number;
|
|
216
|
+
back: number;
|
|
217
|
+
};
|
|
218
|
+
strands: "hanging";
|
|
219
|
+
coversEars: true;
|
|
220
|
+
};
|
|
221
|
+
flatTop: {
|
|
222
|
+
volume: number;
|
|
223
|
+
flat: number;
|
|
224
|
+
hairline: {
|
|
225
|
+
front: number;
|
|
226
|
+
side: number;
|
|
227
|
+
back: number;
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
receding: {
|
|
231
|
+
volume: number;
|
|
232
|
+
recede: number;
|
|
233
|
+
strands: "thin";
|
|
234
|
+
hairline: {
|
|
235
|
+
front: number;
|
|
236
|
+
side: number;
|
|
237
|
+
back: number;
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
thinning: {
|
|
241
|
+
volume: number;
|
|
242
|
+
strands: "thin";
|
|
243
|
+
hairline: {
|
|
244
|
+
front: number;
|
|
245
|
+
side: number;
|
|
246
|
+
back: number;
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
pixie: {
|
|
250
|
+
volume: number;
|
|
251
|
+
texture: "spiky";
|
|
252
|
+
textureAmount: number;
|
|
253
|
+
sweep: number;
|
|
254
|
+
hairline: {
|
|
255
|
+
front: number;
|
|
256
|
+
side: number;
|
|
257
|
+
back: number;
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
bob: {
|
|
261
|
+
volume: number;
|
|
262
|
+
length: number;
|
|
263
|
+
opening: number;
|
|
264
|
+
sweep: number;
|
|
265
|
+
part: number;
|
|
266
|
+
hairline: {
|
|
267
|
+
front: number;
|
|
268
|
+
side: number;
|
|
269
|
+
back: number;
|
|
270
|
+
};
|
|
271
|
+
coversEars: true;
|
|
272
|
+
};
|
|
273
|
+
longBob: {
|
|
274
|
+
volume: number;
|
|
275
|
+
length: number;
|
|
276
|
+
opening: number;
|
|
277
|
+
part: number;
|
|
278
|
+
strands: "part";
|
|
279
|
+
hairline: {
|
|
280
|
+
front: number;
|
|
281
|
+
side: number;
|
|
282
|
+
back: number;
|
|
283
|
+
};
|
|
284
|
+
coversEars: true;
|
|
285
|
+
};
|
|
286
|
+
wavyBob: {
|
|
287
|
+
volume: number;
|
|
288
|
+
length: number;
|
|
289
|
+
opening: number;
|
|
290
|
+
part: number;
|
|
291
|
+
texture: "wavy";
|
|
292
|
+
textureAmount: number;
|
|
293
|
+
hairline: {
|
|
294
|
+
front: number;
|
|
295
|
+
side: number;
|
|
296
|
+
back: number;
|
|
297
|
+
};
|
|
298
|
+
coversEars: true;
|
|
299
|
+
};
|
|
300
|
+
shoulderStraight: {
|
|
301
|
+
volume: number;
|
|
302
|
+
length: number;
|
|
303
|
+
opening: number;
|
|
304
|
+
part: number;
|
|
305
|
+
strands: "part";
|
|
306
|
+
hairline: {
|
|
307
|
+
front: number;
|
|
308
|
+
side: number;
|
|
309
|
+
back: number;
|
|
310
|
+
};
|
|
311
|
+
coversEars: true;
|
|
312
|
+
};
|
|
313
|
+
shoulderWaves: {
|
|
314
|
+
volume: number;
|
|
315
|
+
length: number;
|
|
316
|
+
opening: number;
|
|
317
|
+
part: number;
|
|
318
|
+
texture: "wavy";
|
|
319
|
+
textureAmount: number;
|
|
320
|
+
hairline: {
|
|
321
|
+
front: number;
|
|
322
|
+
side: number;
|
|
323
|
+
back: number;
|
|
324
|
+
};
|
|
325
|
+
coversEars: true;
|
|
326
|
+
};
|
|
327
|
+
longStraight: {
|
|
328
|
+
volume: number;
|
|
329
|
+
length: number;
|
|
330
|
+
opening: number;
|
|
331
|
+
part: number;
|
|
332
|
+
strands: "hanging";
|
|
333
|
+
hairline: {
|
|
334
|
+
front: number;
|
|
335
|
+
side: number;
|
|
336
|
+
back: number;
|
|
337
|
+
};
|
|
338
|
+
coversEars: true;
|
|
339
|
+
};
|
|
340
|
+
longWaves: {
|
|
341
|
+
volume: number;
|
|
342
|
+
length: number;
|
|
343
|
+
opening: number;
|
|
344
|
+
part: number;
|
|
345
|
+
texture: "wavy";
|
|
346
|
+
textureAmount: number;
|
|
347
|
+
hairline: {
|
|
348
|
+
front: number;
|
|
349
|
+
side: number;
|
|
350
|
+
back: number;
|
|
351
|
+
};
|
|
352
|
+
coversEars: true;
|
|
353
|
+
};
|
|
354
|
+
longCurls: {
|
|
355
|
+
volume: number;
|
|
356
|
+
length: number;
|
|
357
|
+
opening: number;
|
|
358
|
+
texture: "curly";
|
|
359
|
+
textureAmount: number;
|
|
360
|
+
hairline: {
|
|
361
|
+
front: number;
|
|
362
|
+
side: number;
|
|
363
|
+
back: number;
|
|
364
|
+
};
|
|
365
|
+
coversEars: true;
|
|
366
|
+
};
|
|
367
|
+
longLocs: {
|
|
368
|
+
volume: number;
|
|
369
|
+
length: number;
|
|
370
|
+
opening: number;
|
|
371
|
+
texture: "locs";
|
|
372
|
+
textureAmount: number;
|
|
373
|
+
strands: "hanging";
|
|
374
|
+
part: number;
|
|
375
|
+
hairline: {
|
|
376
|
+
front: number;
|
|
377
|
+
side: number;
|
|
378
|
+
back: number;
|
|
379
|
+
};
|
|
380
|
+
coversEars: true;
|
|
381
|
+
};
|
|
382
|
+
lowPonytail: {
|
|
383
|
+
volume: number;
|
|
384
|
+
part: number;
|
|
385
|
+
strands: "combed";
|
|
386
|
+
hairline: {
|
|
387
|
+
front: number;
|
|
388
|
+
side: number;
|
|
389
|
+
back: number;
|
|
390
|
+
};
|
|
391
|
+
ties: {
|
|
392
|
+
kind: "ponytail";
|
|
393
|
+
at: "low";
|
|
394
|
+
length: number;
|
|
395
|
+
}[];
|
|
396
|
+
};
|
|
397
|
+
highPonytail: {
|
|
398
|
+
volume: number;
|
|
399
|
+
part: number;
|
|
400
|
+
strands: "combed";
|
|
401
|
+
hairline: {
|
|
402
|
+
front: number;
|
|
403
|
+
side: number;
|
|
404
|
+
back: number;
|
|
405
|
+
};
|
|
406
|
+
ties: {
|
|
407
|
+
kind: "ponytail";
|
|
408
|
+
at: "high";
|
|
409
|
+
length: number;
|
|
410
|
+
}[];
|
|
411
|
+
};
|
|
412
|
+
ponytail: {
|
|
413
|
+
volume: number;
|
|
414
|
+
sweep: number;
|
|
415
|
+
hairline: {
|
|
416
|
+
front: number;
|
|
417
|
+
side: number;
|
|
418
|
+
back: number;
|
|
419
|
+
};
|
|
420
|
+
ties: {
|
|
421
|
+
kind: "ponytail";
|
|
422
|
+
at: "high";
|
|
423
|
+
length: number;
|
|
424
|
+
}[];
|
|
425
|
+
};
|
|
426
|
+
sidePonytail: {
|
|
427
|
+
volume: number;
|
|
428
|
+
part: number;
|
|
429
|
+
strands: "combed";
|
|
430
|
+
hairline: {
|
|
431
|
+
front: number;
|
|
432
|
+
side: number;
|
|
433
|
+
back: number;
|
|
434
|
+
};
|
|
435
|
+
ties: {
|
|
436
|
+
kind: "ponytail";
|
|
437
|
+
at: "left";
|
|
438
|
+
length: number;
|
|
439
|
+
}[];
|
|
440
|
+
};
|
|
441
|
+
topBun: {
|
|
442
|
+
volume: number;
|
|
443
|
+
part: number;
|
|
444
|
+
strands: "combed";
|
|
445
|
+
hairline: {
|
|
446
|
+
front: number;
|
|
447
|
+
side: number;
|
|
448
|
+
back: number;
|
|
449
|
+
};
|
|
450
|
+
ties: {
|
|
451
|
+
kind: "bun";
|
|
452
|
+
at: "top";
|
|
453
|
+
size: number;
|
|
454
|
+
}[];
|
|
455
|
+
};
|
|
456
|
+
lowBun: {
|
|
457
|
+
volume: number;
|
|
458
|
+
part: number;
|
|
459
|
+
strands: "combed";
|
|
460
|
+
hairline: {
|
|
461
|
+
front: number;
|
|
462
|
+
side: number;
|
|
463
|
+
back: number;
|
|
464
|
+
};
|
|
465
|
+
ties: {
|
|
466
|
+
kind: "bun";
|
|
467
|
+
at: "low";
|
|
468
|
+
size: number;
|
|
469
|
+
}[];
|
|
470
|
+
};
|
|
471
|
+
singleBraid: {
|
|
472
|
+
volume: number;
|
|
473
|
+
part: number;
|
|
474
|
+
strands: "combed";
|
|
475
|
+
hairline: {
|
|
476
|
+
front: number;
|
|
477
|
+
side: number;
|
|
478
|
+
back: number;
|
|
479
|
+
};
|
|
480
|
+
ties: {
|
|
481
|
+
kind: "braid";
|
|
482
|
+
at: "low";
|
|
483
|
+
length: number;
|
|
484
|
+
}[];
|
|
485
|
+
};
|
|
486
|
+
twinBraids: {
|
|
487
|
+
volume: number;
|
|
488
|
+
part: number;
|
|
489
|
+
strands: "part";
|
|
490
|
+
hairline: {
|
|
491
|
+
front: number;
|
|
492
|
+
side: number;
|
|
493
|
+
back: number;
|
|
494
|
+
};
|
|
495
|
+
ties: ({
|
|
496
|
+
kind: "braid";
|
|
497
|
+
at: "left";
|
|
498
|
+
length: number;
|
|
499
|
+
} | {
|
|
500
|
+
kind: "braid";
|
|
501
|
+
at: "right";
|
|
502
|
+
length: number;
|
|
503
|
+
})[];
|
|
504
|
+
coversEars: true;
|
|
505
|
+
};
|
|
506
|
+
braids: {
|
|
507
|
+
volume: number;
|
|
508
|
+
part: number;
|
|
509
|
+
strands: "part";
|
|
510
|
+
hairline: {
|
|
511
|
+
front: number;
|
|
512
|
+
side: number;
|
|
513
|
+
back: number;
|
|
514
|
+
};
|
|
515
|
+
ties: ({
|
|
516
|
+
kind: "braid";
|
|
517
|
+
at: "left";
|
|
518
|
+
length: number;
|
|
519
|
+
} | {
|
|
520
|
+
kind: "braid";
|
|
521
|
+
at: "right";
|
|
522
|
+
length: number;
|
|
523
|
+
})[];
|
|
524
|
+
coversEars: true;
|
|
525
|
+
};
|
|
526
|
+
};
|
|
527
|
+
export type HairStyleName = keyof typeof HAIR_STYLES;
|
|
528
|
+
/** Hair colours that read well against the default ink, by name. */
|
|
529
|
+
export declare const HAIR_COLORS: {
|
|
530
|
+
readonly black: "#22201f";
|
|
531
|
+
readonly brown: "#6b4630";
|
|
532
|
+
readonly chestnut: "#7b4a2b";
|
|
533
|
+
readonly auburn: "#9a4426";
|
|
534
|
+
readonly blond: "#d9b55a";
|
|
535
|
+
readonly ginger: "#c8662f";
|
|
536
|
+
readonly gray: "#a7a29c";
|
|
537
|
+
readonly white: "#ecebe7";
|
|
538
|
+
};
|
|
539
|
+
/** A hairstyle with every field filled in (a style name, or a style and changes). */
|
|
540
|
+
export declare function resolveHair(spec: HairSpec | HairStyleName): Hair;
|
|
541
|
+
/** The hairline's height at a place around the head. */
|
|
542
|
+
export declare function hairlineAt(hair: Hair, around: number): number;
|
|
543
|
+
/**
|
|
544
|
+
* The hair as a region on the head. `pad` (head radii) lifts it clear of
|
|
545
|
+
* the head's own outline, so a thick head line never shows through it.
|
|
546
|
+
*/
|
|
547
|
+
export declare function hairRegion(hair: Hair, pad: number): ShellRegion;
|
|
548
|
+
export interface HairDrawOptions {
|
|
549
|
+
/** The character's line width, px */
|
|
550
|
+
lineWidth: number;
|
|
551
|
+
/** Skin colour, for the scalp under close-cropped hair */
|
|
552
|
+
skin: string;
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* The hair behind the head: the part facing away, and ties on the far side.
|
|
556
|
+
* Drawn before the body, so long hair hangs behind the shoulders.
|
|
557
|
+
*/
|
|
558
|
+
export declare function drawHairBehind(pen: Pen, ctx: CanvasRenderingContext2D, head: SolvedHead, hair: Hair, options: HairDrawOptions): void;
|
|
559
|
+
/** The hair over the head: the part facing the viewer, its detail lines, and near ties. */
|
|
560
|
+
export declare function drawHairFront(pen: Pen, head: SolvedHead, hair: Hair, options: HairDrawOptions): void;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { SolvedHead } from '../rig/skeleton';
|
|
2
|
+
import type { Pen } from '../look/pen';
|
|
3
|
+
/**
|
|
4
|
+
* Hats: a crown that fits over the head (and the hair under it) and a brim,
|
|
5
|
+
* a peak at the front for a cap or a ring all round. The crown is a region on
|
|
6
|
+
* a slightly larger head, so it turns with the head; the brim is a ring of
|
|
7
|
+
* points around it, drawn first so the crown sits on it. Hair under the hat is
|
|
8
|
+
* covered by it; hair below the brim still shows.
|
|
9
|
+
*/
|
|
10
|
+
export type HatStyle = 'cap' | 'beanie' | 'hardHat' | 'sunHat' | 'bowler';
|
|
11
|
+
export interface Hat {
|
|
12
|
+
style: HatStyle;
|
|
13
|
+
color: string;
|
|
14
|
+
}
|
|
15
|
+
export type HatSpec = Partial<Hat>;
|
|
16
|
+
export declare const HAT_STYLES: {
|
|
17
|
+
cap: {
|
|
18
|
+
color: string;
|
|
19
|
+
brim: [number, number];
|
|
20
|
+
height: number;
|
|
21
|
+
peak: number;
|
|
22
|
+
detail: "seams";
|
|
23
|
+
};
|
|
24
|
+
beanie: {
|
|
25
|
+
color: string;
|
|
26
|
+
brim: [number, number];
|
|
27
|
+
height: number;
|
|
28
|
+
detail: "fold";
|
|
29
|
+
};
|
|
30
|
+
hardHat: {
|
|
31
|
+
color: string;
|
|
32
|
+
brim: [number, number];
|
|
33
|
+
height: number;
|
|
34
|
+
ring: number;
|
|
35
|
+
detail: "ridge";
|
|
36
|
+
};
|
|
37
|
+
sunHat: {
|
|
38
|
+
color: string;
|
|
39
|
+
brim: [number, number];
|
|
40
|
+
height: number;
|
|
41
|
+
ring: number;
|
|
42
|
+
detail: "band";
|
|
43
|
+
};
|
|
44
|
+
bowler: {
|
|
45
|
+
color: string;
|
|
46
|
+
brim: [number, number];
|
|
47
|
+
height: number;
|
|
48
|
+
ring: number;
|
|
49
|
+
detail: "band";
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export declare function resolveHat(spec: HatSpec | HatStyle): Hat;
|
|
53
|
+
export interface HatDrawOptions {
|
|
54
|
+
lineWidth: number;
|
|
55
|
+
/** How far the hair under the hat stands off the head, head radii */
|
|
56
|
+
hairVolume: number;
|
|
57
|
+
}
|
|
58
|
+
export declare function drawHat(pen: Pen, head: SolvedHead, hat: Hat, options: HatDrawOptions): void;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Pose } from '../rig/body-plan';
|
|
2
|
+
import type { SolvedHead } from '../rig/skeleton';
|
|
3
|
+
import type { Pen } from '../look/pen';
|
|
4
|
+
import { type Hair, type HairSpec, type HairStyleName } from './hair';
|
|
5
|
+
import { type FacialHair, type FacialHairSpec, type FacialHairStyleName } from './facial-hair';
|
|
6
|
+
import { type Glasses, type GlassesSpec, type GlassesStyle } from './glasses';
|
|
7
|
+
import { type Hat, type HatSpec, type HatStyle } from './hats';
|
|
8
|
+
/**
|
|
9
|
+
* Everything on a character's head besides the face: hair, ears, facial
|
|
10
|
+
* hair, glasses and a hat. It is plain data, resolved once when the
|
|
11
|
+
* character is made (so a saved character keeps its look even if a preset
|
|
12
|
+
* changes), and drawn in passes around the body:
|
|
13
|
+
*
|
|
14
|
+
* - behind: before the body, the parts facing away (long hair down the back,
|
|
15
|
+
* ears seen from the front, a ponytail behind the head);
|
|
16
|
+
* - front: with the head, after its outline: ears, hair, beard, then the
|
|
17
|
+
* face, then the moustache, glasses and hat over it;
|
|
18
|
+
* - over: after the whole body, the hair and hat when the head is turned
|
|
19
|
+
* away, since they are then the nearest things to the viewer.
|
|
20
|
+
*
|
|
21
|
+
* Which part wins where two overlap is fixed by that order: the face's eyes
|
|
22
|
+
* and brows draw over a fringe, the mouth over a beard (which leaves an
|
|
23
|
+
* opening for it), a moustache over the mouth's top, and a hat over the hair.
|
|
24
|
+
*/
|
|
25
|
+
export interface HeadLookOptions {
|
|
26
|
+
/** Hair: a style name, a style with changes (`{ style: 'bob', color: '#9a4426' }`), or null for none (the default) */
|
|
27
|
+
hair?: HairSpec | HairStyleName | null;
|
|
28
|
+
/** Facial hair: a style name (`'fullBeard'`), or `{ moustache, beard, color }` (default none) */
|
|
29
|
+
facialHair?: FacialHairSpec | FacialHairStyleName | null;
|
|
30
|
+
/** Glasses: `'round'`, `'square'` or `'sunglasses'` (default none) */
|
|
31
|
+
glasses?: GlassesSpec | GlassesStyle | null;
|
|
32
|
+
/** A hat: `'cap'`, `'beanie'`, `'hardHat'`, `'sunHat'`, `'bowler'`, or `{ style, color }` (default none) */
|
|
33
|
+
hat?: HatSpec | HatStyle | null;
|
|
34
|
+
/** Draw ears (default false: the plain figure has none) */
|
|
35
|
+
ears?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface HeadLook {
|
|
38
|
+
hair: Hair | null;
|
|
39
|
+
facialHair: FacialHair | null;
|
|
40
|
+
glasses: Glasses | null;
|
|
41
|
+
hat: Hat | null;
|
|
42
|
+
ears: boolean;
|
|
43
|
+
}
|
|
44
|
+
export declare function resolveHeadLook(options: HeadLookOptions): HeadLook;
|
|
45
|
+
export interface HeadDrawOptions {
|
|
46
|
+
lineWidth: number;
|
|
47
|
+
skin: string;
|
|
48
|
+
}
|
|
49
|
+
export declare function drawHeadBehind(ctx: CanvasRenderingContext2D, pen: Pen, look: HeadLook, head: SolvedHead, _pose: Pose, options: HeadDrawOptions): void;
|
|
50
|
+
/** The head's front pass; `drawFace` draws the face at its place in the order. */
|
|
51
|
+
export declare function drawHeadFront(_ctx: CanvasRenderingContext2D, pen: Pen, look: HeadLook, head: SolvedHead, pose: Pose, options: HeadDrawOptions, drawFace: () => void): void;
|
|
52
|
+
/** After the whole figure: the hair and hat, when the head is turned away. */
|
|
53
|
+
export declare function drawHeadOver(_ctx: CanvasRenderingContext2D, pen: Pen, look: HeadLook, head: SolvedHead, _pose: Pose, options: HeadDrawOptions): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { HAIR_STYLES, HAIR_COLORS, resolveHair, hairlineAt, type Hair, type HairSpec, type HairStyleName, type HairTexture, type HairStrands, type HairTie } from './hair';
|
|
2
|
+
export { FACIAL_HAIR_STYLES, resolveFacialHair, type FacialHair, type FacialHairSpec, type FacialHairStyleName, type MoustacheStyle, type BeardStyle } from './facial-hair';
|
|
3
|
+
export { GLASSES_STYLES, resolveGlasses, type Glasses, type GlassesSpec, type GlassesStyle } from './glasses';
|
|
4
|
+
export { HAT_STYLES, resolveHat, type Hat, type HatSpec, type HatStyle } from './hats';
|
|
5
|
+
export { resolveHeadLook, type HeadLook, type HeadLookOptions } from './head-look';
|