@algorisys/tinyfly 0.122.0 → 0.123.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.123.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.123.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.123.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.123.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
@@ -8695,7 +8717,7 @@ path for all of that:
8695
8717
  </figure>
8696
8718
 
8697
8719
  <!-- 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>
8720
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.123.0/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
8699
8721
  ```
8700
8722
 
8701
8723
  Every `[data-tinyfly-embed]` mounts when the page is ready, with no per-post
@@ -9281,7 +9303,7 @@ lesson's step options (`duration`, `easing`, `delay`).
9281
9303
  <figcaption>The determinant is the area of the unit square after the map.</figcaption>
9282
9304
  </figure>
9283
9305
 
9284
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.122.0/cdn/tinyfly-math.iife.js" data-tinyfly-auto></script>
9306
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.123.0/cdn/tinyfly-math.iife.js" data-tinyfly-auto></script>
9285
9307
  ```
9286
9308
 
9287
9309
  The figure draws itself into an SVG and redraws from the timeline whenever the
@@ -10415,8 +10437,8 @@ On a page with no build step, load the maps add-on after the browser bundle; it
10415
10437
  adds to the same `tinyfly` global:
10416
10438
 
10417
10439
  ```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>
10440
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.123.0/cdn/tinyfly.iife.js"></script>
10441
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.123.0/cdn/tinyfly-maps.iife.js"></script>
10420
10442
  ```
10421
10443
 
10422
10444
  It is a separate script because the offline world map it carries adds about
@@ -10619,6 +10641,148 @@ prop, or the depths to slot it between fingers.
10619
10641
 
10620
10642
  ---
10621
10643
 
10644
+ <!-- docs/noir-detective.md -->
10645
+
10646
+ # Noir and Detective Scenes
10647
+
10648
+ A kit for detective stories and film-noir moods on a canvas: rain on the
10649
+ window, street light through venetian blinds, a dark room with a torch beam,
10650
+ soft pools of light and a vignette; the red magnifier that marks a clue, an
10651
+ evidence folder, a wall clock and a time chip, a freeze-frame name card for a
10652
+ suspect, a first-person narration box and speech bubbles; and a case board
10653
+ with pinned cards, red string and the marker's cross-outs and scribble-outs.
10654
+
10655
+ Every function draws on a Canvas 2D context, takes the time in ms and plain
10656
+ options, and draws the same thing for the same input: rain comes from a
10657
+ seeded generator, never `Math.random`, so a frame looks the same whether it
10658
+ is rendered in order, out of order or scrubbed to. Text is always yours (any
10659
+ language or script) and so are the fonts (`font` is a CSS family list).
10660
+
10661
+ ```js
10662
+ import { character, castMember, drawCharacter, humanPose, HUMAN_POSES,
10663
+ drawRain, drawBlinds, drawDarkness, drawVignette, drawClueMarker,
10664
+ drawNameCard, drawNarrationBox, drawTimeChip } from '@algorisys/tinyfly/characters'
10665
+
10666
+ const detective = character(castMember('beanDetective', 460))
10667
+
10668
+ function frame(ctx, time) {
10669
+ ctx.fillStyle = '#232b37'
10670
+ ctx.fillRect(0, 0, 1920, 1080)
10671
+ drawRain(ctx, time, { x: 1500, y: 160, width: 340, height: 440 }) // the window
10672
+ drawBlinds(ctx, { x: 0, y: 0, width: 1920, height: 1080, opacity: 0.08 })
10673
+ ctx.save(); ctx.translate(560, 880)
10674
+ drawCharacter(ctx, detective, humanPose({ ...HUMAN_POSES.think, turn: 0.45 }), time)
10675
+ ctx.restore()
10676
+ drawDarkness(ctx, { amount: 1, cones: [{ x: 640, y: 520, angle: 15, length: 760, width: 190 }] })
10677
+ drawClueMarker(ctx, time, { x: 900, y: 680, at: 1500 })
10678
+ drawNameCard(ctx, time, { name: 'The witness', role: 'heard footsteps', at: 6800, anchor: { x: 1340, y: 470 } })
10679
+ drawVignette(ctx, { width: 1920, height: 1080 })
10680
+ drawTimeChip(ctx, time, { x: 50, y: 40, text: 'Tuesday · 9:40 PM' })
10681
+ drawNarrationBox(ctx, time, { text: 'It rained all night.', start: 300, end: 3400, speaker: 'Case file #1' })
10682
+ }
10683
+ ```
10684
+
10685
+ The [Noir Case File](https://tinyfly.app/examples/live-noir-case-file)
10686
+ example plays a whole scene and its case board.
10687
+
10688
+ ## Atmosphere
10689
+
10690
+ | Function | What it draws |
10691
+ |---|---|
10692
+ | `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. |
10693
+ | `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). |
10694
+ | `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. |
10695
+ | `drawGlow(ctx, { x, y, radius, color?, opacity? })` | A soft pool of light (a lamp, a lit window): a radial gradient to clear. |
10696
+ | `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. |
10697
+ | `lightningFlash(time, strikes, decay?)` | Flash brightness 0–1 from strike times; fill the frame with a pale blue at about 0.25 × this. |
10698
+ | `lightFlicker(time, strength?)` | A failing bulb: 0 or `strength`, in an irregular but repeatable rhythm; darken the room by it. |
10699
+
10700
+ Colours may be `#rgb`, `#rrggbb`, `rgb()` or `rgba()`; opacities multiply in.
10701
+
10702
+ ## Detective overlays
10703
+
10704
+ | Function | What it draws |
10705
+ |---|---|
10706
+ | `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 }`. |
10707
+ | `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. |
10708
+ | `drawClockFace(ctx, { x, y, radius?, hours, minutes, face?, ink? })` | A wall clock showing a time; `clockHandAngles(hours, minutes)` gives the hands. |
10709
+ | `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. |
10710
+ | `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. |
10711
+ | `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 }`. |
10712
+ | `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`. |
10713
+
10714
+ The defaults fit a 1920 × 1080 frame; pass `frame`, `bounds` or `x`/`width`
10715
+ for another size. Draw overlays after the camera's transform is undone (in
10716
+ screen space) and map heads with your camera, as `cameraPoint` does.
10717
+
10718
+ ## The case board
10719
+
10720
+ A board is plain data: cards (photos of suspects, notes about clues), strings
10721
+ between them and the marker's work, each with a time.
10722
+
10723
+ ```js
10724
+ import { caseBoard, drawCaseBoard, caseBoardMarkerTip, drawCharacter, humanPose } from '@algorisys/tinyfly/characters'
10725
+
10726
+ const board = caseBoard({
10727
+ x: 60, y: 110, width: 1800, height: 900,
10728
+ cards: [
10729
+ { id: 'title', x: 900, y: 40, kind: 'note', title: 'WHO CUT THE ALARM?', width: 520, height: 96 },
10730
+ { id: 'lift', x: 900, y: 300, title: 'Lift 2', note: 'stuck at 9:40' },
10731
+ { id: 'guard', x: 330, y: 540, title: 'The guard', note: 'had the key', at: 700 },
10732
+ { id: 'wire', x: 1450, y: 220, kind: 'note', title: 'alarm wire: cut', at: 1400 },
10733
+ ],
10734
+ strings: [{ from: 'lift', to: 'guard', at: 1000 }, { from: 'lift', to: 'wire', at: 1400 }],
10735
+ marks: [
10736
+ { on: 'guard', kind: 'cross', at: 3200 },
10737
+ { on: 'title', kind: 'scribble', at: 6000, duration: 1200 },
10738
+ ],
10739
+ })
10740
+
10741
+ const nib = drawCaseBoard(ctx, board, time, {
10742
+ drawCard: (ctx, card, area) => { /* draw a portrait inside area (clipped), in the card's frame */ },
10743
+ })
10744
+ if (nib) drawMarkerHand(ctx, nib) // your own hand or pen, at the marker's nib
10745
+ ```
10746
+
10747
+ - **Cards**: `{ id, x, y, kind?, title?, note?, width?, height?, angle?, color?, at?, highlight? }`.
10748
+ `x`, `y` is where the card is pinned (its top centre), relative to the
10749
+ board. `kind: 'photo'` (default, 220 × 260) is a print with a dark picture
10750
+ area, a bold title and a red note; `kind: 'note'` (220 × 124) is a yellow
10751
+ slip with the title and note in `handFont`. A card pops up onto its pin at
10752
+ `at`; `highlight: { at, duration }` pulses an amber outline round it. Tilts
10753
+ default to a small seeded angle.
10754
+ - **Strings**: `{ from, to, at?, duration?, color? }`, red string stretching
10755
+ from one pin to the other over `duration` (600 ms), under the cards.
10756
+ - **Marks**: `{ on, kind, at, duration?, color?, width? }`, the marker drawn
10757
+ on over `duration` (1400 ms): `cross` (two diagonals, one after the
10758
+ other: ruled out), `strike` (one diagonal: half ruled out), `scribble` (a
10759
+ zigzag across the card: scribbled out) and `circle` (a loose ring round
10760
+ it). Marks stay once drawn.
10761
+ - `caseBoard` checks the board and resolves every default; an unknown card
10762
+ id or kind throws with a did-you-mean.
10763
+ - `drawCaseBoard(ctx, board, time, { drawCard })` returns the marker's nib
10764
+ while a mark is being drawn (else null), as does
10765
+ `caseBoardMarkerTip(board, time)`: put a hand there. `caseCardBox(board, id)`
10766
+ gives a card's pin, centre and corners; `caseMarkPath(board, mark)` a
10767
+ mark's stroke points; `drawPushPin` and `drawMarkerStroke(ctx, points,
10768
+ progress)` draw single pieces for your own boards.
10769
+
10770
+ ## With the characters
10771
+
10772
+ The [bean figures](character-appearance.md#bean-figures-white-outlined-stick-figures)
10773
+ come dressed for it: `castMember('beanDetective')` wears a trench coat, a
10774
+ fedora and aviator shades, and household clothes (`skirt`, `drape`,
10775
+ `bangles`; `castMember('beanSari')`) dress the witnesses. Draw a suspect in a
10776
+ photo card through `drawCard`, and anchor a name card or a speech bubble at a
10777
+ figure's head from `characterJoints`.
10778
+
10779
+ ## In the catalog
10780
+
10781
+ `npx tinyfly capabilities` lists the kit under "Noir / detective kit";
10782
+ `capabilities().noir` has it as data (`NOIR_KIT`).
10783
+
10784
+ ---
10785
+
10622
10786
  <!-- docs/character-appearance.md -->
10623
10787
 
10624
10788
  # Character Appearance
@@ -11186,8 +11350,9 @@ const stick = character(castMember('beanStick', 400)) // bare line limbs
11186
11350
  the legs, join the body without a seam: their outline is left out where it
11187
11351
  lies inside the body at the root, so the fills flow together. Under a tee or
11188
11352
  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
11353
+ - Painter order (`joints.parts[id].order`): the back arm, the legs (and a
11354
+ skirt over both), the neck, the body (with its drape, and coat), the near
11355
+ arm and the head (and fedora). A limb reaching toward the viewer
11191
11356
  (hands on the knees, seated thighs) draws over the body.
11192
11357
  - `bean: { limbs, torso, limbWidth, lineWidth, outlineWidth, fill, shirt, sleeves, trousers, shoes }`:
11193
11358
  `limbs: 'tube'` (default, outlined noodles) or `'line'` (bare round-capped
@@ -11206,6 +11371,26 @@ const stick = character(castMember('beanStick', 400)) // bare line limbs
11206
11371
  (big dark aviator lenses in place of the eyes, the brows still showing,
11207
11372
  so the face keeps its expression; the same as `face: { shades: true }` on
11208
11373
  any oval-eyed face). `castMember('beanDetective', 400)` wears all three.
11374
+ - Household clothes (all off by default):
11375
+ - `skirt`: a colour (a sari or long skirt, ending just above the ankle so
11376
+ the shoes show) or `{ color, length }`, `length` 0.1–1 of the way from
11377
+ the hips to the ankles (about 0.45 for a kurta's hem over trousers). It
11378
+ follows the legs: standing or walking it is one flared shape outside both
11379
+ legs with two soft pleats; seated (`beanStanding(joints)` is false) it
11380
+ lies along each thigh to the knees and shins, its ends kept above the
11381
+ floor. Under a skirt the legs draw before the body, so the body covers
11382
+ the waist.
11383
+ - `drape`: a pallu or dupatta in that colour, a band from the shoulder by
11384
+ the neck across the chest to the far hip, inside the body's outline.
11385
+ - `bangles`: their colour; three thin rings across each forearm near the
11386
+ wrist (`BEAN_BANGLE_STOPS`), over any sleeve.
11387
+ - `castMember('beanSari', 400)` wears all three, with a blouse (`shirt`),
11388
+ a low bun and dark shoes.
11389
+
11390
+ ```js
11391
+ const kurta = character({ figure: 'bean', height: 400, hair: { style: 'bob', color: '#222' },
11392
+ bean: { shirt: '#0e7490', skirt: { color: '#0e7490', length: 0.45 }, trousers: '#f5f5f4', drape: '#fbbf24', bangles: '#dc2626' } })
11393
+ ```
11209
11394
  - Defaults: ink `#111111`, white skin, `hands: 'mitten'`, shoulders 0.04 and
11210
11395
  hips 0.02 of the height, `face: { style: 'oval', projection: 'volume', teeth: true, tongue: true }`.
11211
11396
  The bean is always drawn in the clean look (its outline is the look).
@@ -11217,12 +11402,16 @@ const stick = character(castMember('beanStick', 400)) // bare line limbs
11217
11402
  big eyes; `face.shades` puts aviators in their place.
11218
11403
  - `hands: 'mitten'` (any figure) is a plain oval mitten along the forearm.
11219
11404
  - Presets in `BEAN_CAST` (also in `CHARACTER_CAST`, group `bean`):
11220
- `beanMan`, `beanWoman`, `beanKid`, `beanBoss`, `beanDetective` and
11221
- `beanStick` (bare lines).
11405
+ `beanMan`, `beanWoman`, `beanKid`, `beanBoss`, `beanDetective`,
11406
+ `beanStick` (bare lines) and `beanSari` (a sari with a pallu and bangles).
11222
11407
  - Helpers for your own layers: `beanTorso(bean, joints)` and
11223
11408
  `beanTorsoOutline(torso)` (the body's shape), `beanLimbLine(root, joint, end)`
11224
11409
  (a limb's centre line), `mittenAt`, `beanShoeAt`, `beanOrder`, `beanOverBody`,
11225
- `drawBeanFedora`.
11410
+ `drawBeanFedora`, `beanAlongLeg(joints, side, f)` (a point along a leg) and
11411
+ `beanStanding(joints)`.
11412
+ - For detective and noir scenes around these figures (rain, blinds, torch
11413
+ beams, clue markers, name cards, a case board), see
11414
+ [Noir and Detective Scenes](noir-detective.md).
11226
11415
 
11227
11416
  ### Young adult manga cast
11228
11417
 
@@ -15706,7 +15895,7 @@ magnet.addEventListener('pointerleave', () => {
15706
15895
 
15707
15896
  <!-- capabilities: generated from the library -->
15708
15897
 
15709
- # tinyfly capabilities (v0.122.0)
15898
+ # tinyfly capabilities (v0.123.0)
15710
15899
 
15711
15900
  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
15901
 
@@ -16007,7 +16196,7 @@ Appearance options of `character({ … })`, all plain data that turns with the h
16007
16196
  - `facialHair`: `cleanShaven`, `stubble`, `pencilMoustache`, `shortMoustache`, `chevron`, `handlebar`, `walrus`, `goatee`, `vanDyke`, `circleBeard`, `shortBoxed`, `fullBeard`, `longBeard`, `roundedBeard`, `pointedBeard`, `chinStrap`, `soulPatch`, `sideburns`, `muttonChops`, `moustacheStubble`
16008
16197
  - `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
16198
  - `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`
16199
+ - `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
16200
  - 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
16201
  - 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
16202
  - 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 +16205,34 @@ Appearance options of `character({ … })`, all plain data that turns with the h
16016
16205
  - `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
16206
  - Everyday cycles like a gait: `humanCyclePose('sweeping' | 'brushing', phase, base)` (0 → 1 is one stroke and back; sweeping with `holding: { right: 'broom' }`)
16018
16207
 
16208
+ ## Noir / detective kit
16209
+
16210
+ 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.
16211
+
16212
+ - `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
16213
+ - `drawBlinds(ctx, { x, y, width, height, opacity?, slope?, spacing?, band?, color? })`: key light through venetian blinds: slanted bright bands
16214
+ - `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)
16215
+ - `drawGlow(ctx, { x, y, radius, color?, opacity? })`: a soft pool of light
16216
+ - `drawVignette(ctx, { width, height, x?, y?, inner?, outer?, opacity?, color? })`: the frame’s edges fall into dark
16217
+ - `lightningFlash(time, strikes, decay?)`: flash brightness 0..1 from strike times (ms)
16218
+ - `lightFlicker(time, strength?)`: a failing bulb: how much darker the room is (0 or strength)
16219
+ - `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)
16220
+ - `drawEvidenceFolder(ctx, { x, y, scale?, angle?, color?, ink?, label?, font? })`: a tabbed evidence folder
16221
+ - `drawClockFace(ctx, { x, y, radius?, hours, minutes, face?, ink? })`: a wall clock showing a time (clockHandAngles gives the hands)
16222
+ - `drawTimeChip(ctx, time, { x, y, text, size?, font?, color?, background?, at? })`: a time/place chip in a corner; returns its width
16223
+ - `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
16224
+ - `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)
16225
+ - `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
16226
+ - `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)
16227
+ - `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
16228
+ - `caseBoardMarkerTip(board, time)`: where the marker’s nib is (for a hand), or null
16229
+ - `caseCardBox(board, id)`: a card’s pin, centre and corners, scene px
16230
+ - `caseMarkPath(board, { on, kind })`: a mark’s stroke points
16231
+ - `drawPushPin(ctx, x, y, { color?, radius? })`: a red push pin
16232
+ - `drawMarkerStroke(ctx, points, progress, { color?, width? })`: the first part of a marker stroke; returns the nib
16233
+
16234
+ 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)).
16235
+
16019
16236
  ## Code panel
16020
16237
 
16021
16238
  `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`.