@algorisys/tinyfly 0.106.1 → 0.108.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 +31 -13
- package/docs/character-appearance.md +187 -1
- package/docs/editor-guide.md +1 -1
- 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 +45 -2
- package/docs/maps.md +2 -2
- package/docs/teaching.md +1 -1
- package/lib/addons/characters.js +4985 -4280
- package/lib/browser/tinyfly.iife.js +14 -14
- package/lib/browser/tinyfly.js +7155 -6450
- package/lib/browser/tinyfly.umd.js +14 -14
- package/lib/types/characters/body/organic-body.d.ts +56 -0
- package/lib/types/characters/body/organic-draw.d.ts +5 -0
- package/lib/types/characters/body/organic-geometry.d.ts +25 -0
- package/lib/types/characters/capabilities.d.ts +2 -0
- package/lib/types/characters/character.d.ts +15 -2
- package/lib/types/characters/hair-follow.d.ts +3 -2
- package/lib/types/characters/hands/draw-cartoon-hand.d.ts +4 -0
- package/lib/types/characters/head/ears.d.ts +2 -0
- package/lib/types/characters/head/face.d.ts +8 -4
- package/lib/types/characters/head/facial-hair.d.ts +4 -0
- package/lib/types/characters/head/flowing-hair.d.ts +55 -0
- package/lib/types/characters/head/glasses.d.ts +2 -0
- package/lib/types/characters/head/hair-lock-draw.d.ts +5 -0
- package/lib/types/characters/head/hair-lock.d.ts +36 -0
- package/lib/types/characters/head/hair.d.ts +67 -3
- package/lib/types/characters/head/head-look.d.ts +6 -2
- package/lib/types/characters/head/head-shape.d.ts +4 -0
- package/lib/types/characters/head/index.d.ts +1 -0
- package/lib/types/characters/head/shell.d.ts +2 -2
- package/lib/types/characters/index.d.ts +5 -0
- package/lib/types/characters/look/pen.d.ts +1 -0
- package/lib/types/characters/look/skin-shading.d.ts +4 -0
- package/lib/types/characters/polyline.d.ts +12 -0
- package/lib/types/characters/rig/skeleton.d.ts +2 -0
- package/lib/types/characters/sketch.d.ts +54 -0
- package/lib/types/characters/soft-cartoon-cast.d.ts +166 -0
- package/lib/types/characters/wardrobe/basic-outfit.d.ts +5 -1
- package/lib/types/characters/wardrobe/leaf-outfit.d.ts +18 -0
- package/lib/types/characters/wardrobe/outfit-preset.d.ts +6 -0
- package/lib/types/compat/gsap/playhead-crossings.d.ts +47 -0
- package/llms-full.txt +251 -14
- package/llms.txt +29 -29
- package/package.json +1 -1
- package/skills/tinyfly/SKILL.md +32 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** A contour's half-width as a share of character height, at 0..1 along it. */
|
|
2
|
+
export interface BodyProfilePoint {
|
|
3
|
+
at: number;
|
|
4
|
+
width: number;
|
|
5
|
+
}
|
|
6
|
+
/** Screen-space light; geometry and shading stay deterministic at any time. */
|
|
7
|
+
export interface SkinShading {
|
|
8
|
+
mode: 'none' | 'cel';
|
|
9
|
+
light: [number, number];
|
|
10
|
+
shadow: string;
|
|
11
|
+
opacity: number;
|
|
12
|
+
highlight: number;
|
|
13
|
+
}
|
|
14
|
+
export interface OrganicBodyOptions {
|
|
15
|
+
/** Hip to neck: hips, waist, chest and shoulders. */
|
|
16
|
+
torso?: BodyProfilePoint[];
|
|
17
|
+
/** Shoulder to wrist: upper arm, elbow, forearm and wrist. */
|
|
18
|
+
arm?: BodyProfilePoint[];
|
|
19
|
+
/** Hip to ankle: thigh, knee, calf and ankle. */
|
|
20
|
+
leg?: BodyProfilePoint[];
|
|
21
|
+
neck?: BodyProfilePoint[];
|
|
22
|
+
/** Side thickness relative to front width, 0.2..1 (default 0.55). */
|
|
23
|
+
depth?: number;
|
|
24
|
+
/** Shared exposed skin colour, including face and hands. Defaults to `skin`. */
|
|
25
|
+
fill?: string;
|
|
26
|
+
/** Independent contour settings. Defaults to the character's ink/lineWidth. */
|
|
27
|
+
outline?: {
|
|
28
|
+
color?: string;
|
|
29
|
+
width?: number;
|
|
30
|
+
};
|
|
31
|
+
shading?: Partial<SkinShading>;
|
|
32
|
+
}
|
|
33
|
+
/** Resolved, owned JSON data. Profiles are copied once when making a character. */
|
|
34
|
+
export interface OrganicBody {
|
|
35
|
+
torso: BodyProfilePoint[];
|
|
36
|
+
arm: BodyProfilePoint[];
|
|
37
|
+
leg: BodyProfilePoint[];
|
|
38
|
+
neck: BodyProfilePoint[];
|
|
39
|
+
depth: number;
|
|
40
|
+
fill: string;
|
|
41
|
+
outline: {
|
|
42
|
+
color: string;
|
|
43
|
+
width: number;
|
|
44
|
+
};
|
|
45
|
+
shading: SkinShading;
|
|
46
|
+
}
|
|
47
|
+
/** Resolve body data without a canvas, UI, clock or mutable global state. */
|
|
48
|
+
export declare function resolveOrganicBody(options: OrganicBodyOptions, defaults: {
|
|
49
|
+
skin: string;
|
|
50
|
+
ink: string;
|
|
51
|
+
lineWidth: number;
|
|
52
|
+
shoulderWidth: number;
|
|
53
|
+
hipWidth: number;
|
|
54
|
+
}): OrganicBody;
|
|
55
|
+
/** Smooth bounded width interpolation; anatomy never depends on outline width. */
|
|
56
|
+
export declare function bodyProfileWidth(profile: BodyProfilePoint[], at: number): number;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CharacterJoints } from '../character';
|
|
2
|
+
import { type Pen } from '../look/pen';
|
|
3
|
+
import type { OrganicBody } from './organic-body';
|
|
4
|
+
/** One part at its native depth; no foreground whole-body overlay. */
|
|
5
|
+
export declare function drawOrganicPart(ctx: CanvasRenderingContext2D, pen: Pen, body: OrganicBody, joints: CharacterJoints, id: string): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Point } from '../../adapters/canvas/sketch';
|
|
2
|
+
import type { CharacterJoints } from '../character';
|
|
3
|
+
import type { BodyPlan } from '../rig/body-plan';
|
|
4
|
+
import { type OrganicBody } from './organic-body';
|
|
5
|
+
export interface OrganicSample {
|
|
6
|
+
center: Point;
|
|
7
|
+
left: Point;
|
|
8
|
+
right: Point;
|
|
9
|
+
width: number;
|
|
10
|
+
at: number;
|
|
11
|
+
}
|
|
12
|
+
export interface OrganicContour {
|
|
13
|
+
outline: Point[];
|
|
14
|
+
samples: OrganicSample[];
|
|
15
|
+
/** Normalized position for each outline vertex, for attachment seam removal. */
|
|
16
|
+
positions: number[];
|
|
17
|
+
}
|
|
18
|
+
export type OrganicBodyContours = Record<string, OrganicContour>;
|
|
19
|
+
/** Cubic centerlines pass through the actual joints with a continuous tangent. */
|
|
20
|
+
export declare function organicCenterLine(points: Point[], steps?: number): Point[];
|
|
21
|
+
/** Pose-dependent plain geometry, shared by rendering, layers and exporters. */
|
|
22
|
+
export declare function organicBodyContours(body: OrganicBody, joints: CharacterJoints, plan: BodyPlan): OrganicBodyContours;
|
|
23
|
+
export declare function insideBodyContour(point: Point, outline: Point[]): boolean;
|
|
24
|
+
/** Cloth follows the same curved anatomy, with room independent of its ink. */
|
|
25
|
+
export declare function organicContourSection(shape: OrganicContour, from: number, to: number, padding?: number): Point[];
|
|
@@ -5,11 +5,14 @@ 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 OrganicBody, type OrganicBodyOptions } from './body/organic-body';
|
|
9
|
+
import { type OrganicBodyContours } from './body/organic-geometry';
|
|
8
10
|
import { type FaceOptions } from './head/face';
|
|
9
11
|
import { type HeadLook, type HeadLookOptions } from './head/head-look';
|
|
10
12
|
import { type HumanBuildName, type HumanPoseName, type FootShape } from './species/human';
|
|
11
13
|
import type { Gait } from './gaits';
|
|
12
14
|
import { type BasicOutfitOptions } from './wardrobe/basic-outfit';
|
|
15
|
+
import { type LeafOutfitOptions } from './wardrobe/leaf-outfit';
|
|
13
16
|
import { type Holding, type HoldingSpec } from './hands/held-items';
|
|
14
17
|
import { type HandPose } from './hands/hand-rig';
|
|
15
18
|
/**
|
|
@@ -19,8 +22,8 @@ import { type HandPose } from './hands/hand-rig';
|
|
|
19
22
|
* The v1 stick figure (`stickFigureTarget`, `drawStickFigure`) is separate
|
|
20
23
|
* and unchanged. See docs/character-system-m1.md.
|
|
21
24
|
*/
|
|
22
|
-
/** `stick`:
|
|
23
|
-
export type FigureStyle = 'fluid' | 'stick';
|
|
25
|
+
/** `stick`: traditional stick figure; `fluid`: tapered limbs; `organic`: filled cartoon anatomy. */
|
|
26
|
+
export type FigureStyle = 'fluid' | 'stick' | 'organic';
|
|
24
27
|
/**
|
|
25
28
|
* Draws part of a character: clothes, hair, a prop. The context is in the
|
|
26
29
|
* character's drawing space (feet at 0, 0), saved and restored around the
|
|
@@ -52,9 +55,13 @@ export interface CharacterOptions extends HeadLookOptions {
|
|
|
52
55
|
armLength?: number;
|
|
53
56
|
/** A T-shirt and trousers in these colours (see basicOutfit), as data; drawn under any `layers` */
|
|
54
57
|
outfit?: BasicOutfitOptions | null;
|
|
58
|
+
/** Rounded leaf top/skirt, as JSON data; requires `figure: 'organic'`. */
|
|
59
|
+
leafOutfit?: LeafOutfitOptions | null;
|
|
55
60
|
/** What each hand holds (`{ right: 'mug' }`, `{ both: 'parcel' }`); a pose field `held.<side>` below 0.5 lets go */
|
|
56
61
|
holding?: HoldingSpec | null;
|
|
57
62
|
figure?: FigureStyle;
|
|
63
|
+
/** Opt-in organic contours, skin material and independent outline settings. */
|
|
64
|
+
body?: OrganicBodyOptions;
|
|
58
65
|
look?: Look;
|
|
59
66
|
/** Feet to top of head, px (default 300) */
|
|
60
67
|
height?: number;
|
|
@@ -102,6 +109,7 @@ export interface CharacterOptions extends HeadLookOptions {
|
|
|
102
109
|
export interface Character {
|
|
103
110
|
plan: BodyPlan;
|
|
104
111
|
figure: FigureStyle;
|
|
112
|
+
body?: OrganicBody;
|
|
105
113
|
look: Look;
|
|
106
114
|
height: number;
|
|
107
115
|
lineWidth: number;
|
|
@@ -127,9 +135,13 @@ export interface Character {
|
|
|
127
135
|
export declare function character(options?: CharacterOptions): Character;
|
|
128
136
|
/** Where every part of a character is, as drawn, in its drawing space (feet at 0, 0; up is -y). */
|
|
129
137
|
export interface CharacterJoints {
|
|
138
|
+
/** Organic pose geometry, in drawing coordinates; omitted for existing modes. */
|
|
139
|
+
bodyContours?: OrganicBodyContours;
|
|
130
140
|
height: number;
|
|
131
141
|
lineWidth: number;
|
|
132
142
|
turn: number;
|
|
143
|
+
/** Body forward axis in camera view space, independent of head turns; omitted in flat drawings. */
|
|
144
|
+
bodyForward?: Vec3;
|
|
133
145
|
/** Named points: `hip`, `neck`, `shoulder.left`, `hand.right`, `knee.left`, `toe.right`… */
|
|
134
146
|
points: Record<string, Point>;
|
|
135
147
|
/** Every chain's joints */
|
|
@@ -191,6 +203,7 @@ export interface CharacterPartInView {
|
|
|
191
203
|
part: string;
|
|
192
204
|
/** Its depth in the view, in the projection's units, nearer is larger (metres in a 3D scene) */
|
|
193
205
|
depth: number;
|
|
206
|
+
sortDepth?: number;
|
|
194
207
|
/** Draws it; `time` (ms) is the pencil's boil frame and the layer hooks' time */
|
|
195
208
|
draw(ctx: CanvasRenderingContext2D, time?: number): void;
|
|
196
209
|
}
|
|
@@ -3,7 +3,7 @@ import type { Pose } from './rig/body-plan';
|
|
|
3
3
|
import { type Character } from './character';
|
|
4
4
|
import type { Gait } from './gaits';
|
|
5
5
|
/**
|
|
6
|
-
* Hair follow-through: hanging hair
|
|
6
|
+
* Hair follow-through: hanging hair and flexible curved locks lag
|
|
7
7
|
* behind the head, swinging round it after a turn, streaming back on a run,
|
|
8
8
|
* dropping on a jump and lifting on the landing. The drawing stays stateless:
|
|
9
9
|
* the lag is three pose fields (`hair.swing`, `hair.trail`, `hair.lift`), and
|
|
@@ -76,7 +76,8 @@ export interface HairFollowTrackOptions extends Pick<HairFollowOptions, 'step' |
|
|
|
76
76
|
* its head is (the target's `x` and `y`, plus the head's place in the pose,
|
|
77
77
|
* so a gait's bob, a crouch and a jump all move it), and the pose's `turn`
|
|
78
78
|
* and `head.turn`. Nothing is added for hair that has nothing to swing
|
|
79
|
-
* (short hair, a bun, no hair).
|
|
79
|
+
* (ordinary short hair, a bun, no hair). Flexible short locks do get lag.
|
|
80
|
+
* Hair fields the tracks already key (a flick
|
|
80
81
|
* written by hand) keep their values, with the lag added on.
|
|
81
82
|
*/
|
|
82
83
|
export declare function hairFollowTracks(target: string, tracks: Track[], who: Character, options?: HairFollowTrackOptions): Track[];
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { Point } from '../../adapters/canvas/sketch';
|
|
2
2
|
import { type Look, type Pen, type PencilOptions } from '../look/pen';
|
|
3
3
|
import { type HandJoints, type HandPose, type HandRigStyle } from './hand-rig';
|
|
4
|
+
import type { SkinShading } from '../body/organic-body';
|
|
4
5
|
/**
|
|
5
6
|
* Drawing a posed hand: the palm and each finger are parts, drawn far to near
|
|
6
7
|
* through a {@link Pen}, so a hand matches any look (clean, pencil,
|
|
7
8
|
* silhouette) and boils with a pencil figure.
|
|
8
9
|
*/
|
|
9
10
|
export interface CartoonHandStyle extends HandRigStyle {
|
|
11
|
+
/** Join a native forearm without outlining the wrist's interior edge. */
|
|
12
|
+
connected?: boolean;
|
|
13
|
+
shading?: SkinShading;
|
|
10
14
|
/** Skin fill (default a warm tan); a glove is just another colour */
|
|
11
15
|
skin?: string;
|
|
12
16
|
/** Outline colour (default graphite) */
|
|
@@ -6,11 +6,11 @@ import type { Pen } from '../look/pen';
|
|
|
6
6
|
* Face coordinates to the screen. Cartoon faces slide less than a sphere
|
|
7
7
|
* would: the whole face shifts toward the side the head faces, the spacing of
|
|
8
8
|
* features narrows (to a minimum) and each feature's own shape narrows less, so
|
|
9
|
-
* a profile still shows an eye and a mouth inside the head.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* a profile still shows an eye and a mouth inside the head. Volume projection
|
|
10
|
+
* carries centres around the head and keeps the far eye through three-quarter
|
|
11
|
+
* views. Surface facing hides rear features; the far eye narrows to profile.
|
|
12
12
|
*/
|
|
13
|
-
export declare function faceToScreen(head: SolvedHead, points: Point[], centre: Point): {
|
|
13
|
+
export declare function faceToScreen(head: SolvedHead, points: Point[], centre: Point, projection?: FaceOptions['projection']): {
|
|
14
14
|
points: Point[];
|
|
15
15
|
facing: number;
|
|
16
16
|
};
|
|
@@ -23,6 +23,8 @@ export interface PupilCircle {
|
|
|
23
23
|
}
|
|
24
24
|
/** What an open mouth shows: a row of upper teeth, and a tongue (default neither, as the plain face); a nose; what is in the pupils. */
|
|
25
25
|
export interface FaceOptions {
|
|
26
|
+
/** `cartoon` keeps the classic face slide; `volume` follows the head's 3D axes (organic default). */
|
|
27
|
+
projection?: 'cartoon' | 'volume';
|
|
26
28
|
/** `simple` (default) or colour anime eyes with irises, highlights and expressive lids. Uses the same pose fields. */
|
|
27
29
|
style?: 'simple' | 'anime';
|
|
28
30
|
/** Anime iris colour (default blue); plain data, including in scene JSON. */
|
|
@@ -33,6 +35,8 @@ export interface FaceOptions {
|
|
|
33
35
|
jawWidth?: number;
|
|
34
36
|
/** Angular chin half-width in head radii, 0.03..0.35 (default 0.14). */
|
|
35
37
|
chinWidth?: number;
|
|
38
|
+
/** Round angular jaw corners, 0..1 (default 0: keep the sharp outline). */
|
|
39
|
+
jawRoundness?: number;
|
|
36
40
|
/** Anime eye size, 0.5..1.2 (default 1). */
|
|
37
41
|
eyeScale?: number;
|
|
38
42
|
/** Anime eye height relative to width, 0.45..1.2 (default 1). */
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { Point } from '../../adapters/canvas/sketch';
|
|
1
2
|
import type { SolvedHead } from '../rig/skeleton';
|
|
2
3
|
import type { Pen } from '../look/pen';
|
|
4
|
+
import { type FaceOptions } from './face';
|
|
3
5
|
import { type ShellRegion } from './shell';
|
|
4
6
|
/**
|
|
5
7
|
* Facial hair: a moustache and a beard, chosen separately. A beard is a
|
|
@@ -107,6 +109,8 @@ export type FacialHairStyleName = keyof typeof FACIAL_HAIR_STYLES;
|
|
|
107
109
|
export declare function resolveFacialHair(spec: FacialHairSpec | FacialHairStyleName, hairColor?: string): FacialHair;
|
|
108
110
|
export declare function beardRegion(style: BeardStyle, pad: number): ShellRegion | null;
|
|
109
111
|
export interface FacialHairDrawOptions {
|
|
112
|
+
face?: FaceOptions;
|
|
113
|
+
headOutline?: Point[];
|
|
110
114
|
lineWidth: number;
|
|
111
115
|
skin: string;
|
|
112
116
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { HairLock } from './hair-lock';
|
|
2
|
+
/** Original flowing cartoon styles: a fitted cap with broad curved locks, rather than a straight curtain. */
|
|
3
|
+
export declare const FLOWING_HAIR_STYLES: {
|
|
4
|
+
softSweep: {
|
|
5
|
+
volume: number;
|
|
6
|
+
shine: number;
|
|
7
|
+
part: number;
|
|
8
|
+
strands: "part";
|
|
9
|
+
sweep: number;
|
|
10
|
+
hairline: {
|
|
11
|
+
front: number;
|
|
12
|
+
side: number;
|
|
13
|
+
back: number;
|
|
14
|
+
};
|
|
15
|
+
locks: HairLock[];
|
|
16
|
+
};
|
|
17
|
+
flowingBob: {
|
|
18
|
+
volume: number;
|
|
19
|
+
shine: number;
|
|
20
|
+
length: number;
|
|
21
|
+
fall: {
|
|
22
|
+
taper: number;
|
|
23
|
+
wave: number;
|
|
24
|
+
};
|
|
25
|
+
part: number;
|
|
26
|
+
strands: "part";
|
|
27
|
+
sweep: number;
|
|
28
|
+
hairline: {
|
|
29
|
+
front: number;
|
|
30
|
+
side: number;
|
|
31
|
+
back: number;
|
|
32
|
+
};
|
|
33
|
+
coversEars: true;
|
|
34
|
+
locks: HairLock[];
|
|
35
|
+
};
|
|
36
|
+
cascadingWaves: {
|
|
37
|
+
volume: number;
|
|
38
|
+
shine: number;
|
|
39
|
+
length: number;
|
|
40
|
+
fall: {
|
|
41
|
+
taper: number;
|
|
42
|
+
wave: number;
|
|
43
|
+
};
|
|
44
|
+
part: number;
|
|
45
|
+
strands: "part";
|
|
46
|
+
sweep: number;
|
|
47
|
+
hairline: {
|
|
48
|
+
front: number;
|
|
49
|
+
side: number;
|
|
50
|
+
back: number;
|
|
51
|
+
};
|
|
52
|
+
coversEars: true;
|
|
53
|
+
locks: HairLock[];
|
|
54
|
+
};
|
|
55
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SolvedHead } from '../rig/skeleton';
|
|
2
2
|
import type { Pen } from '../look/pen';
|
|
3
|
+
import { type FaceOptions } from './face';
|
|
3
4
|
/**
|
|
4
5
|
* Glasses: a lens round each eye, a bridge between them, and the arms back
|
|
5
6
|
* to the ears. Lenses are placed like the eyes (they slide round with the
|
|
@@ -19,6 +20,7 @@ export declare const GLASSES_STYLES: {
|
|
|
19
20
|
};
|
|
20
21
|
export declare function resolveGlasses(spec: GlassesSpec | GlassesStyle): Glasses;
|
|
21
22
|
export interface GlassesDrawOptions {
|
|
23
|
+
face?: FaceOptions;
|
|
22
24
|
lineWidth: number;
|
|
23
25
|
}
|
|
24
26
|
export declare function drawGlasses(pen: Pen, head: SolvedHead, glasses: Glasses, options: GlassesDrawOptions): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SolvedHead } from '../rig/skeleton';
|
|
2
|
+
import type { Pen } from '../look/pen';
|
|
3
|
+
import type { Hair, HairMotion } from './hair';
|
|
4
|
+
/** Broad flowing locks, ordered by depth and drawn in the head's two passes. */
|
|
5
|
+
export declare function drawHairLocks(pen: Pen, head: SolvedHead, hair: Hair, pad: number, motion: HairMotion, lineWidth: number, near: boolean): void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Vec3 } from '../rig/body-plan';
|
|
2
|
+
import type { HairMotion } from './hair';
|
|
3
|
+
/** A point on a lock's curve, in the head's own coordinates. */
|
|
4
|
+
export interface HairLockPoint {
|
|
5
|
+
/** Degrees round from the face toward the character's left; use continuous angles across the back. */
|
|
6
|
+
around: number;
|
|
7
|
+
/** Head radii up from the centre; negative values hang below the scalp. */
|
|
8
|
+
up: number;
|
|
9
|
+
/** Extra distance out from the hair cap, head radii (default 0). */
|
|
10
|
+
lift?: number;
|
|
11
|
+
}
|
|
12
|
+
/** A broad, curved section of hair, as editable, serializable data. */
|
|
13
|
+
export interface HairLock {
|
|
14
|
+
/** Root, two controls, tip; append groups of three points for more cubic segments. */
|
|
15
|
+
path: HairLockPoint[];
|
|
16
|
+
/** Maximum width, head radii. Roots blend into the cap and tips taper. */
|
|
17
|
+
width: number;
|
|
18
|
+
/** How much the ends follow hair.swing/trail/lift (default 1; 0 pins the lock). */
|
|
19
|
+
follow?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface HairLockSample {
|
|
22
|
+
center: Vec3;
|
|
23
|
+
left: Vec3;
|
|
24
|
+
right: Vec3;
|
|
25
|
+
normal: Vec3;
|
|
26
|
+
t: number;
|
|
27
|
+
}
|
|
28
|
+
/** Reject malformed paths before they reach a renderer or a saved character. */
|
|
29
|
+
export declare function copyHairLock(lock: HairLock): HairLock;
|
|
30
|
+
/**
|
|
31
|
+
* Sample a lock as a ribbon on the scalp, then hanging off it. Curves are
|
|
32
|
+
* evaluated in scalp coordinates, so a sweep never cuts through the skull.
|
|
33
|
+
* Motion bends the ends progressively and leaves the root fixed. No clock,
|
|
34
|
+
* renderer or previous frame is needed.
|
|
35
|
+
*/
|
|
36
|
+
export declare function sampleHairLock(lock: HairLock, volume: number, pad: number, motion: HairMotion): HairLockSample[];
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import type { Point } from '../../adapters/canvas/sketch';
|
|
1
2
|
import type { Pose } from '../rig/body-plan';
|
|
2
3
|
import type { SolvedHead } from '../rig/skeleton';
|
|
3
4
|
import type { Pen } from '../look/pen';
|
|
4
5
|
import { type ShellRegion } from './shell';
|
|
6
|
+
import { type HairLock } from './hair-lock';
|
|
5
7
|
/**
|
|
6
8
|
* Hair for the human character, as plain data: a cap of hair on the head
|
|
7
9
|
* (how far it stands off the head, where its hairline runs, its texture),
|
|
8
|
-
* optional length that hangs below the head, and ties (ponytails,
|
|
9
|
-
* braids). Every style is
|
|
10
|
+
* optional length that hangs below the head, curved locks and ties (ponytails,
|
|
11
|
+
* buns, braids). Every style is plain data, so a style is a
|
|
10
12
|
* preset of them and any field can be changed on its own.
|
|
11
13
|
*
|
|
12
14
|
* Hair is a region on the head's surface (see `shell.ts`), so it turns with
|
|
@@ -36,7 +38,7 @@ export interface HairMotion {
|
|
|
36
38
|
export declare const HAIR_STILL: HairMotion;
|
|
37
39
|
/** The hair motion a pose carries (`hair.swing`, `hair.trail`, `hair.lift`; missing fields are still). */
|
|
38
40
|
export declare function hairMotionOf(pose: Pose | undefined): HairMotion;
|
|
39
|
-
/** Whether a style has anything that swings:
|
|
41
|
+
/** Whether a style has anything that swings: hanging hair, a ponytail/braid, or flexible locks. */
|
|
40
42
|
export declare function hairHangs(hair: Hair): boolean;
|
|
41
43
|
export type HairTexture = 'smooth' | 'spiky' | 'curly' | 'wavy' | 'locs';
|
|
42
44
|
/** Detail lines drawn on the hair: none, a parting, strands swept from a parting, combed back, hanging strands, a few thin strands */
|
|
@@ -95,6 +97,15 @@ export interface Hair {
|
|
|
95
97
|
ties: HairTie[];
|
|
96
98
|
/** Optional pointed tufts; their silhouette follows every head turn. */
|
|
97
99
|
spikes?: HairSpike[];
|
|
100
|
+
/** Broad curved locks, rooted on the cap, with tapered tips and individual flexibility. */
|
|
101
|
+
locks?: HairLock[];
|
|
102
|
+
/** Hanging mass: narrowing toward the tips and a soft uneven hem, in head radii. */
|
|
103
|
+
fall?: {
|
|
104
|
+
taper: number;
|
|
105
|
+
wave: number;
|
|
106
|
+
};
|
|
107
|
+
/** Soft highlight opacity on flowing locks, 0..1 (default 0). */
|
|
108
|
+
shine?: number;
|
|
98
109
|
/** Hair falls over the ears, so the ears are hidden */
|
|
99
110
|
coversEars: boolean;
|
|
100
111
|
}
|
|
@@ -592,6 +603,57 @@ export declare const HAIR_STYLES: {
|
|
|
592
603
|
})[];
|
|
593
604
|
coversEars: true;
|
|
594
605
|
};
|
|
606
|
+
softSweep: {
|
|
607
|
+
volume: number;
|
|
608
|
+
shine: number;
|
|
609
|
+
part: number;
|
|
610
|
+
strands: "part";
|
|
611
|
+
sweep: number;
|
|
612
|
+
hairline: {
|
|
613
|
+
front: number;
|
|
614
|
+
side: number;
|
|
615
|
+
back: number;
|
|
616
|
+
};
|
|
617
|
+
locks: HairLock[];
|
|
618
|
+
};
|
|
619
|
+
flowingBob: {
|
|
620
|
+
volume: number;
|
|
621
|
+
shine: number;
|
|
622
|
+
length: number;
|
|
623
|
+
fall: {
|
|
624
|
+
taper: number;
|
|
625
|
+
wave: number;
|
|
626
|
+
};
|
|
627
|
+
part: number;
|
|
628
|
+
strands: "part";
|
|
629
|
+
sweep: number;
|
|
630
|
+
hairline: {
|
|
631
|
+
front: number;
|
|
632
|
+
side: number;
|
|
633
|
+
back: number;
|
|
634
|
+
};
|
|
635
|
+
coversEars: true;
|
|
636
|
+
locks: HairLock[];
|
|
637
|
+
};
|
|
638
|
+
cascadingWaves: {
|
|
639
|
+
volume: number;
|
|
640
|
+
shine: number;
|
|
641
|
+
length: number;
|
|
642
|
+
fall: {
|
|
643
|
+
taper: number;
|
|
644
|
+
wave: number;
|
|
645
|
+
};
|
|
646
|
+
part: number;
|
|
647
|
+
strands: "part";
|
|
648
|
+
sweep: number;
|
|
649
|
+
hairline: {
|
|
650
|
+
front: number;
|
|
651
|
+
side: number;
|
|
652
|
+
back: number;
|
|
653
|
+
};
|
|
654
|
+
coversEars: true;
|
|
655
|
+
locks: HairLock[];
|
|
656
|
+
};
|
|
595
657
|
};
|
|
596
658
|
export type HairStyleName = keyof typeof HAIR_STYLES;
|
|
597
659
|
/** Hair colours that read well against the default ink, by name. */
|
|
@@ -615,6 +677,8 @@ export declare function hairlineAt(hair: Hair, around: number): number;
|
|
|
615
677
|
*/
|
|
616
678
|
export declare function hairRegion(hair: Hair, pad: number, motion?: HairMotion): ShellRegion;
|
|
617
679
|
export interface HairDrawOptions {
|
|
680
|
+
/** Projected face outline for clipping behind angular heads. */
|
|
681
|
+
headOutline?: Point[];
|
|
618
682
|
/** The character's line width, px */
|
|
619
683
|
lineWidth: number;
|
|
620
684
|
/** Skin colour, for the scalp under close-cropped hair */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Pose } from '../rig/body-plan';
|
|
2
2
|
import type { SolvedHead } from '../rig/skeleton';
|
|
3
3
|
import type { Pen } from '../look/pen';
|
|
4
|
+
import type { FaceOptions } from './face';
|
|
4
5
|
import { type Hair, type HairSpec, type HairStyleName } from './hair';
|
|
5
6
|
import { type FacialHair, type FacialHairSpec, type FacialHairStyleName } from './facial-hair';
|
|
6
7
|
import { type Glasses, type GlassesSpec, type GlassesStyle } from './glasses';
|
|
@@ -18,8 +19,8 @@ import { type Hat, type HatSpec, type HatStyle } from './hats';
|
|
|
18
19
|
* - over: after the whole body, the hair and hat when the head is turned
|
|
19
20
|
* away, since they are then the nearest things to the viewer.
|
|
20
21
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
22
|
+
* Classic eyes and brows draw over a fringe; filled organic heads draw
|
|
23
|
+
* their face under opaque hair instead. The mouth draws over a beard (which leaves an
|
|
23
24
|
* opening for it), a moustache over the mouth's top, and a hat over the hair.
|
|
24
25
|
*
|
|
25
26
|
* Hanging hair lags behind the head by the pose's `hair.swing`, `hair.trail`
|
|
@@ -46,6 +47,9 @@ export interface HeadLook {
|
|
|
46
47
|
}
|
|
47
48
|
export declare function resolveHeadLook(options: HeadLookOptions): HeadLook;
|
|
48
49
|
export interface HeadDrawOptions {
|
|
50
|
+
face?: FaceOptions;
|
|
51
|
+
/** Filled cartoon heads let opaque bangs and side locks cover the face. */
|
|
52
|
+
faceUnderHair?: boolean;
|
|
49
53
|
lineWidth: number;
|
|
50
54
|
skin: string;
|
|
51
55
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { Point } from '../../adapters/canvas/sketch';
|
|
2
2
|
import { type SolvedHead } from '../rig/skeleton';
|
|
3
3
|
import type { FaceOptions } from './face';
|
|
4
|
+
/** A bridge, forward tip and lower return anchored above the mouth. */
|
|
5
|
+
export declare function nosePoints(head: SolvedHead): Point[];
|
|
6
|
+
/** Filled cartoon heads have a small forward nose in their turned silhouette. */
|
|
7
|
+
export declare function headOutline(head: SolvedHead, face: FaceOptions): Point[];
|
|
4
8
|
/** Project a tapered 3D head, then take its silhouette: the jaw follows turn, nod and roll. */
|
|
5
9
|
export declare function angularHeadOutline(head: SolvedHead, face: FaceOptions): Point[];
|
|
6
10
|
/** Monotone chain. Dropping interior points preserves sharp jaw corners at any view. */
|
|
@@ -3,3 +3,4 @@ export { FACIAL_HAIR_STYLES, resolveFacialHair, type FacialHair, type FacialHair
|
|
|
3
3
|
export { GLASSES_STYLES, resolveGlasses, type Glasses, type GlassesSpec, type GlassesStyle } from './glasses';
|
|
4
4
|
export { HAT_STYLES, resolveHat, type Hat, type HatSpec, type HatStyle } from './hats';
|
|
5
5
|
export { resolveHeadLook, type HeadLook, type HeadLookOptions } from './head-look';
|
|
6
|
+
export type { HairLock, HairLockPoint } from './hair-lock';
|
|
@@ -56,9 +56,9 @@ export declare function aroundDistance(a: number, b: number): number;
|
|
|
56
56
|
export declare function shellOutlines(head: SolvedHead, region: ShellRegion, columns?: number): ShellOutlines;
|
|
57
57
|
export declare function cachedOutlines(head: SolvedHead, key: unknown, make: () => ShellOutlines): ShellOutlines;
|
|
58
58
|
/**
|
|
59
|
-
* Run `draw` with the
|
|
59
|
+
* Run `draw` with the projected face outline (or default oval) cut out, for things behind
|
|
60
60
|
* the head: they show only around it, even when the head is see-through.
|
|
61
61
|
*/
|
|
62
|
-
export declare function behindHead(ctx: CanvasRenderingContext2D, head: SolvedHead, draw: () => void): void;
|
|
62
|
+
export declare function behindHead(ctx: CanvasRenderingContext2D, head: SolvedHead, draw: () => void, outline?: Point[]): void;
|
|
63
63
|
/** Split a head-space polyline into the runs that face the viewer, on the screen. */
|
|
64
64
|
export declare function visibleRuns(head: SolvedHead, points: Vec3[], normals: Vec3[], threshold?: number): Point[][];
|
|
@@ -27,6 +27,10 @@ export * from './surface';
|
|
|
27
27
|
export * from '../adapters/canvas/polyline';
|
|
28
28
|
export * from './hand';
|
|
29
29
|
export * from './character';
|
|
30
|
+
export { leafOutfit, leafOutfitContours, type LeafOutfitOptions, type LeafOutfitContours } from './wardrobe/leaf-outfit';
|
|
31
|
+
export { softCartoonCharacter, SOFT_CARTOON_CAST, type SoftCartoonName } from './soft-cartoon-cast';
|
|
32
|
+
export { resolveOrganicBody, bodyProfileWidth, type OrganicBody, type OrganicBodyOptions, type BodyProfilePoint, type SkinShading } from './body/organic-body';
|
|
33
|
+
export { organicBodyContours, organicCenterLine, type OrganicBodyContours, type OrganicContour, type OrganicSample } from './body/organic-geometry';
|
|
30
34
|
export { humanPlan, humanPose, mirrorHumanPose, humanFieldLabel, HUMAN_REST, HUMAN_POSES, HUMAN_EXPRESSIONS, HUMAN_BUILDS, FOOT_SHAPES, type FootShape, type HumanBuild, type HumanBuildName, type HumanPoseName, type HumanExpressionName } from './species/human';
|
|
31
35
|
export { CHARACTER_CAST, ANIME_CAST, MANGA_CAST, castMember, type CastMember, type CastName, type AnimeCastName, type MangaCastName } from './cast';
|
|
32
36
|
export type { FaceOptions, PupilCircle } from './head/face';
|
|
@@ -35,6 +39,7 @@ export * from './species/human-motion';
|
|
|
35
39
|
export type { BodyPlan, ChainSpec, BoneSpec, BoneAngles, ContactSpec, HeadSpec, Pose as CharacterPose, Vec3 } from './rig/body-plan';
|
|
36
40
|
export { createPen, ellipsePoints, type Pen, type Look, type PencilOptions, type PenOptions } from './look/pen';
|
|
37
41
|
export { basicOutfit, type BasicOutfitOptions } from './wardrobe/basic-outfit';
|
|
42
|
+
export { outfitPreset, OUTFIT_PRESETS, type OutfitCategory } from './wardrobe/outfit-preset';
|
|
38
43
|
export * from './head';
|
|
39
44
|
export { hairFollow, hairFollowTracks, hairMotionAt, type HairFollowSample, type HairFollowOptions, type HairFollowKey, type HairFollowTrackOptions } from './hair-follow';
|
|
40
45
|
export * from './hands';
|
|
@@ -57,3 +57,4 @@ export interface PenOptions {
|
|
|
57
57
|
/** Points around an ellipse, from `start` radians, `turns` of a full turn. */
|
|
58
58
|
export declare function ellipsePoints(cx: number, cy: number, rx: number, ry: number, angle: number, start?: number, turns?: number, samples?: number): Point[];
|
|
59
59
|
export declare function createPen(ctx: CanvasRenderingContext2D, options: PenOptions): Pen;
|
|
60
|
+
export declare function unfilledPen(ctx: CanvasRenderingContext2D, pen: Pen): Pen;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Point } from '../../adapters/canvas/sketch';
|
|
2
|
+
import type { SkinShading } from '../body/organic-body';
|
|
3
|
+
/** A deterministic cel band clipped to the moving face/palm contour. */
|
|
4
|
+
export declare function shadeSkinOutline(ctx: CanvasRenderingContext2D, outline: Point[], center: Point, material: SkinShading): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Point } from './sketch';
|
|
2
|
+
/**
|
|
3
|
+
* Polyline helpers measured by length, so `progress` 0..1 means "this much of
|
|
4
|
+
* the way along", whatever the spacing of the points. Drawing on, erasing and
|
|
5
|
+
* the hand that follows a stroke all use them.
|
|
6
|
+
*/
|
|
7
|
+
/** Total length of a polyline. */
|
|
8
|
+
export declare function pathLength(points: Point[]): number;
|
|
9
|
+
/** The start of a polyline, up to `progress` (0..1) of its length. */
|
|
10
|
+
export declare function partialPath(points: Point[], progress: number): Point[];
|
|
11
|
+
/** Where along a polyline `progress` (0..1) of its length is. */
|
|
12
|
+
export declare function pointAlong(points: Point[], progress: number): Point;
|
|
@@ -42,6 +42,8 @@ export interface Skeleton {
|
|
|
42
42
|
height: number;
|
|
43
43
|
/** View angle, radians: turn × 90° */
|
|
44
44
|
view: number;
|
|
45
|
+
/** Body forward axis in camera view space; independent of head yaw. */
|
|
46
|
+
bodyForward?: Vec3;
|
|
45
47
|
chains: Record<string, SolvedChain>;
|
|
46
48
|
head: SolvedHead;
|
|
47
49
|
/** The hips on screen */
|