@algorisys/tinyfly 0.97.0 → 0.99.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 +10 -10
- package/docs/acting.md +76 -13
- package/docs/character-appearance.md +329 -0
- package/docs/editor-guide.md +54 -9
- 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 +29 -2
- package/docs/maps.md +2 -2
- package/docs/props.md +8 -6
- package/docs/scene-3d.md +3 -1
- package/docs/teaching.md +1 -1
- package/lib/addons/characters.js +5911 -4230
- package/lib/browser/tinyfly.iife.js +14 -14
- package/lib/browser/tinyfly.js +8545 -6864
- package/lib/browser/tinyfly.umd.js +14 -14
- package/lib/types/characters/acting/character-script.d.ts +44 -0
- package/lib/types/characters/acting/index.d.ts +1 -0
- 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 +35 -5
- package/lib/types/characters/chart.d.ts +52 -14
- package/lib/types/characters/hair-follow.d.ts +76 -0
- 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 +586 -0
- package/lib/types/characters/head/hats.d.ts +58 -0
- package/lib/types/characters/head/head-look.d.ts +56 -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 +5 -1
- package/lib/types/characters/interactions.d.ts +69 -0
- package/lib/types/characters/props/draw.d.ts +9 -0
- package/lib/types/characters/props/families/animals.d.ts +6 -0
- package/lib/types/characters/props/prop-surface.d.ts +14 -3
- package/lib/types/characters/props/ride-3d.d.ts +31 -2
- package/lib/types/characters/props/target.d.ts +5 -1
- package/lib/types/characters/species/human-motion.d.ts +5 -2
- package/lib/types/characters/species/human.d.ts +113 -4
- package/lib/types/characters/wardrobe/basic-outfit.d.ts +19 -5
- package/lib/types/characters/whiteboard.d.ts +13 -1
- package/llms-full.txt +549 -56
- package/llms.txt +29 -28
- package/package.json +1 -1
- package/skills/tinyfly/SKILL.md +18 -4
|
@@ -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;
|