@algorisys/tinyfly 0.97.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 +7 -7
- 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 +21 -1
- package/docs/maps.md +2 -2
- package/docs/props.md +8 -6
- package/docs/teaching.md +1 -1
- package/lib/addons/characters.js +5720 -4476
- package/lib/browser/tinyfly.iife.js +15 -15
- package/lib/browser/tinyfly.js +7928 -6684
- package/lib/browser/tinyfly.umd.js +15 -15
- package/lib/types/characters/capabilities.d.ts +15 -0
- package/lib/types/characters/cast.d.ts +284 -0
- package/lib/types/characters/character.d.ts +22 -4
- 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 +4 -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/species/human-motion.d.ts +5 -2
- package/lib/types/characters/species/human.d.ts +111 -4
- package/lib/types/characters/wardrobe/basic-outfit.d.ts +19 -5
- package/llms-full.txt +355 -27
- package/llms.txt +29 -28
- package/package.json +1 -1
- package/skills/tinyfly/SKILL.md +10 -1
|
@@ -62,6 +62,21 @@ export interface Capabilities {
|
|
|
62
62
|
poses: string[];
|
|
63
63
|
expressions: string[];
|
|
64
64
|
gags: string[];
|
|
65
|
+
/** `build` option */
|
|
66
|
+
builds: string[];
|
|
67
|
+
/** `hair` option (`{ style, color, length, … }` changes any field) */
|
|
68
|
+
hair: string[];
|
|
69
|
+
hairColors: Record<string, string>;
|
|
70
|
+
/** `facialHair` option */
|
|
71
|
+
facialHair: string[];
|
|
72
|
+
glasses: string[];
|
|
73
|
+
hats: string[];
|
|
74
|
+
/** `castMember(name, height)` */
|
|
75
|
+
cast: string[];
|
|
76
|
+
/** `holding: { left | right | both: item }`, and which hands each takes */
|
|
77
|
+
heldItems: Record<string, string>;
|
|
78
|
+
/** `meetHands(kind, a, b)` */
|
|
79
|
+
handMeetings: string[];
|
|
65
80
|
};
|
|
66
81
|
codePanel: {
|
|
67
82
|
languages: readonly string[];
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import type { CharacterOptions } from './character';
|
|
2
|
+
/**
|
|
3
|
+
* A ready-made recurring cast: a family of characters a viewer can tell
|
|
4
|
+
* apart at a glance, by build, hair, facial hair, glasses and clothes. Each
|
|
5
|
+
* member is plain character options (no height: `scale` is how tall they
|
|
6
|
+
* stand next to an adult), so it can be saved, changed field by field, or
|
|
7
|
+
* given any pose, expression or action.
|
|
8
|
+
*
|
|
9
|
+
* These are starting points from the age-and-cast reference sheet, not rules:
|
|
10
|
+
* any hairstyle, build or outfit suits anyone, and age is shown by hair and
|
|
11
|
+
* proportions, never by a stoop or a walking aid unless one is chosen.
|
|
12
|
+
*/
|
|
13
|
+
export interface CastMember {
|
|
14
|
+
/** What to call them in a picker */
|
|
15
|
+
label: string;
|
|
16
|
+
/** `family` (ages and looks) or `work` (dressed for a job, from the occupations sheet) */
|
|
17
|
+
group: 'family' | 'work';
|
|
18
|
+
/** Height next to an adult (1) */
|
|
19
|
+
scale: number;
|
|
20
|
+
/** Everything else about them */
|
|
21
|
+
options: Omit<CharacterOptions, 'height'>;
|
|
22
|
+
}
|
|
23
|
+
export declare const CHARACTER_CAST: {
|
|
24
|
+
boy: {
|
|
25
|
+
label: string;
|
|
26
|
+
group: "family";
|
|
27
|
+
scale: number;
|
|
28
|
+
options: {
|
|
29
|
+
build: "child";
|
|
30
|
+
hair: "short";
|
|
31
|
+
ears: true;
|
|
32
|
+
outfit: {
|
|
33
|
+
shirt: string;
|
|
34
|
+
trousers: string;
|
|
35
|
+
bottom: "shorts";
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
girl: {
|
|
40
|
+
label: string;
|
|
41
|
+
group: "family";
|
|
42
|
+
scale: number;
|
|
43
|
+
options: {
|
|
44
|
+
build: "child";
|
|
45
|
+
hair: {
|
|
46
|
+
style: "bob";
|
|
47
|
+
color: "#7b4a2b";
|
|
48
|
+
};
|
|
49
|
+
ears: true;
|
|
50
|
+
outfit: {
|
|
51
|
+
shirt: string;
|
|
52
|
+
trousers: string;
|
|
53
|
+
bottom: "skirt";
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
youngMan: {
|
|
58
|
+
label: string;
|
|
59
|
+
group: "family";
|
|
60
|
+
scale: number;
|
|
61
|
+
options: {
|
|
62
|
+
build: "tall";
|
|
63
|
+
hair: "spiky";
|
|
64
|
+
ears: true;
|
|
65
|
+
outfit: {
|
|
66
|
+
shirt: string;
|
|
67
|
+
trousers: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
youngWoman: {
|
|
72
|
+
label: string;
|
|
73
|
+
group: "family";
|
|
74
|
+
scale: number;
|
|
75
|
+
options: {
|
|
76
|
+
build: "slim";
|
|
77
|
+
hair: {
|
|
78
|
+
style: "highPonytail";
|
|
79
|
+
color: "#9a4426";
|
|
80
|
+
};
|
|
81
|
+
ears: true;
|
|
82
|
+
outfit: {
|
|
83
|
+
shirt: string;
|
|
84
|
+
trousers: string;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
man: {
|
|
89
|
+
label: string;
|
|
90
|
+
group: "family";
|
|
91
|
+
scale: number;
|
|
92
|
+
options: {
|
|
93
|
+
build: "broad";
|
|
94
|
+
hair: "sidePart";
|
|
95
|
+
facialHair: "chevron";
|
|
96
|
+
ears: true;
|
|
97
|
+
outfit: {
|
|
98
|
+
shirt: string;
|
|
99
|
+
trousers: string;
|
|
100
|
+
sleeves: "long";
|
|
101
|
+
collar: true;
|
|
102
|
+
tie: string;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
woman: {
|
|
107
|
+
label: string;
|
|
108
|
+
group: "family";
|
|
109
|
+
scale: number;
|
|
110
|
+
options: {
|
|
111
|
+
build: "curvy";
|
|
112
|
+
hair: {
|
|
113
|
+
style: "shoulderWaves";
|
|
114
|
+
color: "#22201f";
|
|
115
|
+
};
|
|
116
|
+
ears: true;
|
|
117
|
+
outfit: {
|
|
118
|
+
shirt: string;
|
|
119
|
+
trousers: string;
|
|
120
|
+
sleeves: "long";
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
grandpa: {
|
|
125
|
+
label: string;
|
|
126
|
+
group: "family";
|
|
127
|
+
scale: number;
|
|
128
|
+
options: {
|
|
129
|
+
build: "stocky";
|
|
130
|
+
hair: {
|
|
131
|
+
style: "receding";
|
|
132
|
+
color: "#a7a29c";
|
|
133
|
+
};
|
|
134
|
+
facialHair: {
|
|
135
|
+
style: "shortBoxed";
|
|
136
|
+
color: "#ecebe7";
|
|
137
|
+
};
|
|
138
|
+
glasses: "square";
|
|
139
|
+
ears: true;
|
|
140
|
+
outfit: {
|
|
141
|
+
shirt: string;
|
|
142
|
+
trousers: string;
|
|
143
|
+
sleeves: "long";
|
|
144
|
+
collar: true;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
grandma: {
|
|
149
|
+
label: string;
|
|
150
|
+
group: "family";
|
|
151
|
+
scale: number;
|
|
152
|
+
options: {
|
|
153
|
+
build: "short";
|
|
154
|
+
hair: {
|
|
155
|
+
style: "topBun";
|
|
156
|
+
color: "#ecebe7";
|
|
157
|
+
};
|
|
158
|
+
glasses: "round";
|
|
159
|
+
ears: true;
|
|
160
|
+
outfit: {
|
|
161
|
+
shirt: string;
|
|
162
|
+
trousers: string;
|
|
163
|
+
sleeves: "long";
|
|
164
|
+
bottom: "skirt";
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
doctor: {
|
|
169
|
+
label: string;
|
|
170
|
+
group: "work";
|
|
171
|
+
scale: number;
|
|
172
|
+
options: {
|
|
173
|
+
build: "slim";
|
|
174
|
+
hair: {
|
|
175
|
+
style: "lowPonytail";
|
|
176
|
+
color: "#22201f";
|
|
177
|
+
};
|
|
178
|
+
ears: true;
|
|
179
|
+
outfit: {
|
|
180
|
+
shirt: string;
|
|
181
|
+
trousers: string;
|
|
182
|
+
over: "labCoat";
|
|
183
|
+
collar: true;
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
cook: {
|
|
188
|
+
label: string;
|
|
189
|
+
group: "work";
|
|
190
|
+
scale: number;
|
|
191
|
+
options: {
|
|
192
|
+
build: "stocky";
|
|
193
|
+
hair: "crewCut";
|
|
194
|
+
facialHair: "shortMoustache";
|
|
195
|
+
ears: true;
|
|
196
|
+
outfit: {
|
|
197
|
+
shirt: string;
|
|
198
|
+
trousers: string;
|
|
199
|
+
sleeves: "long";
|
|
200
|
+
over: "apron";
|
|
201
|
+
overColor: string;
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
builder: {
|
|
206
|
+
label: string;
|
|
207
|
+
group: "work";
|
|
208
|
+
scale: number;
|
|
209
|
+
options: {
|
|
210
|
+
build: "broad";
|
|
211
|
+
hair: "short";
|
|
212
|
+
facialHair: "stubble";
|
|
213
|
+
hat: "hardHat";
|
|
214
|
+
ears: true;
|
|
215
|
+
outfit: {
|
|
216
|
+
shirt: string;
|
|
217
|
+
trousers: string;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
courier: {
|
|
222
|
+
label: string;
|
|
223
|
+
group: "work";
|
|
224
|
+
scale: number;
|
|
225
|
+
options: {
|
|
226
|
+
build: "standard";
|
|
227
|
+
hair: "short";
|
|
228
|
+
hat: {
|
|
229
|
+
style: "cap";
|
|
230
|
+
color: string;
|
|
231
|
+
};
|
|
232
|
+
ears: true;
|
|
233
|
+
outfit: {
|
|
234
|
+
shirt: string;
|
|
235
|
+
trousers: string;
|
|
236
|
+
bottom: "shorts";
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
teacher: {
|
|
241
|
+
label: string;
|
|
242
|
+
group: "work";
|
|
243
|
+
scale: number;
|
|
244
|
+
options: {
|
|
245
|
+
build: "tall";
|
|
246
|
+
hair: "slickBack";
|
|
247
|
+
glasses: "square";
|
|
248
|
+
ears: true;
|
|
249
|
+
outfit: {
|
|
250
|
+
shirt: string;
|
|
251
|
+
trousers: string;
|
|
252
|
+
sleeves: "long";
|
|
253
|
+
collar: true;
|
|
254
|
+
tie: string;
|
|
255
|
+
};
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
farmer: {
|
|
259
|
+
label: string;
|
|
260
|
+
group: "work";
|
|
261
|
+
scale: number;
|
|
262
|
+
options: {
|
|
263
|
+
build: "stocky";
|
|
264
|
+
hair: {
|
|
265
|
+
style: "shoulderStraight";
|
|
266
|
+
color: "#d9b55a";
|
|
267
|
+
};
|
|
268
|
+
hat: "sunHat";
|
|
269
|
+
ears: true;
|
|
270
|
+
outfit: {
|
|
271
|
+
shirt: string;
|
|
272
|
+
trousers: string;
|
|
273
|
+
sleeves: "long";
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
export type CastName = keyof typeof CHARACTER_CAST;
|
|
279
|
+
/**
|
|
280
|
+
* Character options for a cast member at an adult `height` (px; they stand
|
|
281
|
+
* at their own scale of it), with any options changed: `castMember('grandpa',
|
|
282
|
+
* 300, { look: 'pencil' })`.
|
|
283
|
+
*/
|
|
284
|
+
export declare function castMember(name: CastName, height?: number, changes?: Partial<CharacterOptions>): CharacterOptions;
|
|
@@ -5,7 +5,10 @@ import type { FrameInfo } from '../headless/video-scene';
|
|
|
5
5
|
import type { BodyPlan, Pose, Vec3 } from './rig/body-plan';
|
|
6
6
|
import { type SolvedHead, type ViewProjection } from './rig/skeleton';
|
|
7
7
|
import { type Look, type Pen, type PencilOptions } from './look/pen';
|
|
8
|
-
import { type
|
|
8
|
+
import { type HeadLook, type HeadLookOptions } from './head/head-look';
|
|
9
|
+
import { type HumanBuildName, type HumanPoseName } from './species/human';
|
|
10
|
+
import { type BasicOutfitOptions } from './wardrobe/basic-outfit';
|
|
11
|
+
import { type Holding, type HoldingSpec } from './hands/held-items';
|
|
9
12
|
import { type HandPose } from './hands/hand-rig';
|
|
10
13
|
/**
|
|
11
14
|
* Characters (v2): any body plan, posed by numbers, turned in 3D, drawn flat
|
|
@@ -19,9 +22,10 @@ export type FigureStyle = 'fluid' | 'stick';
|
|
|
19
22
|
/**
|
|
20
23
|
* Draws part of a character: clothes, hair, a prop. The context is in the
|
|
21
24
|
* character's drawing space (feet at 0, 0), saved and restored around the
|
|
22
|
-
* call. Draw with `pen` so it matches the look.
|
|
25
|
+
* call. Draw with `pen` so it matches the look. `pose` is the full pose being
|
|
26
|
+
* drawn (for a layer that a pose field switches, like a held item's `held.*`).
|
|
23
27
|
*/
|
|
24
|
-
export type CharacterLayer = (ctx: CanvasRenderingContext2D, joints: CharacterJoints, pen: Pen, time: number) => void;
|
|
28
|
+
export type CharacterLayer = (ctx: CanvasRenderingContext2D, joints: CharacterJoints, pen: Pen, time: number, pose?: Pose) => void;
|
|
25
29
|
export interface CharacterLayers {
|
|
26
30
|
/** Before anything (a shadow, a cape) */
|
|
27
31
|
behind?: CharacterLayer;
|
|
@@ -33,9 +37,19 @@ export interface CharacterLayers {
|
|
|
33
37
|
/** After everything (a prop in front) */
|
|
34
38
|
front?: CharacterLayer;
|
|
35
39
|
}
|
|
36
|
-
export interface CharacterOptions {
|
|
40
|
+
export interface CharacterOptions extends HeadLookOptions {
|
|
37
41
|
/** Body plan (default: human, built from the options below) */
|
|
38
42
|
plan?: BodyPlan;
|
|
43
|
+
/** A named build (`child`, `tall`, `broad`…; see HUMAN_BUILDS): its proportions, unless the options below set them */
|
|
44
|
+
build?: HumanBuildName;
|
|
45
|
+
/** Leg length, as a share of the standard (default 1) */
|
|
46
|
+
legLength?: number;
|
|
47
|
+
/** Arm length, as a share of the standard (default 1) */
|
|
48
|
+
armLength?: number;
|
|
49
|
+
/** A T-shirt and trousers in these colours (see basicOutfit), as data; drawn under any `layers` */
|
|
50
|
+
outfit?: BasicOutfitOptions | null;
|
|
51
|
+
/** What each hand holds (`{ right: 'mug' }`, `{ both: 'parcel' }`); a pose field `held.<side>` below 0.5 lets go */
|
|
52
|
+
holding?: HoldingSpec | null;
|
|
39
53
|
figure?: FigureStyle;
|
|
40
54
|
look?: Look;
|
|
41
55
|
/** Feet to top of head, px (default 300) */
|
|
@@ -92,6 +106,10 @@ export interface Character {
|
|
|
92
106
|
hands: 'dot' | 'cartoon';
|
|
93
107
|
handStyle: 'glove' | 'natural';
|
|
94
108
|
handSize: number;
|
|
109
|
+
/** Hair, facial hair, glasses, a hat and ears: every choice spelled out, so a saved character never changes when a preset does */
|
|
110
|
+
head: HeadLook;
|
|
111
|
+
/** What each hand holds (drawn by its layers) */
|
|
112
|
+
holding: Holding;
|
|
95
113
|
}
|
|
96
114
|
export declare function character(options?: CharacterOptions): Character;
|
|
97
115
|
/** Where every part of a character is, as drawn, in its drawing space (feet at 0, 0; up is -y). */
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { Point } from '../../adapters/canvas/sketch';
|
|
2
|
+
import type { CharacterJoints, CharacterLayers } from '../character';
|
|
3
|
+
import type { Pose } from '../rig/body-plan';
|
|
4
|
+
import type { Pen } from '../look/pen';
|
|
5
|
+
/**
|
|
6
|
+
* Things a character holds: a mug, a phone, a book, bags, an umbrella, a
|
|
7
|
+
* broom, a parcel. Each is plain data (`holding: { right: 'mug' }`) drawn at
|
|
8
|
+
* the hand's grip, so it follows the hand through any pose, gait or turn, and
|
|
9
|
+
* sorts with that arm (behind the body when the arm is). An item held in
|
|
10
|
+
* `both` hands sits between them.
|
|
11
|
+
*
|
|
12
|
+
* Whether an item shows is a pose field, `held.left`, `held.right` or
|
|
13
|
+
* `held.both` (shown unless it is below 0.5), so a track can let go of it: a
|
|
14
|
+
* parcel handed over is the giver's `held.both` going to 0 at the moment the
|
|
15
|
+
* taker's goes to 1, with their hands meeting there (see `meetHands`).
|
|
16
|
+
* `handGrip` gives the grip for drawing anything else in a hand.
|
|
17
|
+
*/
|
|
18
|
+
export type HeldItemName = 'mug' | 'phone' | 'book' | 'bag' | 'briefcase' | 'umbrella' | 'broom' | 'parcel';
|
|
19
|
+
export interface HeldItem {
|
|
20
|
+
item: HeldItemName;
|
|
21
|
+
/** Main colour (each item has its own default) */
|
|
22
|
+
color: string;
|
|
23
|
+
}
|
|
24
|
+
export type HeldItemSpec = HeldItemName | Partial<HeldItem> & {
|
|
25
|
+
item: HeldItemName;
|
|
26
|
+
};
|
|
27
|
+
export type HoldingSide = 'left' | 'right' | 'both';
|
|
28
|
+
/** What each hand holds, every choice spelled out. */
|
|
29
|
+
export type Holding = Partial<Record<HoldingSide, HeldItem>>;
|
|
30
|
+
export type HoldingSpec = Partial<Record<HoldingSide, HeldItemSpec>>;
|
|
31
|
+
/** Every item, with its default colour and the hands it takes. */
|
|
32
|
+
export declare const HELD_ITEMS: {
|
|
33
|
+
mug: {
|
|
34
|
+
color: string;
|
|
35
|
+
hands: "one";
|
|
36
|
+
};
|
|
37
|
+
phone: {
|
|
38
|
+
color: string;
|
|
39
|
+
hands: "one";
|
|
40
|
+
};
|
|
41
|
+
book: {
|
|
42
|
+
color: string;
|
|
43
|
+
hands: "either";
|
|
44
|
+
};
|
|
45
|
+
bag: {
|
|
46
|
+
color: string;
|
|
47
|
+
hands: "one";
|
|
48
|
+
};
|
|
49
|
+
briefcase: {
|
|
50
|
+
color: string;
|
|
51
|
+
hands: "one";
|
|
52
|
+
};
|
|
53
|
+
umbrella: {
|
|
54
|
+
color: string;
|
|
55
|
+
hands: "one";
|
|
56
|
+
};
|
|
57
|
+
broom: {
|
|
58
|
+
color: string;
|
|
59
|
+
hands: "one";
|
|
60
|
+
};
|
|
61
|
+
parcel: {
|
|
62
|
+
color: string;
|
|
63
|
+
hands: "both";
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export declare function resolveHolding(spec: HoldingSpec): Holding;
|
|
67
|
+
/** Where a hand grips, on the screen: the point, the forearm's direction and its depth toward the viewer. */
|
|
68
|
+
export interface Grip {
|
|
69
|
+
point: Point;
|
|
70
|
+
/** Unit vector along the forearm, elbow to hand */
|
|
71
|
+
along: Point;
|
|
72
|
+
/** Depth toward the viewer (px), to sort with the body */
|
|
73
|
+
depth: number;
|
|
74
|
+
}
|
|
75
|
+
/** A hand's grip from a character's joints (drawing space; see `characterJoints`). */
|
|
76
|
+
export declare function handGrip(joints: CharacterJoints, side: 'left' | 'right'): Grip;
|
|
77
|
+
/**
|
|
78
|
+
* Draw an item held at a grip. `H` is the character's height (sizes follow
|
|
79
|
+
* it), `outline` the line width for its edges; `facing` (-1..1) is which way
|
|
80
|
+
* the character faces across the screen, for items with a front (a mug's
|
|
81
|
+
* handle, a broom's sweep); `headTop` (screen y of the top of the head) lifts
|
|
82
|
+
* an umbrella's canopy clear of the head.
|
|
83
|
+
*/
|
|
84
|
+
export declare function drawHeldItem(pen: Pen, held: HeldItem, grip: Grip, H: number, outline: number, facing?: number, headTop?: number): void;
|
|
85
|
+
/** Is a held item showing in this pose? (`held.<side>`, shown unless below 0.5) */
|
|
86
|
+
export declare const isHeld: (pose: Pose, side: HoldingSide) => boolean;
|
|
87
|
+
/** Layers that draw what a character holds, shown or hidden by the pose's `held.*` fields. */
|
|
88
|
+
export declare function holdingLayers(holding: Holding): CharacterLayers;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SolvedHead } from '../rig/skeleton';
|
|
2
|
+
import type { Pen } from '../look/pen';
|
|
3
|
+
export interface EarDrawOptions {
|
|
4
|
+
lineWidth: number;
|
|
5
|
+
skin: string;
|
|
6
|
+
}
|
|
7
|
+
/** Ears facing away or edge-on: behind the head. */
|
|
8
|
+
export declare function drawEarsBehind(pen: Pen, ctx: CanvasRenderingContext2D, head: SolvedHead, options: EarDrawOptions): void;
|
|
9
|
+
/** Ears turned toward the viewer: on the head. */
|
|
10
|
+
export declare function drawEarsFront(pen: Pen, head: SolvedHead, options: EarDrawOptions): void;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { SolvedHead } from '../rig/skeleton';
|
|
2
|
+
import type { Pen } from '../look/pen';
|
|
3
|
+
import { type ShellRegion } from './shell';
|
|
4
|
+
/**
|
|
5
|
+
* Facial hair: a moustache and a beard, chosen separately. A beard is a
|
|
6
|
+
* region on the head's surface (it follows the jaw round in a turn and shows
|
|
7
|
+
* its own outline in profile); a moustache sits on the face, placed like the
|
|
8
|
+
* mouth, so it stays over the mouth however the face slides in a turn. A
|
|
9
|
+
* beard that covers the mouth leaves an opening in the skin colour, so the
|
|
10
|
+
* mouth and every lip-sync shape stay readable.
|
|
11
|
+
*/
|
|
12
|
+
export type MoustacheStyle = 'none' | 'pencil' | 'short' | 'chevron' | 'handlebar' | 'walrus';
|
|
13
|
+
export type BeardStyle = 'none' | 'stubble' | 'goatee' | 'soulPatch' | 'chinStrap' | 'circle' | 'boxed' | 'full' | 'rounded' | 'pointed' | 'long' | 'sideburns' | 'muttonChops';
|
|
14
|
+
export interface FacialHair {
|
|
15
|
+
/** Fill colour (default: the hair's, else brown) */
|
|
16
|
+
color: string;
|
|
17
|
+
moustache: MoustacheStyle;
|
|
18
|
+
beard: BeardStyle;
|
|
19
|
+
}
|
|
20
|
+
export type FacialHairSpec = Partial<FacialHair> & {
|
|
21
|
+
style?: FacialHairStyleName;
|
|
22
|
+
};
|
|
23
|
+
/** The combinations on the facial-hair reference sheet, by name. */
|
|
24
|
+
export declare const FACIAL_HAIR_STYLES: {
|
|
25
|
+
cleanShaven: {
|
|
26
|
+
moustache: "none";
|
|
27
|
+
beard: "none";
|
|
28
|
+
};
|
|
29
|
+
stubble: {
|
|
30
|
+
moustache: "none";
|
|
31
|
+
beard: "stubble";
|
|
32
|
+
};
|
|
33
|
+
pencilMoustache: {
|
|
34
|
+
moustache: "pencil";
|
|
35
|
+
beard: "none";
|
|
36
|
+
};
|
|
37
|
+
shortMoustache: {
|
|
38
|
+
moustache: "short";
|
|
39
|
+
beard: "none";
|
|
40
|
+
};
|
|
41
|
+
chevron: {
|
|
42
|
+
moustache: "chevron";
|
|
43
|
+
beard: "none";
|
|
44
|
+
};
|
|
45
|
+
handlebar: {
|
|
46
|
+
moustache: "handlebar";
|
|
47
|
+
beard: "none";
|
|
48
|
+
};
|
|
49
|
+
walrus: {
|
|
50
|
+
moustache: "walrus";
|
|
51
|
+
beard: "none";
|
|
52
|
+
};
|
|
53
|
+
goatee: {
|
|
54
|
+
moustache: "none";
|
|
55
|
+
beard: "goatee";
|
|
56
|
+
};
|
|
57
|
+
vanDyke: {
|
|
58
|
+
moustache: "chevron";
|
|
59
|
+
beard: "goatee";
|
|
60
|
+
};
|
|
61
|
+
circleBeard: {
|
|
62
|
+
moustache: "short";
|
|
63
|
+
beard: "circle";
|
|
64
|
+
};
|
|
65
|
+
shortBoxed: {
|
|
66
|
+
moustache: "short";
|
|
67
|
+
beard: "boxed";
|
|
68
|
+
};
|
|
69
|
+
fullBeard: {
|
|
70
|
+
moustache: "chevron";
|
|
71
|
+
beard: "full";
|
|
72
|
+
};
|
|
73
|
+
longBeard: {
|
|
74
|
+
moustache: "walrus";
|
|
75
|
+
beard: "long";
|
|
76
|
+
};
|
|
77
|
+
roundedBeard: {
|
|
78
|
+
moustache: "chevron";
|
|
79
|
+
beard: "rounded";
|
|
80
|
+
};
|
|
81
|
+
pointedBeard: {
|
|
82
|
+
moustache: "chevron";
|
|
83
|
+
beard: "pointed";
|
|
84
|
+
};
|
|
85
|
+
chinStrap: {
|
|
86
|
+
moustache: "none";
|
|
87
|
+
beard: "chinStrap";
|
|
88
|
+
};
|
|
89
|
+
soulPatch: {
|
|
90
|
+
moustache: "none";
|
|
91
|
+
beard: "soulPatch";
|
|
92
|
+
};
|
|
93
|
+
sideburns: {
|
|
94
|
+
moustache: "none";
|
|
95
|
+
beard: "sideburns";
|
|
96
|
+
};
|
|
97
|
+
muttonChops: {
|
|
98
|
+
moustache: "none";
|
|
99
|
+
beard: "muttonChops";
|
|
100
|
+
};
|
|
101
|
+
moustacheStubble: {
|
|
102
|
+
moustache: "short";
|
|
103
|
+
beard: "stubble";
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
export type FacialHairStyleName = keyof typeof FACIAL_HAIR_STYLES;
|
|
107
|
+
export declare function resolveFacialHair(spec: FacialHairSpec | FacialHairStyleName, hairColor?: string): FacialHair;
|
|
108
|
+
export declare function beardRegion(style: BeardStyle, pad: number): ShellRegion | null;
|
|
109
|
+
export interface FacialHairDrawOptions {
|
|
110
|
+
lineWidth: number;
|
|
111
|
+
skin: string;
|
|
112
|
+
}
|
|
113
|
+
/** A beard's far side, behind the head (a long beard seen from behind). */
|
|
114
|
+
export declare function drawBeardBehind(pen: Pen, ctx: CanvasRenderingContext2D, head: SolvedHead, hair: FacialHair, options: FacialHairDrawOptions): void;
|
|
115
|
+
/** The beard over the face (before the mouth is drawn, so the mouth shows in its opening). */
|
|
116
|
+
export declare function drawBeardFront(pen: Pen, head: SolvedHead, hair: FacialHair, options: FacialHairDrawOptions, mouthWidth: number): void;
|
|
117
|
+
/** The moustache, over the mouth. */
|
|
118
|
+
export declare function drawMoustache(pen: Pen, head: SolvedHead, hair: FacialHair, options: FacialHairDrawOptions): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SolvedHead } from '../rig/skeleton';
|
|
2
|
+
import type { Pen } from '../look/pen';
|
|
3
|
+
/**
|
|
4
|
+
* Glasses: a lens round each eye, a bridge between them, and the arms back
|
|
5
|
+
* to the ears. Lenses are placed like the eyes (they slide round with the
|
|
6
|
+
* face in a turn, and the far one hides in profile); the near arm runs back
|
|
7
|
+
* to its ear, so a profile shows the frame side-on.
|
|
8
|
+
*/
|
|
9
|
+
export type GlassesStyle = 'round' | 'square' | 'sunglasses';
|
|
10
|
+
/** Glasses, drawn in the character's ink. */
|
|
11
|
+
export interface Glasses {
|
|
12
|
+
style: GlassesStyle;
|
|
13
|
+
}
|
|
14
|
+
export type GlassesSpec = Partial<Glasses>;
|
|
15
|
+
export declare const GLASSES_STYLES: {
|
|
16
|
+
round: true;
|
|
17
|
+
square: true;
|
|
18
|
+
sunglasses: true;
|
|
19
|
+
};
|
|
20
|
+
export declare function resolveGlasses(spec: GlassesSpec | GlassesStyle): Glasses;
|
|
21
|
+
export interface GlassesDrawOptions {
|
|
22
|
+
lineWidth: number;
|
|
23
|
+
}
|
|
24
|
+
export declare function drawGlasses(pen: Pen, head: SolvedHead, glasses: Glasses, options: GlassesDrawOptions): void;
|