@algorisys/tinyfly 0.122.0 → 0.124.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.
@@ -0,0 +1,178 @@
1
+ import type { Point } from '../../adapters/canvas/sketch';
2
+ /**
3
+ * Detective overlays for canvas scenes: the red magnifier that marks a clue,
4
+ * an evidence folder, a wall clock and a time chip, a freeze-frame name card
5
+ * for a suspect, a first-person narration box and a comic speech bubble.
6
+ *
7
+ * Every function takes the time (ms) and plain options and draws the same
8
+ * thing for the same input. Text is always the caller's (any language, any
9
+ * font family); nothing is measured except with the context's own font.
10
+ */
11
+ export declare const NOIR_RED = "#d7263d";
12
+ export declare const NOIR_AMBER = "#f5b942";
13
+ export declare const NOIR_CREAM = "#efe6d2";
14
+ export declare const NOIR_INK = "#111111";
15
+ export interface ClueMarkerOptions {
16
+ /** Centre of the ring, scene px */
17
+ x: number;
18
+ y: number;
19
+ /** Ring radius, px (default 46) */
20
+ radius?: number;
21
+ /** When it pops on, ms */
22
+ at: number;
23
+ /** How long it stays, ms (default 3000), fading out over the last 400 */
24
+ duration?: number;
25
+ color?: string;
26
+ /** Ring width, px (default 6; the handle is 10/6 of it) */
27
+ lineWidth?: number;
28
+ }
29
+ /**
30
+ * How the clue marker shows at `time`: `opacity` (pops on over 300 ms, fades
31
+ * out over the last 400) and `scale` (a gentle pulse), or opacity 0 outside
32
+ * its window.
33
+ */
34
+ export declare function clueMarkerAt(time: number, options: Pick<ClueMarkerOptions, 'at' | 'duration'>): {
35
+ opacity: number;
36
+ scale: number;
37
+ };
38
+ /** The red magnifier: a pulsing ring with a handle, over something worth noticing. Returns its opacity. */
39
+ export declare function drawClueMarker(ctx: CanvasRenderingContext2D, time: number, options: ClueMarkerOptions): number;
40
+ export interface EvidenceFolderOptions {
41
+ /** Centre, scene px */
42
+ x: number;
43
+ y: number;
44
+ /** 1 = 68 × 48 px (default 1) */
45
+ scale?: number;
46
+ /** Tilt, degrees (default 0) */
47
+ angle?: number;
48
+ color?: string;
49
+ ink?: string;
50
+ /** A short label on its front, in the caller's font (default none) */
51
+ label?: string;
52
+ labelColor?: string;
53
+ font?: string;
54
+ }
55
+ /** An evidence folder: a tabbed folder with a stripe (and an optional label). */
56
+ export declare function drawEvidenceFolder(ctx: CanvasRenderingContext2D, options: EvidenceFolderOptions): void;
57
+ export interface ClockFaceOptions {
58
+ x: number;
59
+ y: number;
60
+ /** Default 52 px */
61
+ radius?: number;
62
+ /** 0–23 (with minutes, the hour hand moves between hours) */
63
+ hours: number;
64
+ minutes: number;
65
+ face?: string;
66
+ ink?: string;
67
+ }
68
+ /** A wall clock showing a time: a face with twelve ticks, an hour and a minute hand. */
69
+ export declare function drawClockFace(ctx: CanvasRenderingContext2D, options: ClockFaceOptions): void;
70
+ /** The clock's hand angles, radians clockwise from 12. */
71
+ export declare function clockHandAngles(hours: number, minutes: number): {
72
+ hour: number;
73
+ minute: number;
74
+ };
75
+ export interface TimeChipOptions {
76
+ /** Top-left corner, scene px */
77
+ x: number;
78
+ y: number;
79
+ /** Its text: a time, a place, a day ("Tuesday · 9:40 PM") */
80
+ text: string;
81
+ /** Font size, px (default 30) */
82
+ size?: number;
83
+ font?: string;
84
+ /** Text and border colour (default amber) */
85
+ color?: string;
86
+ background?: string;
87
+ /** When it fades in, ms (default 100), over 400 ms */
88
+ at?: number;
89
+ }
90
+ /** A time/place chip in a corner: amber text in a black box. Returns its width. */
91
+ export declare function drawTimeChip(ctx: CanvasRenderingContext2D, time: number, options: TimeChipOptions): number;
92
+ export interface NameCardOptions {
93
+ /** The suspect's name */
94
+ name: string;
95
+ /** A second line: who they are, a motive (default none) */
96
+ role?: string;
97
+ /** When it shows, ms, and for how long (default 2600) */
98
+ at: number;
99
+ duration?: number;
100
+ /** The suspect's head, scene px: the card goes beside it */
101
+ anchor: Point;
102
+ /** Which side of the head (default auto: right of a head in the left 57% of the frame) */
103
+ side?: 'auto' | 'left' | 'right';
104
+ /** The frame, for the dimming and the auto side (default 1920 × 1080) */
105
+ frame?: {
106
+ width: number;
107
+ height: number;
108
+ };
109
+ /** Dim the rest of the frame to this (default 0.35; 0 for none) */
110
+ dim?: number;
111
+ color?: string;
112
+ ink?: string;
113
+ nameSize?: number;
114
+ roleSize?: number;
115
+ font?: string;
116
+ /** Tilt, degrees (default -3.4) */
117
+ tilt?: number;
118
+ }
119
+ /** A freeze-frame name card: the frame dims and a slanted red band names the suspect beside their head. Returns its opacity. */
120
+ export declare function drawNameCard(ctx: CanvasRenderingContext2D, time: number, options: NameCardOptions): number;
121
+ /** How a line of text shows over its window: `opacity` and `reveal` (0..1 of its words typed on). */
122
+ export declare function lineReveal(time: number, start: number, end: number, typeDuration?: number): {
123
+ opacity: number;
124
+ reveal: number;
125
+ };
126
+ export interface NarrationBoxOptions {
127
+ text: string;
128
+ /** The line's start and end, ms */
129
+ start: number;
130
+ end: number;
131
+ /** Who narrates: a small tag on the box's top-left (default none) */
132
+ speaker?: string;
133
+ /** The box's left edge and width, and where its bottom sits, scene px (default a 1920 × 1080 frame's) */
134
+ x?: number;
135
+ width?: number;
136
+ bottom?: number;
137
+ /** Font size, px (default 42) */
138
+ size?: number;
139
+ font?: string;
140
+ background?: string;
141
+ ink?: string;
142
+ tagColor?: string;
143
+ /** How long the words take to type on, ms (default half the line, at most 1600) */
144
+ typeDuration?: number;
145
+ }
146
+ /** A first-person narration box along the bottom: cream paper, the narrator's tag, the words typed on. Returns its opacity. */
147
+ export declare function drawNarrationBox(ctx: CanvasRenderingContext2D, time: number, options: NarrationBoxOptions): number;
148
+ export interface SpeechBubbleOptions {
149
+ text: string;
150
+ /** The line's start and end, ms */
151
+ start: number;
152
+ end: number;
153
+ /** Where the tail points (the speaker's head), scene px */
154
+ tail: Point;
155
+ /** The speaker's name on a dark tag (default none) */
156
+ speaker?: string;
157
+ /** The widest a text line may be, px (default 640) */
158
+ maxWidth?: number;
159
+ size?: number;
160
+ font?: string;
161
+ /** The area the bubble keeps inside (default a 1920 × 1080 frame, 40 px in) */
162
+ bounds?: {
163
+ x: number;
164
+ y: number;
165
+ width: number;
166
+ height: number;
167
+ };
168
+ /** The lowest the bubble's centre may sit, scene y (default none) */
169
+ maxCenterY?: number;
170
+ /** Gap between the bubble and the head, px (default 70) */
171
+ gap?: number;
172
+ fill?: string;
173
+ ink?: string;
174
+ tagColor?: string;
175
+ tagText?: string;
176
+ }
177
+ /** A crisp comic speech bubble above a speaker, its tail to their head; pops on and shrinks away. Returns its scale. */
178
+ export declare function drawSpeechBubble(ctx: CanvasRenderingContext2D, time: number, options: SpeechBubbleOptions): number;
package/llms-full.txt CHANGED
@@ -591,7 +591,7 @@ with a GSAP-style call (durations are in seconds here):
591
591
  ```html
592
592
  <div class="box" style="width:60px;height:60px;background:#4a9eff"></div>
593
593
 
594
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.122.0/cdn/tinyfly.iife.js"></script>
594
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.124.0/cdn/tinyfly.iife.js"></script>
595
595
  <script>
596
596
  tinyfly.to('.box', { x: 200, duration: 1 })
597
597
  </script>
@@ -799,7 +799,7 @@ Without a build step, the all-in-one bundle exposes the same functions on a
799
799
  global — `tinyfly.to()`, `tinyfly.timeline()` and so on:
800
800
 
801
801
  ```html
802
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.122.0/cdn/tinyfly.iife.js"></script>
802
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.124.0/cdn/tinyfly.iife.js"></script>
803
803
  <script>
804
804
  tinyfly.to('.box', { x: 200, duration: 1 })
805
805
  </script>
@@ -1982,6 +1982,17 @@ its own controls and scrolling in a full viewport; gallery panels and code
1982
1982
  sections remain in the original tab. **Copy code** exports the same standalone
1983
1983
  HTML. [Try the manga example](https://tinyfly.app/examples/live-manga-cast/full).
1984
1984
 
1985
+ ## Noir Case File
1986
+
1987
+ [Noir Case File](https://tinyfly.app/examples/live-noir-case-file) plays a
1988
+ detective scene from the noir kit: rain on the window, street light through
1989
+ the blinds, a torch beam in the dark, the red clue magnifier, a speech
1990
+ bubble, a freeze-frame name card, a narration box and a time chip. Switch to
1991
+ the case board, where cards are pinned up, red string stretches between them
1992
+ and the marker crosses out, strikes, scribbles out and rings them. The bean
1993
+ cast wears a trench coat and a sari with a pallu and bangles. See
1994
+ [Noir and Detective Scenes](noir-detective.md).
1995
+
1985
1996
  ## Young Adult Manga Cast
1986
1997
 
1987
1998
  [Young Adult Manga Cast](https://tinyfly.app/examples/live-manga-cast) shows
@@ -2714,7 +2725,7 @@ For simple website embedding without a build system.
2714
2725
  </html>
2715
2726
  ```
2716
2727
 
2717
- Build the player with `npm run build:player` to generate `lib/player/tinyfly-player.iife.js`, or load it from the CDN: `https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.122.0/cdn/tinyfly-player.iife.js`.
2728
+ Build the player with `npm run build:player` to generate `lib/player/tinyfly-player.iife.js`, or load it from the CDN: `https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.124.0/cdn/tinyfly-player.iife.js`.
2718
2729
 
2719
2730
  ---
2720
2731
 
@@ -7068,7 +7079,7 @@ The dialog shows the generated HTML/JavaScript code with a **Copy Code** button.
7068
7079
  **Steps to embed:**
7069
7080
  1. Build the player: `npm run build:player`
7070
7081
  2. Copy `lib/player/tinyfly-player.iife.js` to your project (or load
7071
- `https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.122.0/cdn/tinyfly-player.iife.js`
7082
+ `https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.124.0/cdn/tinyfly-player.iife.js`
7072
7083
  instead; see [Deployment](DEPLOYMENT.md))
7073
7084
  3. Copy the generated code into your HTML
7074
7085
  4. Adjust the script `src` path if needed
@@ -8444,6 +8455,17 @@ lines (`bean: { limbs: 'tube' | 'line' }`), a shaped body (`bean.torso` fullness
8444
8455
  (`face.style: 'oval'`, usable on any figure), `hands: 'mitten'` and cartoon shoes; colours from
8445
8456
  `bean: { shirt, sleeves, trousers, shoes }` or an `outfit`; detective gear `bean: { coat, fedora, shades: true }`
8446
8457
  (aviators replace the eyes, brows still show); `halo` gives line limbs a pale edge. A bean is always drawn clean.
8458
+ Household clothes on a bean: `bean: { skirt: '#c2410c' }` (a sari to the ankle) or
8459
+ `skirt: { color, length: 0.45 }` (a kurta hem; pair it with `trousers`), `drape` (a pallu or dupatta sash)
8460
+ and `bangles`; preset `beanSari`. The skirt follows the legs (flared standing, along the thighs seated).
8461
+ For detective / noir scenes use the canvas kit (docs/noir-detective.md): `drawRain(ctx, time, box)`,
8462
+ `drawBlinds`, `drawDarkness(ctx, { amount, cones: [{ x, y, angle /* degrees */, length, width }], holes })`,
8463
+ `drawGlow`, `drawVignette`, `drawClueMarker(ctx, time, { x, y, at })`, `drawNameCard(ctx, time, { name, role, at, anchor })`,
8464
+ `drawNarrationBox(ctx, time, { text, start, end, speaker })`, `drawSpeechBubble(ctx, time, { text, start, end, tail })`,
8465
+ `drawTimeChip`, `drawClockFace`, `drawEvidenceFolder`, and a case board as data:
8466
+ `drawCaseBoard(ctx, caseBoard({ x, y, width, height, cards, strings, marks }), time, { drawCard })`
8467
+ (marks `cross | strike | scribble | circle`; it returns the marker nib). All times are ms and every
8468
+ function is a pure function of time; never use `Math.random` for rain or grain. Text is yours (any script).
8447
8469
  The `look` values are `clean`, `pencil`, `silhouette` and `illustrated`
8448
8470
  (inked and painted, tuned with `illustrated: { light, weight, taper, shadow, highlight }`).
8449
8471
  Age is proportions, hair, creases and clothes, never a stoop; a `cane` in a hand or
@@ -8516,7 +8538,10 @@ Write new actions with `defineAction()` (from beats, or as timed pose steps),
8516
8538
  new gaits with `defineGait()`, and characters with `persona()`. Pass them where
8517
8539
  they are used; `persona.describe()` and `capabilities(version, cast)` list them,
8518
8540
  and the checks accept them. See "Your own actions, gaits and personas" in
8519
- `docs/acting.md`.
8541
+ `docs/acting.md`. In a gait, swinging arms hang plumb whatever the `lean` and
8542
+ `bend` (so `shoulder` is from the vertical); a run-like gait wants
8543
+ `flight: true` (airborne with the legs apart, grounded as they pass) and a
8544
+ knee `give` of 20–30 so it lands on a bent knee.
8520
8545
 
8521
8546
  ## 2. Ask a target what it can do
8522
8547
 
@@ -8695,7 +8720,7 @@ path for all of that:
8695
8720
  </figure>
8696
8721
 
8697
8722
  <!-- once, anywhere on the page (a site-wide footer is fine) -->
8698
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.122.0/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
8723
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.124.0/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
8699
8724
  ```
8700
8725
 
8701
8726
  Every `[data-tinyfly-embed]` mounts when the page is ready, with no per-post
@@ -9281,7 +9306,7 @@ lesson's step options (`duration`, `easing`, `delay`).
9281
9306
  <figcaption>The determinant is the area of the unit square after the map.</figcaption>
9282
9307
  </figure>
9283
9308
 
9284
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.122.0/cdn/tinyfly-math.iife.js" data-tinyfly-auto></script>
9309
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.124.0/cdn/tinyfly-math.iife.js" data-tinyfly-auto></script>
9285
9310
  ```
9286
9311
 
9287
9312
  The figure draws itself into an SVG and redraws from the timeline whenever the
@@ -10415,8 +10440,8 @@ On a page with no build step, load the maps add-on after the browser bundle; it
10415
10440
  adds to the same `tinyfly` global:
10416
10441
 
10417
10442
  ```html
10418
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.122.0/cdn/tinyfly.iife.js"></script>
10419
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.122.0/cdn/tinyfly-maps.iife.js"></script>
10443
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.124.0/cdn/tinyfly.iife.js"></script>
10444
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.124.0/cdn/tinyfly-maps.iife.js"></script>
10420
10445
  ```
10421
10446
 
10422
10447
  It is a separate script because the offline world map it carries adds about
@@ -10619,6 +10644,148 @@ prop, or the depths to slot it between fingers.
10619
10644
 
10620
10645
  ---
10621
10646
 
10647
+ <!-- docs/noir-detective.md -->
10648
+
10649
+ # Noir and Detective Scenes
10650
+
10651
+ A kit for detective stories and film-noir moods on a canvas: rain on the
10652
+ window, street light through venetian blinds, a dark room with a torch beam,
10653
+ soft pools of light and a vignette; the red magnifier that marks a clue, an
10654
+ evidence folder, a wall clock and a time chip, a freeze-frame name card for a
10655
+ suspect, a first-person narration box and speech bubbles; and a case board
10656
+ with pinned cards, red string and the marker's cross-outs and scribble-outs.
10657
+
10658
+ Every function draws on a Canvas 2D context, takes the time in ms and plain
10659
+ options, and draws the same thing for the same input: rain comes from a
10660
+ seeded generator, never `Math.random`, so a frame looks the same whether it
10661
+ is rendered in order, out of order or scrubbed to. Text is always yours (any
10662
+ language or script) and so are the fonts (`font` is a CSS family list).
10663
+
10664
+ ```js
10665
+ import { character, castMember, drawCharacter, humanPose, HUMAN_POSES,
10666
+ drawRain, drawBlinds, drawDarkness, drawVignette, drawClueMarker,
10667
+ drawNameCard, drawNarrationBox, drawTimeChip } from '@algorisys/tinyfly/characters'
10668
+
10669
+ const detective = character(castMember('beanDetective', 460))
10670
+
10671
+ function frame(ctx, time) {
10672
+ ctx.fillStyle = '#232b37'
10673
+ ctx.fillRect(0, 0, 1920, 1080)
10674
+ drawRain(ctx, time, { x: 1500, y: 160, width: 340, height: 440 }) // the window
10675
+ drawBlinds(ctx, { x: 0, y: 0, width: 1920, height: 1080, opacity: 0.08 })
10676
+ ctx.save(); ctx.translate(560, 880)
10677
+ drawCharacter(ctx, detective, humanPose({ ...HUMAN_POSES.think, turn: 0.45 }), time)
10678
+ ctx.restore()
10679
+ drawDarkness(ctx, { amount: 1, cones: [{ x: 640, y: 520, angle: 15, length: 760, width: 190 }] })
10680
+ drawClueMarker(ctx, time, { x: 900, y: 680, at: 1500 })
10681
+ drawNameCard(ctx, time, { name: 'The witness', role: 'heard footsteps', at: 6800, anchor: { x: 1340, y: 470 } })
10682
+ drawVignette(ctx, { width: 1920, height: 1080 })
10683
+ drawTimeChip(ctx, time, { x: 50, y: 40, text: 'Tuesday · 9:40 PM' })
10684
+ drawNarrationBox(ctx, time, { text: 'It rained all night.', start: 300, end: 3400, speaker: 'Case file #1' })
10685
+ }
10686
+ ```
10687
+
10688
+ The [Noir Case File](https://tinyfly.app/examples/live-noir-case-file)
10689
+ example plays a whole scene and its case board.
10690
+
10691
+ ## Atmosphere
10692
+
10693
+ | Function | What it draws |
10694
+ |---|---|
10695
+ | `drawRain(ctx, time, { x, y, width, height, drops?, opacity?, color?, speed?, length?, slant?, lineWidth?, seed? })` | Streaks falling in a box (a window, or the whole frame), clipped to it. 70 drops at 900–1440 px/s by default; `seed` moves them. |
10696
+ | `drawBlinds(ctx, { x, y, width, height, opacity?, slope?, spacing?, band?, color? })` | Key light through venetian blinds: parallel slanted bands (`slope` 0.35, every 52 px, 24 px thick). |
10697
+ | `drawDarkness(ctx, { amount, cones?, holes?, bounds?, color?, opacity?, beam?, beamOpacity? })` | A dark overlay (`amount` 0–1) with torch beams and round holes cut out. A cone is `{ x, y, angle, length, width }`: from its apex toward `angle` degrees (0 right, 90 down), `width` half-wide at its end; a hole is `{ x, y, radius }`. Beams keep a little of the dark and a faint warm tint (`beam: null` for none). `coneCorners(cone)` gives a beam's corners. |
10698
+ | `drawGlow(ctx, { x, y, radius, color?, opacity? })` | A soft pool of light (a lamp, a lit window): a radial gradient to clear. |
10699
+ | `drawVignette(ctx, { width, height, x?, y?, inner?, outer?, opacity?, color? })` | The frame's edges fall into dark, from `inner` to `outer` of the half-diagonal. |
10700
+ | `lightningFlash(time, strikes, decay?)` | Flash brightness 0–1 from strike times; fill the frame with a pale blue at about 0.25 × this. |
10701
+ | `lightFlicker(time, strength?)` | A failing bulb: 0 or `strength`, in an irregular but repeatable rhythm; darken the room by it. |
10702
+
10703
+ Colours may be `#rgb`, `#rrggbb`, `rgb()` or `rgba()`; opacities multiply in.
10704
+
10705
+ ## Detective overlays
10706
+
10707
+ | Function | What it draws |
10708
+ |---|---|
10709
+ | `drawClueMarker(ctx, time, { x, y, radius?, at, duration?, color?, lineWidth? })` | The red magnifier over a clue (or a red herring): pops on at `at`, pulses, fades out over the last 400 ms of `duration` (3000). Returns its opacity; `clueMarkerAt(time, { at, duration })` gives `{ opacity, scale }`. |
10710
+ | `drawEvidenceFolder(ctx, { x, y, scale?, angle?, color?, ink?, label?, font? })` | A tabbed folder (68 × 48 px at scale 1), tilted `angle` degrees, with an optional short label. |
10711
+ | `drawClockFace(ctx, { x, y, radius?, hours, minutes, face?, ink? })` | A wall clock showing a time; `clockHandAngles(hours, minutes)` gives the hands. |
10712
+ | `drawTimeChip(ctx, time, { x, y, text, size?, font?, color?, background?, at? })` | A time or place chip (amber on black) that fades in; returns its width. |
10713
+ | `drawNameCard(ctx, time, { name, role?, at, duration?, anchor, side?, frame?, dim?, color?, nameSize?, roleSize?, font?, tilt? })` | The freeze-frame suspect card: the frame dims (`dim` 0.35) and a slanted red band names them beside their head (`anchor`), on the side with room (`side: 'auto'`). Returns its opacity. |
10714
+ | `drawNarrationBox(ctx, time, { text, start, end, speaker?, x?, width?, bottom?, size?, font?, background?, ink?, tagColor?, typeDuration? })` | A first-person narration box along the bottom: cream paper, the narrator's tag, the words typed on a whole word at a time (so every script types cleanly). `lineReveal(time, start, end)` gives `{ opacity, reveal }`. |
10715
+ | `drawSpeechBubble(ctx, time, { text, start, end, tail, speaker?, maxWidth?, size?, font?, bounds?, maxCenterY?, gap?, fill?, ink? })` | A crisp comic bubble above the speaker, its tail to `tail` (their head), kept inside `bounds`; pops on at `start`, shrinks away after `end`. |
10716
+
10717
+ The defaults fit a 1920 × 1080 frame; pass `frame`, `bounds` or `x`/`width`
10718
+ for another size. Draw overlays after the camera's transform is undone (in
10719
+ screen space) and map heads with your camera, as `cameraPoint` does.
10720
+
10721
+ ## The case board
10722
+
10723
+ A board is plain data: cards (photos of suspects, notes about clues), strings
10724
+ between them and the marker's work, each with a time.
10725
+
10726
+ ```js
10727
+ import { caseBoard, drawCaseBoard, caseBoardMarkerTip, drawCharacter, humanPose } from '@algorisys/tinyfly/characters'
10728
+
10729
+ const board = caseBoard({
10730
+ x: 60, y: 110, width: 1800, height: 900,
10731
+ cards: [
10732
+ { id: 'title', x: 900, y: 40, kind: 'note', title: 'WHO CUT THE ALARM?', width: 520, height: 96 },
10733
+ { id: 'lift', x: 900, y: 300, title: 'Lift 2', note: 'stuck at 9:40' },
10734
+ { id: 'guard', x: 330, y: 540, title: 'The guard', note: 'had the key', at: 700 },
10735
+ { id: 'wire', x: 1450, y: 220, kind: 'note', title: 'alarm wire: cut', at: 1400 },
10736
+ ],
10737
+ strings: [{ from: 'lift', to: 'guard', at: 1000 }, { from: 'lift', to: 'wire', at: 1400 }],
10738
+ marks: [
10739
+ { on: 'guard', kind: 'cross', at: 3200 },
10740
+ { on: 'title', kind: 'scribble', at: 6000, duration: 1200 },
10741
+ ],
10742
+ })
10743
+
10744
+ const nib = drawCaseBoard(ctx, board, time, {
10745
+ drawCard: (ctx, card, area) => { /* draw a portrait inside area (clipped), in the card's frame */ },
10746
+ })
10747
+ if (nib) drawMarkerHand(ctx, nib) // your own hand or pen, at the marker's nib
10748
+ ```
10749
+
10750
+ - **Cards**: `{ id, x, y, kind?, title?, note?, width?, height?, angle?, color?, at?, highlight? }`.
10751
+ `x`, `y` is where the card is pinned (its top centre), relative to the
10752
+ board. `kind: 'photo'` (default, 220 × 260) is a print with a dark picture
10753
+ area, a bold title and a red note; `kind: 'note'` (220 × 124) is a yellow
10754
+ slip with the title and note in `handFont`. A card pops up onto its pin at
10755
+ `at`; `highlight: { at, duration }` pulses an amber outline round it. Tilts
10756
+ default to a small seeded angle.
10757
+ - **Strings**: `{ from, to, at?, duration?, color? }`, red string stretching
10758
+ from one pin to the other over `duration` (600 ms), under the cards.
10759
+ - **Marks**: `{ on, kind, at, duration?, color?, width? }`, the marker drawn
10760
+ on over `duration` (1400 ms): `cross` (two diagonals, one after the
10761
+ other: ruled out), `strike` (one diagonal: half ruled out), `scribble` (a
10762
+ zigzag across the card: scribbled out) and `circle` (a loose ring round
10763
+ it). Marks stay once drawn.
10764
+ - `caseBoard` checks the board and resolves every default; an unknown card
10765
+ id or kind throws with a did-you-mean.
10766
+ - `drawCaseBoard(ctx, board, time, { drawCard })` returns the marker's nib
10767
+ while a mark is being drawn (else null), as does
10768
+ `caseBoardMarkerTip(board, time)`: put a hand there. `caseCardBox(board, id)`
10769
+ gives a card's pin, centre and corners; `caseMarkPath(board, mark)` a
10770
+ mark's stroke points; `drawPushPin` and `drawMarkerStroke(ctx, points,
10771
+ progress)` draw single pieces for your own boards.
10772
+
10773
+ ## With the characters
10774
+
10775
+ The [bean figures](character-appearance.md#bean-figures-white-outlined-stick-figures)
10776
+ come dressed for it: `castMember('beanDetective')` wears a trench coat, a
10777
+ fedora and aviator shades, and household clothes (`skirt`, `drape`,
10778
+ `bangles`; `castMember('beanSari')`) dress the witnesses. Draw a suspect in a
10779
+ photo card through `drawCard`, and anchor a name card or a speech bubble at a
10780
+ figure's head from `characterJoints`.
10781
+
10782
+ ## In the catalog
10783
+
10784
+ `npx tinyfly capabilities` lists the kit under "Noir / detective kit";
10785
+ `capabilities().noir` has it as data (`NOIR_KIT`).
10786
+
10787
+ ---
10788
+
10622
10789
  <!-- docs/character-appearance.md -->
10623
10790
 
10624
10791
  # Character Appearance
@@ -11186,8 +11353,9 @@ const stick = character(castMember('beanStick', 400)) // bare line limbs
11186
11353
  the legs, join the body without a seam: their outline is left out where it
11187
11354
  lies inside the body at the root, so the fills flow together. Under a tee or
11188
11355
  trousers the hem shows instead.
11189
- - Painter order (`joints.parts[id].order`): the back arm, the legs, the neck,
11190
- the body (and coat), the near arm and the head (and fedora). A limb reaching toward the viewer
11356
+ - Painter order (`joints.parts[id].order`): the back arm, the legs (and a
11357
+ skirt over both), the neck, the body (with its drape, and coat), the near
11358
+ arm and the head (and fedora). A limb reaching toward the viewer
11191
11359
  (hands on the knees, seated thighs) draws over the body.
11192
11360
  - `bean: { limbs, torso, limbWidth, lineWidth, outlineWidth, fill, shirt, sleeves, trousers, shoes }`:
11193
11361
  `limbs: 'tube'` (default, outlined noodles) or `'line'` (bare round-capped
@@ -11206,6 +11374,26 @@ const stick = character(castMember('beanStick', 400)) // bare line limbs
11206
11374
  (big dark aviator lenses in place of the eyes, the brows still showing,
11207
11375
  so the face keeps its expression; the same as `face: { shades: true }` on
11208
11376
  any oval-eyed face). `castMember('beanDetective', 400)` wears all three.
11377
+ - Household clothes (all off by default):
11378
+ - `skirt`: a colour (a sari or long skirt, ending just above the ankle so
11379
+ the shoes show) or `{ color, length }`, `length` 0.1–1 of the way from
11380
+ the hips to the ankles (about 0.45 for a kurta's hem over trousers). It
11381
+ follows the legs: standing or walking it is one flared shape outside both
11382
+ legs with two soft pleats; seated (`beanStanding(joints)` is false) it
11383
+ lies along each thigh to the knees and shins, its ends kept above the
11384
+ floor. Under a skirt the legs draw before the body, so the body covers
11385
+ the waist.
11386
+ - `drape`: a pallu or dupatta in that colour, a band from the shoulder by
11387
+ the neck across the chest to the far hip, inside the body's outline.
11388
+ - `bangles`: their colour; three thin rings across each forearm near the
11389
+ wrist (`BEAN_BANGLE_STOPS`), over any sleeve.
11390
+ - `castMember('beanSari', 400)` wears all three, with a blouse (`shirt`),
11391
+ a low bun and dark shoes.
11392
+
11393
+ ```js
11394
+ const kurta = character({ figure: 'bean', height: 400, hair: { style: 'bob', color: '#222' },
11395
+ bean: { shirt: '#0e7490', skirt: { color: '#0e7490', length: 0.45 }, trousers: '#f5f5f4', drape: '#fbbf24', bangles: '#dc2626' } })
11396
+ ```
11209
11397
  - Defaults: ink `#111111`, white skin, `hands: 'mitten'`, shoulders 0.04 and
11210
11398
  hips 0.02 of the height, `face: { style: 'oval', projection: 'volume', teeth: true, tongue: true }`.
11211
11399
  The bean is always drawn in the clean look (its outline is the look).
@@ -11217,12 +11405,16 @@ const stick = character(castMember('beanStick', 400)) // bare line limbs
11217
11405
  big eyes; `face.shades` puts aviators in their place.
11218
11406
  - `hands: 'mitten'` (any figure) is a plain oval mitten along the forearm.
11219
11407
  - Presets in `BEAN_CAST` (also in `CHARACTER_CAST`, group `bean`):
11220
- `beanMan`, `beanWoman`, `beanKid`, `beanBoss`, `beanDetective` and
11221
- `beanStick` (bare lines).
11408
+ `beanMan`, `beanWoman`, `beanKid`, `beanBoss`, `beanDetective`,
11409
+ `beanStick` (bare lines) and `beanSari` (a sari with a pallu and bangles).
11222
11410
  - Helpers for your own layers: `beanTorso(bean, joints)` and
11223
11411
  `beanTorsoOutline(torso)` (the body's shape), `beanLimbLine(root, joint, end)`
11224
11412
  (a limb's centre line), `mittenAt`, `beanShoeAt`, `beanOrder`, `beanOverBody`,
11225
- `drawBeanFedora`.
11413
+ `drawBeanFedora`, `beanAlongLeg(joints, side, f)` (a point along a leg) and
11414
+ `beanStanding(joints)`.
11415
+ - For detective and noir scenes around these figures (rain, blinds, torch
11416
+ beams, clue markers, name cards, a case board), see
11417
+ [Noir and Detective Scenes](noir-detective.md).
11226
11418
 
11227
11419
  ### Young adult manga cast
11228
11420
 
@@ -11606,7 +11798,8 @@ shoots up and curls on landing. At 0 the figure is drawn exactly as before.
11606
11798
  How a figure walks is data: `GAITS` has `walk` (the plain walk, the same as
11607
11799
  `walkPose()`), `bouncy`, `doubleBounce` (two bobs a step), `sneak` (tiptoe in
11608
11800
  a crouch, paws up), `strut` (chest out), `tired` (slumped and dragging) and
11609
- `run` (knees high, arms pumping, off the ground between steps).
11801
+ `run` (knees high, arms pumping, in the air with the legs apart and landing
11802
+ on a bent knee as they pass).
11610
11803
 
11611
11804
  ```js
11612
11805
  gaitPose('sneak', phase, base) // a pose at a phase of the cycle
@@ -11615,8 +11808,12 @@ gaitStrideLength('sneak', height) // ground per cycle, so feet stay plante
11615
11808
 
11616
11809
  A gait is a handful of numbers (`swing`, `knee`, `arm`, `elbow`, `forearm`,
11617
11810
  `shoulder`, `lean`, `bend`, `headTilt`, `bounce`, `bounces`, `squash`,
11618
- `crouch`, `tiptoe`, `sway`), so you can write your own and pass it in place of
11619
- a name. On a `stickFigureTarget` the `gait` prop picks one, and a string track
11811
+ `crouch`, `tiptoe`, `sway`, `flight`, `give`), so you can write your own and
11812
+ pass it in place of a name. `flight: true` puts the bounce's peak where the
11813
+ legs are furthest apart (a run) instead of where they pass (a walk), and
11814
+ `give` (degrees) bends the knee of the leg carrying the weight. Swinging arms
11815
+ hang plumb however far the gait leans, so `shoulder` (paws held up) is
11816
+ measured from the vertical. On a `stickFigureTarget` the `gait` prop picks one, and a string track
11620
11817
  switches it: `{ property: 'gait', keyframes: [{ time: 0, value: 'walk' }, { time: 3000, value: 'run' }] }`.
11621
11818
 
11622
11819
  ## Lip-sync
@@ -15706,7 +15903,7 @@ magnet.addEventListener('pointerleave', () => {
15706
15903
 
15707
15904
  <!-- capabilities: generated from the library -->
15708
15905
 
15709
- # tinyfly capabilities (v0.122.0)
15906
+ # tinyfly capabilities (v0.124.0)
15710
15907
 
15711
15908
  Generated from the library itself: every name below is accepted, and names not listed are rejected (beat scripts, code panels and `checkTracks` say which name was probably meant).
15712
15909
 
@@ -16007,7 +16204,7 @@ Appearance options of `character({ … })`, all plain data that turns with the h
16007
16204
  - `facialHair`: `cleanShaven`, `stubble`, `pencilMoustache`, `shortMoustache`, `chevron`, `handlebar`, `walrus`, `goatee`, `vanDyke`, `circleBeard`, `shortBoxed`, `fullBeard`, `longBeard`, `roundedBeard`, `pointedBeard`, `chinStrap`, `soulPatch`, `sideburns`, `muttonChops`, `moustacheStubble`
16008
16205
  - `glasses`: `round`, `square`, `sunglasses`; `hat`: `cap`, `beanie`, `hardHat`, `sunHat`, `bowler`; `ears: true`; `face: { teeth, tongue }` (shown when the mouth opens); `feet`: `round`, `flat`, `pointed`, `big`
16009
16206
  - `outfit`: `{ top: tshirt | shirt | blouse | dress, trouserStyle: plain | jeans | cargo, shirt: top colour, trousers: bottom colour, sleeves: short | long | none, bottom: trousers | shorts | skirt, collar, tie: colour, over: apron | labCoat | hoodie | cardigan | overalls | sari, overColor, shoes: boots, shoeColor }`
16010
- - `castMember(name, height)`: `boy`, `girl`, `youngMan`, `youngWoman`, `man`, `woman`, `grandpa`, `grandma`, `doctor`, `cook`, `builder`, `courier`, `teacher`, `farmer`, `animeBoy`, `animeGirl`, `animeYoungMan`, `animeYoungWoman`, `animeMan`, `animeWoman`, `animeOlderMan`, `animeOlderWoman`, `mangaYoungMan`, `mangaYoungWoman`, `mangaRival`, `mangaHeroine`, `beanMan`, `beanWoman`, `beanKid`, `beanBoss`, `beanDetective`, `beanStick`
16207
+ - `castMember(name, height)`: `boy`, `girl`, `youngMan`, `youngWoman`, `man`, `woman`, `grandpa`, `grandma`, `doctor`, `cook`, `builder`, `courier`, `teacher`, `farmer`, `animeBoy`, `animeGirl`, `animeYoungMan`, `animeYoungWoman`, `animeMan`, `animeWoman`, `animeOlderMan`, `animeOlderWoman`, `mangaYoungMan`, `mangaYoungWoman`, `mangaRival`, `mangaHeroine`, `beanMan`, `beanWoman`, `beanKid`, `beanBoss`, `beanDetective`, `beanStick`, `beanSari`
16011
16208
  - Face marks (pose fields, 0–1): `blush`, `tears`, `sweat`; close-up fields `pupil` (size, 1 usual), `lid` (upper lids lowered, 0–1), `bulge` (eyes out of the head, 0–1); `face: { nose: true, inPupil(ctx, pupil) }`; `drawCharacterHead(ctx, who, pose, { x, y, radius })` draws just the head big
16012
16209
  - Face styles: `simple`, `anime`, `oval`; `face: { style: 'anime', iris: '#4b7fce', lashes: true, ageLines: 0.8 }` uses coloured eyes and the same expressions, blinks and gaze. `ANIME_CAST` contains eight age presets, also available through `castMember`. `face: { style: 'oval' }` (the bean figure's default) draws big white oval eyes with small pupils that follow `lookX`/`lookY`, lids for `lid`, `blink` and half-open eyes, and heavy brows for `brow.*`/`browTilt`; glasses grow to fit round them.
16013
16210
  - Face shapes: `round`, `angular`; `face: { shape: 'angular', jawWidth: 0.74, chinWidth: 0.14, eyeScale: 0.8, eyeAspect: 0.65 }` sets a tapered 3D jaw and narrower anime eyes; `jawRoundness: 1` softens the cheek/chin corners (default 0 keeps sharp jaws). `MANGA_CAST` contains four original young adult presets; hair styles `mangaSpikes` and `mangaSweep` remain editable.
@@ -16016,6 +16213,34 @@ Appearance options of `character({ … })`, all plain data that turns with the h
16016
16213
  - `meetHands(kind, a, b)` (stand them `meetingSpacing(kind, a, b)` apart): `handshake`, `highFive`, `fistBump`, `handOver`; `embrace(a, b)` (a hug, `embraceSpacing` apart); `helpUp(helper, sitter, progress)` (0 on the floor, hand taken; 1 standing; `helpUpSpacing` apart)
16017
16214
  - Everyday cycles like a gait: `humanCyclePose('sweeping' | 'brushing', phase, base)` (0 → 1 is one stroke and back; sweeping with `holding: { right: 'broom' }`)
16018
16215
 
16216
+ ## Noir / detective kit
16217
+
16218
+ Canvas drawing functions for detective and noir scenes (see docs/noir-detective.md). Times are ms; every one is a pure function of its options and the time (rain is seeded), so frames draw the same in any order. Text and fonts are the caller’s.
16219
+
16220
+ - `drawRain(ctx, time, { x, y, width, height, drops?, opacity?, color?, speed?, length?, slant?, lineWidth?, seed? })`: rain streaks falling in a box (a window, the frame), clipped to it; seeded, a pure function of time
16221
+ - `drawBlinds(ctx, { x, y, width, height, opacity?, slope?, spacing?, band?, color? })`: key light through venetian blinds: slanted bright bands
16222
+ - `drawDarkness(ctx, { amount, cones?: [{ x, y, angle (deg), length, width }], holes?: [{ x, y, radius }], bounds?, color?, opacity?, beam?, beamOpacity? })`: a dark room with torch beams and round holes of light cut out (coneCorners(cone) gives a beam’s corners)
16223
+ - `drawGlow(ctx, { x, y, radius, color?, opacity? })`: a soft pool of light
16224
+ - `drawVignette(ctx, { width, height, x?, y?, inner?, outer?, opacity?, color? })`: the frame’s edges fall into dark
16225
+ - `lightningFlash(time, strikes, decay?)`: flash brightness 0..1 from strike times (ms)
16226
+ - `lightFlicker(time, strength?)`: a failing bulb: how much darker the room is (0 or strength)
16227
+ - `drawClueMarker(ctx, time, { x, y, radius?, at, duration?, color?, lineWidth? })`: the red magnifier over a clue: pops on, pulses, fades (clueMarkerAt gives its opacity and scale)
16228
+ - `drawEvidenceFolder(ctx, { x, y, scale?, angle?, color?, ink?, label?, font? })`: a tabbed evidence folder
16229
+ - `drawClockFace(ctx, { x, y, radius?, hours, minutes, face?, ink? })`: a wall clock showing a time (clockHandAngles gives the hands)
16230
+ - `drawTimeChip(ctx, time, { x, y, text, size?, font?, color?, background?, at? })`: a time/place chip in a corner; returns its width
16231
+ - `drawNameCard(ctx, time, { name, role?, at, duration?, anchor, side?, frame?, dim?, color?, font?, tilt? })`: a freeze-frame suspect card: the frame dims, a slanted red band beside the head
16232
+ - `drawNarrationBox(ctx, time, { text, start, end, speaker?, x?, width?, bottom?, size?, font?, typeDuration? })`: a first-person narration box along the bottom, words typed on (lineReveal gives opacity and reveal)
16233
+ - `drawSpeechBubble(ctx, time, { text, start, end, tail, speaker?, maxWidth?, size?, font?, bounds?, maxCenterY?, gap? })`: a comic speech bubble above the speaker, tail to the head, popping on
16234
+ - `caseBoard({ x, y, width, height, cards, strings?, marks?, cork?, frame?, font?, handFont?, seed? })`: checks and resolves a case board (did-you-mean on unknown card ids and kinds)
16235
+ - `drawCaseBoard(ctx, board, time, { drawCard? })`: the board at a time: cork, red strings stretching, cards popping up on pins, marker strokes; returns the nib point while a mark is drawn
16236
+ - `caseBoardMarkerTip(board, time)`: where the marker’s nib is (for a hand), or null
16237
+ - `caseCardBox(board, id)`: a card’s pin, centre and corners, scene px
16238
+ - `caseMarkPath(board, { on, kind })`: a mark’s stroke points
16239
+ - `drawPushPin(ctx, x, y, { color?, radius? })`: a red push pin
16240
+ - `drawMarkerStroke(ctx, points, progress, { color?, width? })`: the first part of a marker stroke; returns the nib
16241
+
16242
+ Case board cards: { id, x, y (its pin, relative to the board), kind?, title?, note?, width?, height?, angle?, color?, at?, highlight?: { at, duration } }, kinds `photo`, `note`. Strings: { from, to, at?, duration?, color? }. Marks: { on, kind, at, duration?, color?, width? }, kinds `cross` (two diagonals across the card, one after the other (ruled out)), `strike` (one diagonal, bottom-left to top-right (half ruled out)), `scribble` (a zigzag back and forth across the card (scribbled out)), `circle` (a loose ring round the card (this one)).
16243
+
16019
16244
  ## Code panel
16020
16245
 
16021
16246
  `codePanel({ code, language, x, y, fontSize?, lineHeight?, width? })`: a code listing as a scene object. Languages: `go`, `rust`, `csharp`, `javascript`, `typescript`, `python`, `plain`. Remove styles: `wipe`, `fly`, `blur`.