vizmatic 0.3.2 → 0.5.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.
Files changed (150) hide show
  1. package/PROMPT.md +75 -525
  2. package/README.md +87 -578
  3. package/ROADMAP.md +49 -67
  4. package/SCIENCE.md +250 -0
  5. package/assets/THIRD_PARTY_LICENSES.md +40 -1
  6. package/assets/fonts/InstrumentSerif-Italic.ttf +0 -0
  7. package/assets/fonts/InstrumentSerif-Regular.ttf +0 -0
  8. package/assets/licenses/raster-codecs-MIT.txt +74 -0
  9. package/dist/chunk-3F2VQ7NW.js +1 -0
  10. package/dist/chunk-4XE64I2U.js +755 -0
  11. package/dist/chunk-JHHPLALU.js +79 -0
  12. package/dist/chunk-LTX44BAE.js +112 -0
  13. package/dist/chunk-MLKGABMK.js +9 -0
  14. package/dist/chunk-PSBF4TEK.js +1 -0
  15. package/dist/chunk-RPAHMKAR.js +605 -0
  16. package/dist/chunk-RWF4VBUL.js +3617 -0
  17. package/dist/chunk-WHT6HRMX.js +4201 -0
  18. package/dist/cli.js +371 -10
  19. package/dist/index.cjs +11129 -2922
  20. package/dist/index.d.cts +1225 -369
  21. package/dist/index.d.ts +1225 -369
  22. package/dist/index.js +6220 -3015
  23. package/dist/math-LXB4FH4E.js +7 -0
  24. package/dist/math-QVCETQDQ.js +1 -0
  25. package/dist/scene-browser-assets.d.ts +38 -0
  26. package/dist/scene-browser-assets.js +53 -0
  27. package/dist/scene-browser-chunks/chunk-5MVLYGXM.js +70 -0
  28. package/dist/scene-browser-chunks/chunk-ASXKN3NU.js +1 -0
  29. package/dist/scene-browser-chunks/chunk-CM5Y5LZP.js +1 -0
  30. package/dist/scene-browser-chunks/chunk-DP7NB4EW.js +6 -0
  31. package/dist/scene-browser-chunks/emscripten-module.browser-M5AEKJGE.js +1 -0
  32. package/dist/scene-browser-chunks/ffi-FL6ORJU3.js +1 -0
  33. package/dist/scene-browser-chunks/module-ES6BEMUI-JD5S5VKR.js +1 -0
  34. package/dist/scene-browser-chunks/module-asyncify-2EFITU5U-HWPFJFJC.js +1 -0
  35. package/dist/scene-browser-chunks/scene-browser-layout-M3XSXMV4.js +27 -0
  36. package/dist/scene-browser.d.ts +117 -0
  37. package/dist/scene-browser.js +220 -0
  38. package/dist/scene-cli.d.ts +1 -0
  39. package/dist/scene-cli.js +4 -0
  40. package/dist/scene-runtime.cjs +995 -0
  41. package/dist/scene-runtime.d.cts +81 -0
  42. package/dist/scene-runtime.d.ts +81 -0
  43. package/dist/scene-runtime.js +22 -0
  44. package/dist/server-2FYHZ4UO.js +331 -0
  45. package/dist/stage-browser/browser.d.ts +2482 -0
  46. package/dist/stage-browser/chunk-SQE76S5B.js +1 -0
  47. package/dist/stage-browser/chunk-VZNL6JY2.js +59 -0
  48. package/dist/stage-browser/dagre.esm-N2NIVIAZ.js +6 -0
  49. package/dist/stage-browser/math-4WFNHVV2.js +18 -0
  50. package/dist/stage-browser/stage.js +19 -0
  51. package/dist/stage-export.cjs +4950 -0
  52. package/dist/stage-export.d.cts +112 -0
  53. package/dist/stage-export.d.ts +112 -0
  54. package/dist/stage-export.js +544 -0
  55. package/dist/stage.cjs +9745 -0
  56. package/dist/stage.d.cts +1678 -0
  57. package/dist/stage.d.ts +1678 -0
  58. package/dist/stage.js +5404 -0
  59. package/dist/svg-import-Djj2q7Pc.d.cts +742 -0
  60. package/dist/svg-import-Djj2q7Pc.d.ts +742 -0
  61. package/dist/video-CcHW1qhV.d.cts +532 -0
  62. package/dist/video-CcHW1qhV.d.ts +532 -0
  63. package/examples/README.md +18 -0
  64. package/examples/agent-pipeline.tsx +4 -4
  65. package/examples/animated-pipeline.tsx +1 -5
  66. package/examples/attention-head.tsx +12 -12
  67. package/examples/aurora-incident.tsx +4 -3
  68. package/examples/building-blocks.tsx +8 -9
  69. package/examples/catalog-charts.tsx +4 -4
  70. package/examples/catalog-content.tsx +7 -9
  71. package/examples/catalog-convolution-kernel.tsx +116 -0
  72. package/examples/catalog-data.tsx +2 -8
  73. package/examples/catalog-dataflow.tsx +5 -9
  74. package/examples/catalog-dense.tsx +80 -0
  75. package/examples/catalog-deployment.tsx +5 -11
  76. package/examples/catalog-diagrams.tsx +13 -16
  77. package/examples/catalog-drawing.tsx +7 -7
  78. package/examples/catalog-flows.tsx +4 -4
  79. package/examples/catalog-foundations.tsx +11 -11
  80. package/examples/catalog-gaussian-blur.tsx +146 -0
  81. package/examples/catalog-image-tensors.tsx +115 -0
  82. package/examples/catalog-ml.tsx +36 -31
  83. package/examples/catalog-numeric-matrices.tsx +93 -0
  84. package/examples/catalog-photo-blur.tsx +209 -0
  85. package/examples/catalog-science-ai.tsx +130 -0
  86. package/examples/catalog-science-chemistry.tsx +103 -0
  87. package/examples/catalog-science-math.tsx +93 -0
  88. package/examples/catalog-science-physics.tsx +84 -0
  89. package/examples/catalog-sequence.tsx +59 -38
  90. package/examples/data-pipeline-lineage-presentation.tsx +5 -0
  91. package/examples/data-pipeline-lineage.tsx +85 -0
  92. package/examples/daybreak-launch.tsx +1 -0
  93. package/examples/desired-quadrant.tsx +7 -8
  94. package/examples/engineering-dashboard-presentation.tsx +13 -0
  95. package/examples/engineering-dashboard.tsx +160 -0
  96. package/examples/engineering-flow.tsx +2 -4
  97. package/examples/eval-dashboard.tsx +6 -6
  98. package/examples/films/attention.ts +278 -0
  99. package/examples/films/cache-miss.ts +431 -0
  100. package/examples/films/catalog.json +132 -0
  101. package/examples/films/central-limit.ts +269 -0
  102. package/examples/films/complex-maps.ts +273 -0
  103. package/examples/films/deck-example.ts +224 -0
  104. package/examples/films/euler-circle.ts +179 -0
  105. package/examples/films/fourier-epicycles.ts +265 -0
  106. package/examples/films/gradient-descent.ts +345 -0
  107. package/examples/films/linear-maps.ts +175 -0
  108. package/examples/films/lorenz.ts +207 -0
  109. package/examples/films/pythagoras.ts +185 -0
  110. package/examples/films/taylor-series.ts +159 -0
  111. package/examples/films/vizmatic-title.ts +117 -0
  112. package/examples/llm-serving-stack-presentation.tsx +5 -0
  113. package/examples/llm-serving-stack.tsx +94 -0
  114. package/examples/model-garden.tsx +1 -0
  115. package/examples/model-router.tsx +6 -6
  116. package/examples/nccl-all-gather.tsx +3 -3
  117. package/examples/nccl-all-reduce.tsx +3 -3
  118. package/examples/nccl-all-to-all.tsx +1 -1
  119. package/examples/nccl-broadcast.tsx +1 -1
  120. package/examples/nccl-reduce-scatter.tsx +5 -5
  121. package/examples/orthogonal-routing.tsx +4 -4
  122. package/examples/pareto-frontier.tsx +9 -10
  123. package/examples/presentation-frame.tsx +6 -6
  124. package/examples/pressure-mechanism.scene.json +14 -0
  125. package/examples/production-system-map-presentation.tsx +5 -0
  126. package/examples/production-system-map.tsx +130 -0
  127. package/examples/rag-graph.tsx +7 -7
  128. package/examples/release-card.tsx +5 -5
  129. package/examples/spec-anatomy.tsx +5 -5
  130. package/examples/system-architecture.tsx +19 -32
  131. package/examples/theme-system.tsx +1 -1
  132. package/examples/token-matrix.tsx +4 -2
  133. package/examples/transparent-badge.tsx +1 -2
  134. package/examples/videos/README.md +62 -0
  135. package/examples/videos/calculus-tangent.tsx +101 -0
  136. package/examples/videos/catalyst-pathway.tsx +56 -0
  137. package/examples/videos/causal-attention.tsx +91 -0
  138. package/examples/videos/convolution-kernel.tsx +34 -0
  139. package/examples/videos/gaussian-blur.tsx +32 -0
  140. package/examples/videos/image-to-matrix.tsx +22 -0
  141. package/examples/videos/matrix-multiplication.tsx +128 -0
  142. package/examples/videos/photo-gaussian-blur.tsx +39 -0
  143. package/examples/videos/request-lifecycle.tsx +99 -0
  144. package/examples/videos/signal-to-story.tsx +126 -0
  145. package/examples/videos/wave-interference.tsx +80 -0
  146. package/examples/vizmatic-bare.d.ts +1 -0
  147. package/examples/vizmatic-hero.tsx +9 -18
  148. package/examples/website-workflow.tsx +7 -7
  149. package/examples/weekend-field-notes.tsx +3 -2
  150. package/package.json +77 -12
@@ -0,0 +1,2482 @@
1
+ /**
2
+ * Vector geometry for the stage engine.
3
+ *
4
+ * Every shape is a list of rings. A ring is a run of cubic Bezier segments in a
5
+ * flat array: [x0, y0, c1x, c1y, c2x, c2y, x1, y1, c1x, ...]. One representation
6
+ * for lines, arcs, glyphs, and imported SVG makes any shape morph into any other.
7
+ *
8
+ * Rings and paths are immutable by convention. Length tables and bounds are
9
+ * cached per ring, so sampling the same geometry on many frames stays cheap.
10
+ */
11
+ type Vec = readonly [number, number];
12
+ /** 2x3 affine matrix: x' = a*x + c*y + e, y' = b*x + d*y + f. */
13
+ type Mat = readonly [number, number, number, number, number, number];
14
+ interface Ring {
15
+ readonly p: Float64Array;
16
+ readonly closed: boolean;
17
+ /** Every segment is a straight line, so painters can use cheap line commands. */
18
+ readonly straight?: boolean;
19
+ }
20
+ type Path = readonly Ring[];
21
+ interface Bounds {
22
+ readonly x: number;
23
+ readonly y: number;
24
+ readonly width: number;
25
+ readonly height: number;
26
+ }
27
+ declare const IDENTITY: Mat;
28
+ declare const EMPTY_BOUNDS: Bounds;
29
+ declare function mul(m: Mat, n: Mat): Mat;
30
+ declare function invert(m: Mat): Mat;
31
+ declare function apply(m: Mat, x: number, y: number): [number, number];
32
+ /** Translate * Rotate * Scale * Translate(-pivot). */
33
+ declare function compose(x: number, y: number, rotation: number, sx: number, sy: number, px: number, py: number): Mat;
34
+ /** Mean scale of a matrix, used to scale stroke widths with the geometry. */
35
+ declare function matScale(m: Mat): number;
36
+ declare function ring(points: ArrayLike<number>, closed?: boolean): Ring;
37
+ declare function segmentCount(r: Ring): number;
38
+ declare function linePath(a: Vec, b: Vec): Path;
39
+ declare function polyPath(points: readonly Vec[], closed?: boolean): Path;
40
+ /** A smooth cubic spline through every point (Catmull-Rom, centripetal-ish tension). */
41
+ declare function smoothPath(points: readonly Vec[], closed?: boolean, tension?: number): Path;
42
+ /** Elliptical or circular arc, with one cubic per 45 degrees at most. */
43
+ declare function arcPath(cx: number, cy: number, rx: number, ry: number, from: number, to: number): Path;
44
+ declare function circlePath(cx: number, cy: number, r: number): Path;
45
+ declare function rectPath(x: number, y: number, width: number, height: number, radius?: number): Path;
46
+ /** Smooth open curve through samples of a parametric function. */
47
+ declare function parametricPath(f: (t: number) => Vec, from: number, to: number, samples?: number): Path;
48
+ /**
49
+ * Hermite fit through samples. Non-finite samples split the curve into separate
50
+ * rings, so poles such as tan(x) leave gaps instead of drawing vertical strokes.
51
+ */
52
+ declare function curveThrough(points: readonly Vec[]): Path;
53
+ declare function concat(...paths: readonly Path[]): Path;
54
+ declare function transformPath(path: Path, m: Mat): Path;
55
+ /** Deform a path through any point function. Segments split first, so curved maps stay smooth. */
56
+ declare function warpPath(path: Path, f: (x: number, y: number) => Vec, subdivisions?: number): Path;
57
+ /** Split every segment of a ring into n equal parameter pieces. Geometry is unchanged. */
58
+ declare function subdivideEach(r: Ring, n: number): Ring;
59
+ declare function ringLength(r: Ring): number;
60
+ declare function pathLength(path: Path): number;
61
+ /** Keep the part of a ring between two arc-length fractions. */
62
+ declare function trimRing(r: Ring, from: number, to: number): Ring | null;
63
+ /**
64
+ * Keep a fraction of a path. With `each`, every ring draws at once, which suits
65
+ * glyphs. Without it, rings draw one after another along the total length.
66
+ */
67
+ declare function trimPath(path: Path, from: number, to: number, each?: boolean): Path;
68
+ /** Point at an arc-length fraction of a path, in the path's own coordinates. */
69
+ declare function pointAt(path: Path, fraction: number): [number, number];
70
+ /** Unit tangent at an arc-length fraction, in the path's own coordinates. */
71
+ declare function tangentAt(path: Path, fraction: number): [number, number];
72
+ declare function pathBounds(path: Path): Bounds | null;
73
+ declare function unionBounds(a: Bounds | null, b: Bounds | null): Bounds | null;
74
+ /** Shoelace area over the anchors. The sign gives the winding direction. */
75
+ declare function signedArea(r: Ring): number;
76
+ declare function ringCenter(r: Ring): [number, number];
77
+ declare function reverseRing(r: Ring): Ring;
78
+ /** Parse SVG path data, including arcs and relative commands, into cubic rings. */
79
+ declare function parseSvgPath(d: string): Path;
80
+ /** Serialize a path to compact SVG path data. */
81
+ declare function pathToD(path: Path): string;
82
+
83
+ /** Rate functions map animation progress in [0, 1] to eased progress. */
84
+ type Ease = (t: number) => number;
85
+ declare const linear: Ease;
86
+ /** The house default. A sigmoid with a calm start and a calm landing. */
87
+ declare function smoothBy(inflection: number): Ease;
88
+ declare const smooth: Ease;
89
+ /** Fifth-order smoothstep, for long camera moves. */
90
+ declare const smoother: Ease;
91
+ declare const easeInQuad: Ease;
92
+ declare const easeOutQuad: Ease;
93
+ declare const easeInCubic: Ease;
94
+ declare const easeOutCubic: Ease;
95
+ declare const easeInOutCubic: Ease;
96
+ declare const easeOutQuint: Ease;
97
+ declare const easeInOutQuint: Ease;
98
+ declare const easeOutExpo: Ease;
99
+ declare const easeInExpo: Ease;
100
+ declare const rushInto: Ease;
101
+ declare const rushFrom: Ease;
102
+ declare const slowInto: Ease;
103
+ /** Overshoot the target once, then settle. */
104
+ declare function overshoot(amount?: number): Ease;
105
+ /** Physically based settle. Exactly 1 at t=1 so holds never drift. */
106
+ declare function spring(options?: {
107
+ bounce?: number;
108
+ frequency?: number;
109
+ }): Ease;
110
+ declare const bounce: Ease;
111
+ /** Goes to 1 and returns to 0. Ends where it started, for emphasis. */
112
+ declare const thereAndBack: Ease;
113
+ declare function thereAndBackWithPause(pause?: number): Ease;
114
+ /** Oscillates around 0 and ends at 0. */
115
+ declare function wiggle(cycles?: number): Ease;
116
+ /** Stops short of the target, for an unfinished gesture. */
117
+ declare function notQuiteThere(amount?: number, inner?: Ease): Ease;
118
+ /** Holds at 1 for the last part of the time. */
119
+ declare function lingering(hold?: number, inner?: Ease): Ease;
120
+ /** Backs up briefly, then runs through to the target. */
121
+ declare function runningStart(pull?: number): Ease;
122
+ /** Restrict an ease to a window of the animation. */
123
+ declare function during(from: number, to: number, inner?: Ease): Ease;
124
+ /** CSS-style cubic-bezier timing function. */
125
+ declare function cubicBezier(x1: number, y1: number, x2: number, y2: number): Ease;
126
+
127
+ /**
128
+ * A look is a complete art direction for a film: background, ink, a small set
129
+ * of named pigments, and how much light the image gives off. Authors write
130
+ * `color: 'yellow'`, so one film renders correctly in every look.
131
+ */
132
+ interface Look {
133
+ readonly name: string;
134
+ readonly dark: boolean;
135
+ readonly background: string;
136
+ /** Full-frame bloom in the light-emitting looks. 0 turns it off. */
137
+ readonly bloom: number;
138
+ readonly colors: Readonly<Record<LookToken, string>>;
139
+ }
140
+ type LookToken = 'bg' | 'surface' | 'ink' | 'dim' | 'faint' | 'grid' | 'gridStrong' | 'blue' | 'teal' | 'green' | 'yellow' | 'gold' | 'orange' | 'red' | 'pink' | 'purple';
141
+ /** Deep neutral black with luminous pigments. The default. */
142
+ declare const midnight: Look;
143
+ /** Warm paper and printed ink, for articles and print. */
144
+ declare const paper: Look;
145
+ /** Drafting-table navy with cool cyan linework. */
146
+ declare const blueprint: Look;
147
+ /** Near-black green with warm chalk, for classroom-style lessons. */
148
+ declare const chalk: Look;
149
+ /** Saturated light on pure black, for trailers and hero loops. */
150
+ declare const neon: Look;
151
+ declare const LOOKS: {
152
+ readonly midnight: Look;
153
+ readonly paper: Look;
154
+ readonly blueprint: Look;
155
+ readonly chalk: Look;
156
+ readonly neon: Look;
157
+ };
158
+ type LookName = keyof typeof LOOKS;
159
+ declare function resolveLook(look: LookName | Look | undefined): Look;
160
+
161
+ /** r, g, b from 0 to 255 and alpha from 0 to 1. */
162
+ type Rgba = readonly [number, number, number, number];
163
+ interface LinearGradient {
164
+ readonly type: 'linear';
165
+ readonly from: readonly [number, number];
166
+ readonly to: readonly [number, number];
167
+ readonly stops: readonly (readonly [number, Rgba])[];
168
+ }
169
+ interface RadialGradient {
170
+ readonly type: 'radial';
171
+ readonly center: readonly [number, number];
172
+ readonly radius: number;
173
+ readonly stops: readonly (readonly [number, Rgba])[];
174
+ }
175
+ /** Stroke whose color changes along its arc length. */
176
+ interface AlongGradient {
177
+ readonly type: 'along';
178
+ readonly stops: readonly (readonly [number, Rgba])[];
179
+ }
180
+ type Gradient = LinearGradient | RadialGradient | AlongGradient;
181
+ type Paint = Rgba | Gradient;
182
+ type ColorInput = string | Rgba | Gradient;
183
+ declare function parseColor(input: string): Rgba;
184
+ declare function toPaint(input: ColorInput): Paint;
185
+ declare function css(color: Rgba, alpha?: number): string;
186
+ /** Mix two colors in OKLab, which keeps blends bright and even in tone. */
187
+ declare function mixColor(a: Rgba, b: Rgba, t: number): Rgba;
188
+ declare function linearGradient(from: readonly [number, number], to: readonly [number, number], colors: readonly ColorInput[] | readonly (readonly [number, ColorInput])[]): LinearGradient;
189
+ declare function radialGradient(center: readonly [number, number], radius: number, colors: readonly ColorInput[]): RadialGradient;
190
+ /** Color that travels along a stroke, such as a graph that warms from left to right. */
191
+ declare function along$1(...colors: readonly ColorInput[]): AlongGradient;
192
+ /** Evenly spaced colors between stops, for coloring a list of items. */
193
+ declare function ramp(count: number, ...colors: readonly ColorInput[]): Rgba[];
194
+
195
+ interface Key<T> {
196
+ t0: number;
197
+ t1: number;
198
+ ease: Ease | null;
199
+ to: T;
200
+ /** Value at eased progress. Absent for a step key. */
201
+ at: ((alpha: number) => T) | null;
202
+ }
203
+ /** One property over time. Keys sort by start time, and a later key wins from its start. */
204
+ declare class Track<T> {
205
+ initial: T;
206
+ readonly keys: Key<T>[];
207
+ constructor(initial: T);
208
+ sample(t: number): T;
209
+ add(key: Key<T>): void;
210
+ step(t: number, value: T): void;
211
+ /** Last time this track changes. */
212
+ get end(): number;
213
+ }
214
+
215
+ interface PathOp {
216
+ readonly kind: 'path';
217
+ readonly path: Path;
218
+ /** Stroke geometry when it differs from the fill, such as during a partial draw. */
219
+ readonly strokePath: Path;
220
+ readonly fill: Paint | null;
221
+ readonly fillAlpha: number;
222
+ readonly stroke: Paint | null;
223
+ readonly strokeAlpha: number;
224
+ readonly strokeWidth: number;
225
+ readonly cap: 'round' | 'butt' | 'square';
226
+ readonly join: 'round' | 'miter' | 'bevel';
227
+ readonly dash: readonly number[] | null;
228
+ readonly dashOffset: number;
229
+ readonly glow: number;
230
+ readonly glowColor: Rgba | null;
231
+ readonly blend: BlendMode;
232
+ /** The node that produced this mark, for checks and tools. */
233
+ readonly node?: Node;
234
+ }
235
+ interface ImageOp {
236
+ readonly kind: 'image';
237
+ readonly image: StageImage;
238
+ readonly matrix: Mat;
239
+ readonly alpha: number;
240
+ }
241
+ type DrawOp = PathOp | ImageOp;
242
+ interface Frame {
243
+ readonly width: number;
244
+ readonly height: number;
245
+ readonly background: string | null;
246
+ readonly bloom: number;
247
+ readonly ops: readonly DrawOp[];
248
+ readonly dark: boolean;
249
+ }
250
+ interface CameraState {
251
+ readonly x: number;
252
+ readonly y: number;
253
+ readonly zoom: number;
254
+ readonly rotation: number;
255
+ }
256
+ declare function buildOps(root: Node, camera: CameraState, width: number, height: number): DrawOp[];
257
+ /** Serialize a frame to standalone SVG. Text is already outlines, so no fonts are needed. */
258
+ declare function frameToSvg(frame: Frame, options?: {
259
+ scale?: number;
260
+ transparent?: boolean;
261
+ }): string;
262
+ type Canvas2D = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
263
+ interface ImageLookup {
264
+ (image: StageImage): CanvasImageSource | null;
265
+ }
266
+ /** Paint a frame to a 2D context at a device scale. Same result as the SVG backend. */
267
+ declare function paintFrame(ctx: Canvas2D, frame: Frame, scale?: number, images?: ImageLookup): void;
268
+ /** Pixel-space bounds of a frame's ink, used by checks for off-canvas marks. */
269
+ declare function frameInkBounds(frame: Frame): {
270
+ x: number;
271
+ y: number;
272
+ width: number;
273
+ height: number;
274
+ } | null;
275
+
276
+ type BlendMode = 'normal' | 'screen' | 'multiply' | 'overlay';
277
+ type Edge = 'left' | 'right' | 'top' | 'bottom';
278
+ type Side = Edge | 'up' | 'down' | Vec;
279
+ interface NodeProps {
280
+ x: number;
281
+ y: number;
282
+ rotation: number;
283
+ sx: number;
284
+ sy: number;
285
+ px: number;
286
+ py: number;
287
+ opacity: number;
288
+ visible: boolean;
289
+ z: number;
290
+ path: Path | null;
291
+ fill: Paint | null;
292
+ fillOpacity: number;
293
+ stroke: Paint | null;
294
+ strokeOpacity: number;
295
+ strokeWidth: number;
296
+ cap: 'round' | 'butt' | 'square';
297
+ join: 'round' | 'miter' | 'bevel';
298
+ dash: readonly number[] | null;
299
+ dashOffset: number;
300
+ trimFrom: number;
301
+ trimTo: number;
302
+ trimEach: boolean;
303
+ glow: number;
304
+ glowColor: Rgba | null;
305
+ blend: BlendMode;
306
+ /** Ignore the camera. Use it for titles, captions, and other screen-space marks. */
307
+ fixed: boolean;
308
+ image: StageImage | null;
309
+ }
310
+ interface StageImage {
311
+ /** Browser-usable URL or data URL. */
312
+ readonly src: string;
313
+ readonly width: number;
314
+ readonly height: number;
315
+ }
316
+ type PropName = keyof NodeProps;
317
+ /**
318
+ * Every visible thing on stage. A node with a path draws. A node with children
319
+ * groups. Both can carry a transform, and every property can change over time.
320
+ *
321
+ * Setter methods chain and apply at the current point on the timeline, so the
322
+ * same calls set up a node before it appears and change it afterwards.
323
+ */
324
+ declare class Node {
325
+ readonly id: number;
326
+ parent: Node | null;
327
+ children: Node[];
328
+ /** Free-form metadata, such as the source character of a glyph. */
329
+ data: Record<string, unknown>;
330
+ /** Label shown in timelines and diagnostics. */
331
+ label: string;
332
+ base: NodeProps;
333
+ tracks: Map<PropName, Track<unknown>> | null;
334
+ overlay: Map<string, unknown> | null;
335
+ overlayFrame: number;
336
+ /** On stage: writes become timeline keys instead of initial state. */
337
+ mounted: boolean;
338
+ /** Rebuilt on every frame from timeline values. */
339
+ draw: ((time: number) => Node | readonly Node[] | null) | null;
340
+ /** Emits draw operations directly, for objects with thousands of marks such as 3D meshes. */
341
+ rawOps: ((matrix: Mat, alpha: number, ops: DrawOp[]) => void) | null;
342
+ constructor(path?: Path | null);
343
+ get<K extends PropName>(prop: K): NodeProps[K];
344
+ set<K extends PropName>(prop: K, value: NodeProps[K]): this;
345
+ track<K extends PropName>(prop: K): Track<NodeProps[K]>;
346
+ /** Record a change from the current value to `to` over [t0, t1]. */
347
+ tween<K extends PropName>(prop: K, to: NodeProps[K], t0: number, t1: number, ease: Ease | null): void;
348
+ add(...nodes: Node[]): this;
349
+ drop(child: Node): this;
350
+ /** Self and all descendants, parents first. */
351
+ all(): Node[];
352
+ /** Descendants that draw something. A leaf group returns itself if it draws. */
353
+ leaves(): Node[];
354
+ /** A static copy of the current state, off stage. */
355
+ clone(): this;
356
+ localMatrix(): Mat;
357
+ worldMatrix(): Mat;
358
+ toWorld(x: number, y: number): [number, number];
359
+ /** Stage-space bounds of this node and its descendants. */
360
+ bounds(): Bounds;
361
+ private boundsFrom;
362
+ get center(): [number, number];
363
+ get top(): [number, number];
364
+ get bottom(): [number, number];
365
+ get left(): [number, number];
366
+ get right(): [number, number];
367
+ get width(): number;
368
+ get height(): number;
369
+ /** Set the local position of the origin. */
370
+ at(x: number | Vec, y?: number): this;
371
+ shift(dx: number | Vec, dy?: number): this;
372
+ /** Move so the center of the bounds lands on a stage point or on another node's center. */
373
+ moveTo(target: Vec | Node): this;
374
+ /** Move the origin to a stage point without changing how anything looks. */
375
+ pivotAt(point: Vec): this;
376
+ /** Scale around the center, or around a given stage point. */
377
+ scale(factor: number | Vec, about?: Vec): this;
378
+ /** Rotate around the center, or around a given stage point. */
379
+ rotate(radians: number, about?: Vec): this;
380
+ /** Scale to an exact on-screen width or height, keeping proportions. */
381
+ fitTo(size: {
382
+ width?: number;
383
+ height?: number;
384
+ }): this;
385
+ /** Place beside another node or stage point, with a gap measured between bounds. */
386
+ nextTo(target: Node | Vec, side?: Side, gap?: number): this;
387
+ /** Line up one edge with another node's same edge. */
388
+ alignTo(target: Node | Vec, edge: Edge): this;
389
+ /** Lay out children in a row or column, keeping the group's center. */
390
+ arrange(side?: Side, gap?: number): this;
391
+ fill(color: ColorInput | null, opacity?: number): this;
392
+ stroke(color: ColorInput | null, width?: number, opacity?: number): this;
393
+ /** Recolor this node and its descendants, keeping whichever paints exist. */
394
+ color(color: ColorInput): this;
395
+ opacity(value: number): this;
396
+ /** Soft light around the shape. The radius is in stage pixels. */
397
+ glow(radius: number, color?: ColorInput): this;
398
+ dash(pattern: readonly number[] | null, offset?: number): this;
399
+ zIndex(value: number): this;
400
+ /** Pin to the screen so the camera does not move this node. */
401
+ pin(): this;
402
+ hide(): this;
403
+ show(): this;
404
+ named(label: string): this;
405
+ }
406
+ /** A group. Children keep their own transforms inside it. */
407
+ declare function group(...children: Node[]): Node;
408
+ /** A node that rebuilds its contents on every frame from timeline values. */
409
+ declare function dynamic(build: (time: number) => Node | readonly Node[] | null): Node;
410
+
411
+ type Aspect = '16:9' | '9:16' | '1:1' | '4:3' | '21:9';
412
+ interface FilmOptions {
413
+ /** Lines and shapes run past the frame edges on purpose, as a warped grid does. Text is still checked. */
414
+ bleed?: boolean;
415
+ title?: string;
416
+ description?: string;
417
+ /** Logical stage size. 16:9 is 1920x1080. Everything is authored in these units. */
418
+ aspect?: Aspect;
419
+ width?: number;
420
+ height?: number;
421
+ fps?: number;
422
+ look?: LookName | Look;
423
+ background?: string | null;
424
+ /** Light that spills from bright marks. Defaults to the look's value. */
425
+ bloom?: number;
426
+ /** Time in seconds of the frame to use as a poster. Defaults to the richest frame. */
427
+ poster?: number;
428
+ }
429
+ interface Chapter {
430
+ title: string;
431
+ time: number;
432
+ }
433
+ interface Clip {
434
+ t0: number;
435
+ t1: number;
436
+ labels: string[];
437
+ }
438
+ interface Caption {
439
+ t0: number;
440
+ t1: number;
441
+ text: string;
442
+ }
443
+ interface PlayOptions {
444
+ duration?: number;
445
+ ease?: Ease;
446
+ /** Name shown in timelines. */
447
+ label?: string;
448
+ }
449
+ interface Updater {
450
+ node: Node;
451
+ fn: (node: Node, time: number) => void;
452
+ from: number;
453
+ to: number;
454
+ }
455
+ /** The timeline a film is authored on. All coordinates are centered: (0, 0) is mid-frame and y points down. */
456
+ declare class Stage {
457
+ readonly root: Node;
458
+ /** Move, zoom, and rotate the view with to(s.camera, ...). `sx` is the zoom. */
459
+ readonly camera: Node;
460
+ readonly width: number;
461
+ readonly height: number;
462
+ readonly fps: number;
463
+ readonly look: Look;
464
+ readonly chapters: Chapter[];
465
+ readonly clips: Clip[];
466
+ readonly captions: Caption[];
467
+ readonly updaters: Updater[];
468
+ time: number;
469
+ private ending;
470
+ constructor(options: FilmOptions);
471
+ /** Half of the frame in each direction. */
472
+ get right(): number;
473
+ get left(): number;
474
+ get top(): number;
475
+ get bottom(): number;
476
+ /** Put nodes on stage now. Returns the first, so setup reads as one line. */
477
+ add<T extends Node>(first: T, ...rest: Node[]): T;
478
+ /** Put a node on stage so it first shows at `time`, which may differ from the cursor. */
479
+ mountAt(node: Node, time: number): void;
480
+ remove(...nodes: Node[]): void;
481
+ /** Run animations together and advance the timeline past them. */
482
+ play(...items: (Anim | PlayOptions)[]): this;
483
+ /** Hold on the current picture. */
484
+ wait(seconds?: number): this;
485
+ /** Author something at another time, then return to where you were. */
486
+ at(time: number, build: () => void): this;
487
+ /** Mark a chapter for the player, presentation steps, and the timeline. */
488
+ chapter(title: string): this;
489
+ /** Show a caption for a span of time. Captions also export as a VTT sidecar. */
490
+ caption(text: string, duration?: number): this;
491
+ /** A number that animates, for driving dynamic drawings. */
492
+ value(initial?: number): Value;
493
+ /** Re-run a function each frame while the node shows. It can set any property on the node. */
494
+ update<T extends Node>(node: T, fn: (node: T, time: number) => void, window?: {
495
+ from?: number;
496
+ to?: number;
497
+ }): T;
498
+ get duration(): number;
499
+ }
500
+ interface FilmDefinition {
501
+ readonly kind: 'vizmatic.film';
502
+ readonly options: FilmOptions;
503
+ readonly build: (stage: Stage) => void | Promise<void>;
504
+ /**
505
+ * Compile with the engine that authored this film. The clock is module state,
506
+ * so a tool with its own bundled engine must call this and not its own compileFilm.
507
+ */
508
+ readonly compile: (overrides?: CompileOverrides) => Promise<CompiledFilm>;
509
+ }
510
+ /** Define a film: a function that authors a timeline on a stage. */
511
+ declare function film(build: (stage: Stage) => void | Promise<void>): FilmDefinition;
512
+ declare function film(options: FilmOptions, build: (stage: Stage) => void | Promise<void>): FilmDefinition;
513
+ declare function isFilm(value: unknown): value is FilmDefinition;
514
+ /** Thrown while an asset loads. The compiler waits and runs the build function again. */
515
+ declare class Suspend {
516
+ readonly promise: Promise<unknown>;
517
+ /** Lets a second copy of the engine recognize this without instanceof. */
518
+ readonly isVizmaticSuspend = true;
519
+ constructor(promise: Promise<unknown>);
520
+ }
521
+ /** True for a Suspend thrown by any copy of the engine. */
522
+ declare function isSuspend(error: unknown): error is Suspend;
523
+ interface CompileOverrides {
524
+ look?: LookName | Look;
525
+ fps?: number;
526
+ bloom?: number;
527
+ background?: string | null;
528
+ }
529
+ /** A film ready to sample. `frame(t)` is pure: seek to any time, in any order. */
530
+ declare class CompiledFilm {
531
+ readonly width: number;
532
+ readonly height: number;
533
+ readonly fps: number;
534
+ readonly duration: number;
535
+ readonly title: string;
536
+ readonly description: string;
537
+ readonly look: Look;
538
+ readonly bloom: number;
539
+ readonly background: string | null;
540
+ /** The author's chosen poster time, when set. */
541
+ readonly posterTime: number | undefined;
542
+ readonly bleed: boolean;
543
+ readonly chapters: readonly Chapter[];
544
+ readonly clips: readonly Clip[];
545
+ readonly captions: readonly Caption[];
546
+ readonly stage: Stage;
547
+ constructor(stage: Stage, options: FilmOptions, overrides: CompileOverrides);
548
+ get frameCount(): number;
549
+ /** The draw list at a time in seconds. May throw Suspend if a drawing needs a new asset. */
550
+ frame(time: number): Frame;
551
+ /** Standalone SVG for a time. */
552
+ svg(time: number, options?: {
553
+ transparent?: boolean;
554
+ scale?: number;
555
+ }): string;
556
+ }
557
+ /** Run the build function, waiting for fonts and math when it asks for them, and return a seekable film. */
558
+ declare function compileFilm(definition: FilmDefinition, overrides?: CompileOverrides): Promise<CompiledFilm>;
559
+
560
+ interface AnimContext {
561
+ t0: number;
562
+ t1: number;
563
+ ease: Ease;
564
+ stage: Stage;
565
+ }
566
+ /** A piece of motion. `schedule` writes timeline keys for a window of time. */
567
+ interface Anim {
568
+ label: string;
569
+ duration: number;
570
+ ease?: Ease;
571
+ schedule(ctx: AnimContext): void;
572
+ }
573
+ interface AnimOptions {
574
+ duration?: number;
575
+ ease?: Ease;
576
+ /** Fraction of one item's time between the starts of consecutive items. */
577
+ lag?: number;
578
+ }
579
+ type Target = Node | readonly Node[];
580
+ /** Run together. Each piece keeps its own length unless the whole is rescaled. */
581
+ declare function par(...anims: readonly Anim[]): Anim;
582
+ /** Run one after another. */
583
+ declare function seq(...anims: readonly Anim[]): Anim;
584
+ /** Start each piece after a fraction of the previous one has played. */
585
+ declare function lagged(anims: readonly Anim[], options?: {
586
+ lag?: number;
587
+ duration?: number;
588
+ }): Anim;
589
+ declare function delay(anim: Anim, seconds: number): Anim;
590
+ /** Change an animation's length or easing without changing what it does. */
591
+ declare function retime(anim: Anim, options: AnimOptions): Anim;
592
+ /** Run a plain function at a moment on the timeline. */
593
+ declare function call(fn: () => void): Anim;
594
+ /** Trace strokes in order. Filled shapes outline first, then fill. */
595
+ declare function draw(target: Target, options?: AnimOptions): Anim;
596
+ /** Handwrite text and equations: each glyph is outlined, then filled. */
597
+ declare function write(target: Target, options?: AnimOptions): Anim;
598
+ /** The reverse of draw. */
599
+ declare function erase(target: Target, options?: AnimOptions): Anim;
600
+ interface FadeOptions extends AnimOptions {
601
+ /** Start offset for fades in, or travel for fades out. */
602
+ shift?: Vec;
603
+ /** Start scale for fades in, or end scale for fades out. */
604
+ scale?: number;
605
+ }
606
+ declare function fadeIn(target: Target, options?: FadeOptions): Anim;
607
+ declare function fadeOut(target: Target, options?: FadeOptions): Anim;
608
+ /** Scale up from nothing. Pass a stage point to grow from it, such as an arrow's tail. */
609
+ declare function grow(target: Target, options?: AnimOptions & {
610
+ from?: Vec;
611
+ }): Anim;
612
+ /** Show at this moment, with no transition. */
613
+ declare function appear(target: Target): Anim;
614
+ /** Hide at this moment, with no transition. */
615
+ declare function vanish(target: Target): Anim;
616
+ /**
617
+ * Animate any change. Make the change on the node inside the callback, and the
618
+ * engine interpolates from the old state to the new one, including geometry.
619
+ *
620
+ * s.play(to(dot, (d) => d.moveTo(axes.p(2, 4)).color('yellow').scale(1.5)))
621
+ */
622
+ declare function to<T extends Node>(node: T, change: (node: T) => unknown, options?: AnimOptions & {
623
+ restore?: boolean;
624
+ }): Anim;
625
+ declare function moveTo(node: Node, target: Vec | Node, options?: AnimOptions): Anim;
626
+ declare function shift(node: Node, dx: number, dy: number, options?: AnimOptions): Anim;
627
+ declare function scaleBy(node: Node, factor: number | Vec, options?: AnimOptions & {
628
+ about?: Vec;
629
+ }): Anim;
630
+ declare function rotate(node: Node, radians: number, options?: AnimOptions & {
631
+ about?: Vec;
632
+ }): Anim;
633
+ declare function recolor(node: Node, color: ColorInput, options?: AnimOptions): Anim;
634
+ declare function fade(node: Node, opacity: number, options?: AnimOptions): Anim;
635
+ /** Follow a path, or the shape of a node, from start to end. */
636
+ declare function along(node: Node, track: Path | Node, options?: AnimOptions & {
637
+ orient?: boolean;
638
+ }): Anim;
639
+ /**
640
+ * Deform every shape under a node through a function of stage position.
641
+ * This is how a grid bends under a matrix or a complex map.
642
+ */
643
+ declare function warp(target: Target, f: (x: number, y: number) => Vec, options?: AnimOptions & {
644
+ subdivisions?: number;
645
+ }): Anim;
646
+ /** Multiply a node's geometry by a 2x2 matrix around a stage point. */
647
+ declare function applyMatrix(target: Target, matrix: readonly [readonly [number, number], readonly [number, number]], options?: AnimOptions & {
648
+ origin?: Vec;
649
+ yUp?: boolean;
650
+ }): Anim;
651
+ /**
652
+ * Turn `from` into `to`, whatever their shapes. Afterwards `to` is on stage and
653
+ * `from` is hidden, so later code always refers to the node it can see.
654
+ */
655
+ declare function morph(from: Target, to: Target, options?: AnimOptions & {
656
+ lag?: number;
657
+ }): Anim;
658
+ /**
659
+ * Morph equations and labels by meaning. Glyphs that exist on both sides travel
660
+ * to their new places. The rest fade out or in where they stand.
661
+ */
662
+ declare function morphMatching(from: Node, to: Node, options?: AnimOptions & {
663
+ key?: (leaf: Node) => unknown;
664
+ fadeShift?: Vec;
665
+ }): Anim;
666
+ /** Swell and tint for a moment, then return. */
667
+ declare function indicate(target: Target, options?: AnimOptions & {
668
+ color?: ColorInput;
669
+ scale?: number;
670
+ }): Anim;
671
+ /** Shake gently to draw the eye. */
672
+ declare function shake(node: Node, options?: AnimOptions & {
673
+ angle?: number;
674
+ cycles?: number;
675
+ }): Anim;
676
+ /** Trace a line around a node for emphasis, then let it run off. */
677
+ declare function circumscribe(target: Node, options?: AnimOptions & {
678
+ color?: ColorInput;
679
+ pad?: number;
680
+ radius?: number;
681
+ width?: number;
682
+ }): Anim;
683
+ /** Radial burst at a point, for a moment of arrival. */
684
+ declare function flash(point: Vec | Node, options?: AnimOptions & {
685
+ color?: ColorInput;
686
+ radius?: number;
687
+ rays?: number;
688
+ }): Anim;
689
+ /** Expanding ring that fades out, for a pulse from a point. */
690
+ declare function ripple(point: Vec | Node, options?: AnimOptions & {
691
+ color?: ColorInput;
692
+ radius?: number;
693
+ width?: number;
694
+ }): Anim;
695
+ /**
696
+ * A short lit segment that travels along a line: a packet on an edge, a signal
697
+ * on a wire. The source line stays in place underneath.
698
+ */
699
+ declare function pulse(line: Node, options?: AnimOptions & {
700
+ color?: ColorInput;
701
+ length?: number;
702
+ width?: number;
703
+ glow?: number;
704
+ }): Anim;
705
+ /** A number on the timeline. Read `.value` inside `dynamic` and `update` to drive anything. */
706
+ declare class Value {
707
+ readonly track: Track<number>;
708
+ constructor(initial: number);
709
+ get value(): number;
710
+ /** Set at the current point on the timeline. */
711
+ set(value: number): this;
712
+ to(value: number, options?: AnimOptions): Anim;
713
+ }
714
+
715
+ interface GlyphOutline {
716
+ /** Each contour is a closed cubic ring in font units, with y pointing up. */
717
+ readonly contours: readonly number[][];
718
+ }
719
+ interface LoadedFont {
720
+ readonly unitsPerEm: number;
721
+ readonly ascent: number;
722
+ readonly descent: number;
723
+ readonly lineGap: number;
724
+ glyphFor(code: number): number;
725
+ advance(glyph: number): number;
726
+ kern(left: number, right: number): number;
727
+ outline(glyph: number): GlyphOutline | null;
728
+ }
729
+
730
+ declare function parseFont(bytes: ArrayBuffer): LoadedFont;
731
+ type FontFamily = 'sans' | 'serif' | 'mono' | 'noto';
732
+ type FontWeight = 400 | 600 | 700;
733
+ /** Get a font now, or suspend the current compile until it arrives. */
734
+ declare function fontFor(family: FontFamily, weight?: FontWeight, italic?: boolean): LoadedFont;
735
+ /** Glyph outline scaled to a pixel size, with y pointing down and the origin on the baseline. */
736
+ declare function glyphPath(font: LoadedFont, glyph: number, size: number): Path;
737
+
738
+ interface TextOptions {
739
+ size?: number;
740
+ font?: FontFamily;
741
+ weight?: FontWeight;
742
+ italic?: boolean;
743
+ color?: ColorInput;
744
+ /** Line alignment inside the block. */
745
+ align?: 'left' | 'center' | 'right';
746
+ /** Wrap to this width, in stage pixels. */
747
+ maxWidth?: number;
748
+ /** Line height as a multiple of size. */
749
+ leading?: number;
750
+ /** Extra space between letters, as a fraction of size. */
751
+ tracking?: number;
752
+ uppercase?: boolean;
753
+ }
754
+ /**
755
+ * A line or block of text as real vector glyphs. Each glyph is its own child, so
756
+ * text can be handwritten, staggered, or morphed. `.chars` lists them in order.
757
+ */
758
+ declare class TextNode extends Node {
759
+ readonly chars: Node[];
760
+ source: string;
761
+ /** Glyph nodes whose characters match, such as every "x". */
762
+ find(fragment: string): Node[];
763
+ }
764
+ declare function text(content: string, options?: TextOptions): TextNode;
765
+
766
+ interface TexOptions {
767
+ size?: number;
768
+ color?: ColorInput;
769
+ display?: boolean;
770
+ }
771
+ /** Typeset equation as glyph nodes. Ordinary characters keep their identity for morphs. */
772
+ declare class TexNode extends Node {
773
+ readonly glyphs: Node[];
774
+ source: string;
775
+ /** Glyphs matching a TeX fragment, such as eq.part('b^2'). Use it to color or morph a term. */
776
+ part(fragment: string): Node[];
777
+ /** Every occurrence of a fragment, in order. */
778
+ parts(fragment: string): Node[][];
779
+ }
780
+ /** Typeset TeX with real math glyphs. `tex.part('x^2')` selects a term for color or morphing. */
781
+ declare function tex(source: string, options?: TexOptions): TexNode;
782
+
783
+ /** Tell the browser build where fonts live. The URL must end with a slash. */
784
+ declare function setAssetBase(url: string): void;
785
+
786
+ interface ShapeStyle {
787
+ fill?: ColorInput | null;
788
+ stroke?: ColorInput | null;
789
+ width?: number;
790
+ opacity?: number;
791
+ glow?: number;
792
+ dash?: readonly number[];
793
+ z?: number;
794
+ }
795
+ /** Wrap any path as a stroked shape in the default ink. */
796
+ declare function shape(path: Path, style?: ShapeStyle): Node;
797
+ declare function svgPath(d: string, style?: ShapeStyle): Node;
798
+ declare function line(a: Vec, b: Vec, style?: ShapeStyle): Node;
799
+ declare function polyline(points: readonly Vec[], style?: ShapeStyle & {
800
+ closed?: boolean;
801
+ }): Node;
802
+ /** A smooth curve through points. Non-finite points leave gaps. */
803
+ declare function curve(points: readonly Vec[], style?: ShapeStyle & {
804
+ closed?: boolean;
805
+ }): Node;
806
+ declare function parametric(f: (t: number) => Vec, from: number, to: number, style?: ShapeStyle & {
807
+ samples?: number;
808
+ }): Node;
809
+ declare function circle(radius: number, style?: ShapeStyle): Node;
810
+ declare function ellipse(rx: number, ry: number, style?: ShapeStyle): Node;
811
+ declare function arc(radius: number, from: number, to: number, style?: ShapeStyle): Node;
812
+ declare function rect(width: number, height: number, style?: ShapeStyle & {
813
+ radius?: number;
814
+ }): Node;
815
+ declare function polygon(points: readonly Vec[], style?: ShapeStyle): Node;
816
+ declare function regularPolygon(sides: number, radius: number, style?: ShapeStyle): Node;
817
+ /** A filled point. */
818
+ declare function dot(radius?: number, color?: ColorInput, style?: ShapeStyle): Node;
819
+ interface ArrowStyle extends ShapeStyle {
820
+ /** Tip length in pixels. */
821
+ tip?: number;
822
+ /** Tip width relative to its length. */
823
+ tipRatio?: number;
824
+ /** Curve the shaft: positive bends left of the direction of travel. */
825
+ bend?: number;
826
+ /** Space left at each end, so arrows stop short of what they point at. */
827
+ pad?: number;
828
+ both?: boolean;
829
+ }
830
+ /**
831
+ * A shaft and a clean tip as one group. The shaft ends at the tip's base, so a
832
+ * thick line never pokes through the point.
833
+ */
834
+ declare function arrow(from: Vec, to: Vec, style?: ArrowStyle): Node;
835
+ /** Curly brace beside a span of two points, pointing out to one side. */
836
+ declare function brace(from: Vec, to: Vec, style?: ShapeStyle & {
837
+ depth?: number;
838
+ }): Node;
839
+
840
+ interface AxesOptions {
841
+ /** Math range on the x axis. */
842
+ x?: readonly [number, number];
843
+ y?: readonly [number, number];
844
+ /** On-screen size in stage pixels. */
845
+ width?: number;
846
+ height?: number;
847
+ xStep?: number;
848
+ yStep?: number;
849
+ color?: ColorInput;
850
+ /** Number labels on ticks. */
851
+ labels?: boolean;
852
+ labelSize?: number;
853
+ /** Faint background grid. */
854
+ grid?: boolean;
855
+ xLabel?: string;
856
+ yLabel?: string;
857
+ tips?: boolean;
858
+ }
859
+ /**
860
+ * Coordinate axes. `.p(x, y)` converts math coordinates to stage points in this
861
+ * group's local space, and `.plot(f)` draws a function on them.
862
+ */
863
+ declare class Axes extends Node {
864
+ readonly xRange: readonly [number, number];
865
+ readonly yRange: readonly [number, number];
866
+ readonly plotWidth: number;
867
+ readonly plotHeight: number;
868
+ /** Lines and ticks, for drawing in on their own. */
869
+ readonly lines: Node;
870
+ readonly grid: Node;
871
+ readonly numbers: Node;
872
+ constructor(options?: AxesOptions);
873
+ /** Math coordinates to this group's local stage coordinates. */
874
+ p(x: number, y: number): [number, number];
875
+ /** Math coordinates to stage coordinates, following this group's transform. */
876
+ world(x: number, y: number): [number, number];
877
+ /** Geometry of a function over a range, clipped to the visible y range. */
878
+ plotPath(f: (x: number) => number, options?: {
879
+ from?: number;
880
+ to?: number;
881
+ samples?: number;
882
+ }): Path;
883
+ /** Draw a function on the axes. The curve becomes a child, so it moves with them. */
884
+ plot(f: (x: number) => number, style?: ShapeStyle & {
885
+ from?: number;
886
+ to?: number;
887
+ samples?: number;
888
+ }): Node;
889
+ /** A point on the axes. */
890
+ dotAt(x: number, y: number, color?: ColorInput, radius?: number): Node;
891
+ /** Dashed guides from a point down to both axes. */
892
+ guides(x: number, y: number, style?: ShapeStyle): Node;
893
+ }
894
+ declare function axes(options?: AxesOptions): Axes;
895
+ interface PlaneOptions {
896
+ /** Stage pixels per math unit. */
897
+ unit?: number;
898
+ /** Extent in math units. Defaults to overscan past the frame edges, for warps that pull in. */
899
+ x?: readonly [number, number];
900
+ y?: readonly [number, number];
901
+ color?: ColorInput;
902
+ /** Minor grid lines per unit. */
903
+ minor?: number;
904
+ axisColor?: ColorInput;
905
+ width?: number;
906
+ }
907
+ /**
908
+ * The classic infinite grid. Each line is a dense path, so it bends smoothly
909
+ * under `applyMatrix` and under `warp` with a nonlinear function.
910
+ */
911
+ declare class NumberPlane extends Node {
912
+ readonly unit: number;
913
+ readonly major: Node;
914
+ readonly minor: Node;
915
+ readonly axes: Node;
916
+ constructor(options?: PlaneOptions);
917
+ /** Math coordinates to stage coordinates. y points up on the plane. */
918
+ p(x: number, y: number): [number, number];
919
+ /** A vector drawn from the origin, as an arrow. */
920
+ vector(x: number, y: number, style?: ShapeStyle): Node;
921
+ }
922
+ declare function plane(options?: PlaneOptions): NumberPlane;
923
+ interface DecimalOptions {
924
+ digits?: number;
925
+ size?: number;
926
+ color?: ColorInput;
927
+ font?: 'sans' | 'mono' | 'serif';
928
+ prefix?: string;
929
+ suffix?: string;
930
+ }
931
+ /** A number readout that follows a function of the timeline, drawn fresh each frame. */
932
+ declare function decimal(read: () => number, options?: DecimalOptions): Node;
933
+
934
+ type FilmDiagnosticCode = 'film.off_canvas' | 'film.text_overlap' | 'film.text_crossed';
935
+ interface FilmDiagnostic {
936
+ code: FilmDiagnosticCode;
937
+ severity: 'error' | 'warning';
938
+ message: string;
939
+ /** First sampled time with this problem, in seconds. */
940
+ time: number;
941
+ /** Last sampled time with this problem, in seconds. */
942
+ until: number;
943
+ /** Where to look, in canvas pixels with the origin at the top left. */
944
+ box: Bounds;
945
+ /** The center of the box in authoring coordinates, with (0, 0) at mid-frame. */
946
+ stage: {
947
+ x: number;
948
+ y: number;
949
+ };
950
+ /** The text involved, when there is any. */
951
+ text?: string;
952
+ /** The second text involved in an overlap. */
953
+ other?: string;
954
+ }
955
+ interface FilmCheckReport {
956
+ ok: boolean;
957
+ width: number;
958
+ height: number;
959
+ duration: number;
960
+ /** The times that were inspected, in seconds. */
961
+ sampled: number[];
962
+ diagnostics: FilmDiagnostic[];
963
+ summary: {
964
+ errors: number;
965
+ warnings: number;
966
+ };
967
+ }
968
+ interface FilmCheckOptions extends CompileOverrides {
969
+ /** Inspect exactly these times, in seconds, in place of the automatic sampling. */
970
+ times?: readonly number[];
971
+ /** Add this many evenly spaced samples to the moments at rest. */
972
+ samples?: number;
973
+ }
974
+ /**
975
+ * Inspect a film for layout defects: marks off the canvas, text on text, and
976
+ * strokes through text. It looks where the film comes to rest, because objects may
977
+ * cross each other while moving. Runs anywhere, with no rendering.
978
+ */
979
+ declare function checkFilm(film: FilmDefinition | CompiledFilm, options?: FilmCheckOptions): Promise<FilmCheckReport>;
980
+
981
+ type Reactive = number | (() => number);
982
+ interface NumberLineOptions {
983
+ range?: readonly [number, number];
984
+ /** On-screen length in stage pixels. */
985
+ length?: number;
986
+ step?: number;
987
+ labels?: boolean;
988
+ labelSize?: number;
989
+ color?: ColorInput;
990
+ tips?: boolean;
991
+ width?: number;
992
+ }
993
+ declare class NumberLine extends Node {
994
+ readonly range: readonly [number, number];
995
+ readonly length: number;
996
+ readonly line: Node;
997
+ readonly ticks: Node;
998
+ readonly numbers: Node;
999
+ constructor(options?: NumberLineOptions);
1000
+ /** Value to local stage coordinates. */
1001
+ p(value: number): [number, number];
1002
+ world(value: number): [number, number];
1003
+ /** A point on the line. Pass a function to follow a Value over time. */
1004
+ marker(value: Reactive, options?: {
1005
+ color?: ColorInput;
1006
+ label?: string;
1007
+ radius?: number;
1008
+ labelSize?: number;
1009
+ }): Node;
1010
+ /** A highlighted span, with open or closed endpoints. */
1011
+ interval(from: number, to: number, options?: {
1012
+ color?: ColorInput;
1013
+ width?: number;
1014
+ offset?: number;
1015
+ openLeft?: boolean;
1016
+ openRight?: boolean;
1017
+ }): Node;
1018
+ }
1019
+ declare function numberLine(options?: NumberLineOptions): NumberLine;
1020
+ interface ComplexPlaneOptions extends PlaneOptions {
1021
+ /** Label real and imaginary integers out to this distance from the origin. */
1022
+ labelRange?: number;
1023
+ labelSize?: number;
1024
+ }
1025
+ declare class ComplexPlane extends NumberPlane {
1026
+ readonly numbers: Node;
1027
+ constructor(options?: ComplexPlaneOptions);
1028
+ /** Complex number to local stage coordinates. */
1029
+ z(re: number, im: number): [number, number];
1030
+ }
1031
+ declare function complexPlane(options?: ComplexPlaneOptions): ComplexPlane;
1032
+ /**
1033
+ * Deform a complex plane through f(re, im). Labels stay readable by fading
1034
+ * separately, so this moves only the grid.
1035
+ */
1036
+ declare function applyComplex(plane: NumberPlane, f: (re: number, im: number) => Vec, options?: AnimOptions & {
1037
+ subdivisions?: number;
1038
+ }): Anim;
1039
+ /** Small complex arithmetic on [re, im] pairs. */
1040
+ declare const complex: {
1041
+ mul: (a: Vec, b: Vec) => Vec;
1042
+ div: (a: Vec, b: Vec) => Vec;
1043
+ exp: (a: Vec) => Vec;
1044
+ log: (a: Vec) => Vec;
1045
+ pow: (a: Vec, n: number) => Vec;
1046
+ sin: (a: Vec) => Vec;
1047
+ cos: (a: Vec) => Vec;
1048
+ inv: (a: Vec) => Vec;
1049
+ };
1050
+ type FieldFn = (x: number, y: number, t: number) => Vec;
1051
+ interface VectorFieldOptions {
1052
+ x?: readonly [number, number];
1053
+ y?: readonly [number, number];
1054
+ /** Math units between arrows. */
1055
+ step?: number;
1056
+ /** Stage pixels per math unit. */
1057
+ unit?: number;
1058
+ /** Longest arrow, in stage pixels. */
1059
+ maxLength?: number;
1060
+ /** Magnitude that reaches the last color. */
1061
+ max?: number;
1062
+ colors?: readonly ColorInput[];
1063
+ /** Thickness of the shaft. */
1064
+ width?: number;
1065
+ /** Recompute from f(x, y, t) on every frame. */
1066
+ animate?: boolean;
1067
+ }
1068
+ /** A grid of arrows that shows a field's direction and strength. y points up in field space. */
1069
+ declare class VectorField extends Node {
1070
+ readonly f: FieldFn;
1071
+ readonly unit: number;
1072
+ readonly arrows: Node[];
1073
+ constructor(f: FieldFn, options?: VectorFieldOptions);
1074
+ }
1075
+ declare function vectorField(f: FieldFn, options?: VectorFieldOptions): VectorField;
1076
+ interface StreamLinesOptions {
1077
+ x?: readonly [number, number];
1078
+ y?: readonly [number, number];
1079
+ unit?: number;
1080
+ /** Math units between seed points. Smaller is denser. */
1081
+ spacing?: number;
1082
+ /** Integration step and number of steps for each line. */
1083
+ dt?: number;
1084
+ steps?: number;
1085
+ colors?: readonly ColorInput[];
1086
+ max?: number;
1087
+ width?: number;
1088
+ /** Passes per second along a full line. */
1089
+ speed?: number;
1090
+ /** Lit fraction of each line. */
1091
+ tail?: number;
1092
+ seed?: number;
1093
+ /** Show the whole lines faintly underneath the moving light. */
1094
+ trace?: number;
1095
+ }
1096
+ /**
1097
+ * Flow made visible: lines are integrated once, then light runs along them.
1098
+ * Drawing is batched by color and brightness, so hundreds of lines stay live.
1099
+ */
1100
+ declare class StreamLines extends Node {
1101
+ readonly lineCount: number;
1102
+ constructor(f: FieldFn, options?: StreamLinesOptions);
1103
+ }
1104
+ declare function streamLines(f: FieldFn, options?: StreamLinesOptions): StreamLines;
1105
+ interface RiemannOptions {
1106
+ from?: number;
1107
+ to?: number;
1108
+ n?: number;
1109
+ /** Where each rectangle samples the function. */
1110
+ rule?: 'left' | 'mid' | 'right';
1111
+ colors?: readonly ColorInput[];
1112
+ opacity?: number;
1113
+ stroke?: ColorInput;
1114
+ strokeWidth?: number;
1115
+ }
1116
+ /** Rectangles under a curve. Morph one set into a finer one to show the integral appear. */
1117
+ declare function riemann(axes: Axes, f: (x: number) => number, options?: RiemannOptions): Node;
1118
+ interface AreaOptions {
1119
+ from?: Reactive;
1120
+ to?: Reactive;
1121
+ fill?: ColorInput;
1122
+ opacity?: number;
1123
+ samples?: number;
1124
+ }
1125
+ /** Shaded region between a curve and the x axis. Pass functions for bounds that move. */
1126
+ declare function areaUnder(axes: Axes, f: (x: number) => number, options?: AreaOptions): Node;
1127
+ interface TangentOptions extends ShapeStyle {
1128
+ /** Length of the drawn segment, in stage pixels. */
1129
+ length?: number;
1130
+ /** Mark the point of tangency. */
1131
+ point?: boolean;
1132
+ }
1133
+ /** The tangent at x, as a line on the axes. Pass a function of time to make it slide. */
1134
+ declare function tangentLine(axes: Axes, f: (x: number) => number, x: Reactive, style?: TangentOptions): Node;
1135
+ interface SecantOptions extends ShapeStyle {
1136
+ /** Extra length past each point, in stage pixels. */
1137
+ extend?: number;
1138
+ points?: boolean;
1139
+ /** Draw the run and rise legs of the slope triangle. */
1140
+ legs?: boolean;
1141
+ legColor?: ColorInput;
1142
+ }
1143
+ /** The line through two points on a curve. Pass functions to shrink h on screen. */
1144
+ declare function secantLine(axes: Axes, f: (x: number) => number, a: Reactive, b: Reactive, style?: SecantOptions): Node;
1145
+ /** Dashed drop lines from a point on the axes. Pass functions to follow a moving point. */
1146
+ declare function dashedGuides(axes: Axes, x: Reactive, y: Reactive, style?: ShapeStyle): Node;
1147
+ interface AngleOptions {
1148
+ radius?: number;
1149
+ color?: ColorInput;
1150
+ width?: number;
1151
+ label?: string;
1152
+ labelSize?: number;
1153
+ /** Soft wedge under the arc. */
1154
+ fillOpacity?: number;
1155
+ /** Take the long way around. */
1156
+ reflex?: boolean;
1157
+ }
1158
+ /** An angle at a vertex, between the rays toward two points. */
1159
+ declare function angleMark(vertex: Vec, from: Vec, to: Vec, options?: AngleOptions): Node;
1160
+ /** The small square that marks a right angle. */
1161
+ declare function rightAngle(vertex: Vec, a: Vec, b: Vec, options?: {
1162
+ size?: number;
1163
+ color?: ColorInput;
1164
+ width?: number;
1165
+ }): Node;
1166
+ interface MatrixOptions {
1167
+ size?: number;
1168
+ color?: ColorInput;
1169
+ /** Space between columns and rows, as multiples of size. */
1170
+ gapX?: number;
1171
+ gapY?: number;
1172
+ bracket?: '[' | '(' | '|';
1173
+ bracketColor?: ColorInput;
1174
+ }
1175
+ /** A typeset matrix with real TeX brackets. Each entry is its own node. */
1176
+ declare class MatrixNode extends Node {
1177
+ readonly cells: TexNode[][];
1178
+ readonly entries: Node;
1179
+ readonly brackets: Node;
1180
+ readonly rowCount: number;
1181
+ readonly colCount: number;
1182
+ private readonly positions;
1183
+ private readonly options;
1184
+ constructor(rows: readonly (readonly (string | number)[])[], options?: MatrixOptions);
1185
+ cell(row: number, column: number): TexNode;
1186
+ row(index: number): TexNode[];
1187
+ col(index: number): TexNode[];
1188
+ /** Replace one entry, morphing matching glyphs. Later calls to `.cell` return the new one. */
1189
+ setCell(row: number, column: number, value: string | number, options?: AnimOptions): Anim;
1190
+ }
1191
+ declare function matrix(rows: readonly (readonly (string | number)[])[], options?: MatrixOptions): MatrixNode;
1192
+ interface BraceLabelOptions {
1193
+ side?: 'bottom' | 'top' | 'left' | 'right';
1194
+ gap?: number;
1195
+ size?: number;
1196
+ color?: ColorInput;
1197
+ /** Set for plain text labels. Labels are math by default. */
1198
+ plain?: boolean;
1199
+ depth?: number;
1200
+ }
1201
+ /** A brace along one side of a node or nodes, with a label at its point. */
1202
+ declare function braceLabel(target: Node | readonly Node[], label: string, options?: BraceLabelOptions): Node;
1203
+ interface SurroundOptions {
1204
+ pad?: number;
1205
+ radius?: number;
1206
+ color?: ColorInput;
1207
+ width?: number;
1208
+ fill?: ColorInput;
1209
+ fillOpacity?: number;
1210
+ glow?: number;
1211
+ }
1212
+ /** A rounded box around a node or nodes, measured now. */
1213
+ declare function surroundingBox(target: Node | readonly Node[], options?: SurroundOptions): Node;
1214
+ interface LabeledDotOptions {
1215
+ color?: ColorInput;
1216
+ radius?: number;
1217
+ side?: Side;
1218
+ gap?: number;
1219
+ size?: number;
1220
+ plain?: boolean;
1221
+ labelColor?: ColorInput;
1222
+ }
1223
+ /** A point with a label. The node's origin stays on the point. */
1224
+ declare class LabeledDot extends Node {
1225
+ readonly mark: Node;
1226
+ readonly caption: Node;
1227
+ constructor(label: string, options?: LabeledDotOptions);
1228
+ }
1229
+ declare function labeledDot(label: string, options?: LabeledDotOptions): LabeledDot;
1230
+ interface TracedOptions {
1231
+ color?: ColorInput;
1232
+ width?: number;
1233
+ /** Seconds of history to keep. Older parts of the trail are gone. */
1234
+ tail?: number;
1235
+ /** Brightness at the old end, from 0 to 1. Use 1 for a solid trail. */
1236
+ fade?: number;
1237
+ /** Samples per second along the trail. */
1238
+ rate?: number;
1239
+ glow?: number;
1240
+ }
1241
+ /**
1242
+ * The path a moving point has taken. It is computed by re-reading the point at
1243
+ * earlier times, so it scrubs correctly in both directions. The point function
1244
+ * should read Values or tracked node properties, not `update` overlays.
1245
+ */
1246
+ declare function traced(point: () => Vec, from: number, to: number, options?: TracedOptions): Node;
1247
+ interface FourierTerm {
1248
+ /** Whole turns per trip around the shape. */
1249
+ readonly freq: number;
1250
+ readonly amp: number;
1251
+ readonly phase: number;
1252
+ }
1253
+ /**
1254
+ * Discrete Fourier transform of a closed outline, largest terms first. Sample
1255
+ * the points evenly along the outline, for example with `samplePath`.
1256
+ */
1257
+ declare function fourier(points: readonly Vec[], options?: {
1258
+ terms?: number;
1259
+ }): FourierTerm[];
1260
+ /** Value of a Fourier series at u, where u from 0 to 1 is one trip around the shape. */
1261
+ declare function fourierPoint(terms: readonly FourierTerm[], u: number): [number, number];
1262
+ /** Evenly spaced points along a path, by arc length. */
1263
+ declare function samplePath(path: Path, count: number): Vec[];
1264
+ interface EpicyclesOptions {
1265
+ /** Progress as a function of the timeline. 1 means one full trip. */
1266
+ u: () => number;
1267
+ /** Most circles to draw. The sum still uses every term. */
1268
+ circles?: number;
1269
+ circleColor?: ColorInput;
1270
+ armColor?: ColorInput;
1271
+ traceColor?: ColorInput;
1272
+ traceWidth?: number;
1273
+ glow?: number;
1274
+ /** Share of a trip to keep lit. Use 1 for the whole drawing. */
1275
+ tail?: number;
1276
+ samples?: number;
1277
+ }
1278
+ /** Circles on circles: the tip of the chain draws the original shape. */
1279
+ declare class Epicycles extends Node {
1280
+ readonly terms: readonly FourierTerm[];
1281
+ private readonly outlinePoints;
1282
+ constructor(terms: readonly FourierTerm[], options: EpicyclesOptions);
1283
+ /** The reconstructed outline as a path, for morphing the drawing into something else. */
1284
+ outline(): Path;
1285
+ point(u: number): [number, number];
1286
+ }
1287
+ declare function epicycles(terms: readonly FourierTerm[], options: EpicyclesOptions): Epicycles;
1288
+ /** A closed outline shrunk to a parametric function. */
1289
+ declare function ringThrough(f: (t: number) => Vec, samples?: number): Path;
1290
+
1291
+ interface ChartOptions {
1292
+ width?: number;
1293
+ height?: number;
1294
+ /** Text size for direct labels and ticks. */
1295
+ labelSize?: number;
1296
+ color?: ColorInput;
1297
+ }
1298
+ interface BarDatum {
1299
+ label: string;
1300
+ value: number;
1301
+ color?: ColorInput;
1302
+ }
1303
+ interface BarChartOptions extends ChartOptions {
1304
+ /** Fraction of each band left empty between bars. */
1305
+ gap?: number;
1306
+ /** Fixes the top of the scale. Defaults to the largest value. */
1307
+ max?: number;
1308
+ min?: number;
1309
+ showValues?: boolean;
1310
+ format?: (value: number) => string;
1311
+ horizontal?: boolean;
1312
+ radius?: number;
1313
+ }
1314
+ /**
1315
+ * Bars with direct labels and a single hairline baseline. `enter()` grows them
1316
+ * from zero and `update(values)` animates to new data, with readouts that count.
1317
+ */
1318
+ declare class BarChart extends Node {
1319
+ readonly bars: Node[];
1320
+ readonly labels: Node[];
1321
+ readonly readouts: Node[];
1322
+ readonly baseline: Node;
1323
+ readonly values: Value[];
1324
+ private readonly maxValue;
1325
+ private readonly minValue;
1326
+ private readonly w;
1327
+ private readonly h;
1328
+ private readonly horizontal;
1329
+ private readonly band;
1330
+ private readonly gap;
1331
+ private readonly fixedMax?;
1332
+ private readonly fixedMin?;
1333
+ constructor(data: readonly BarDatum[], options?: BarChartOptions);
1334
+ private lengthOf;
1335
+ /** Baseline position for bar i. */
1336
+ private place;
1337
+ private tip;
1338
+ private barPath;
1339
+ bar(i: number): Node;
1340
+ /** Baseline and labels appear, then bars rise one after another while readouts count up. */
1341
+ enter(options?: AnimOptions): Anim;
1342
+ /** Animate to new values. The scale follows unless it was fixed at creation. */
1343
+ update(values: readonly number[], options?: AnimOptions): Anim;
1344
+ private barPathAt;
1345
+ }
1346
+ declare function barChart(data: readonly BarDatum[], options?: BarChartOptions): BarChart;
1347
+ interface HistogramOptions extends ChartOptions {
1348
+ bins?: number;
1349
+ range?: readonly [number, number];
1350
+ /** Fixes the top of the scale, for a stable axis while samples arrive. */
1351
+ max?: number;
1352
+ gap?: number;
1353
+ /** Number of x tick labels. */
1354
+ ticks?: number;
1355
+ colors?: readonly ColorInput[];
1356
+ }
1357
+ /**
1358
+ * A distribution that can fill up over time. `fillUp()` drops the samples in, in
1359
+ * order, so bars rise exactly as the data accumulates.
1360
+ */
1361
+ declare class Histogram extends Node {
1362
+ readonly shown: Value;
1363
+ readonly bins: number;
1364
+ readonly range: readonly [number, number];
1365
+ readonly chartWidth: number;
1366
+ readonly chartHeight: number;
1367
+ readonly axis: Node;
1368
+ readonly total: number;
1369
+ private readonly assigned;
1370
+ readonly peak: number;
1371
+ constructor(samples: readonly number[], options?: HistogramOptions);
1372
+ private xAt;
1373
+ /** Local stage point for a value and a count. */
1374
+ p(value: number, count: number): [number, number];
1375
+ /** Samples arrive in order, from none to `count` (all of them by default). */
1376
+ fillUp(options?: AnimOptions & {
1377
+ count?: number;
1378
+ }): Anim;
1379
+ /** Overlay a curve, such as the fitted density, on the same axes. f returns a count. */
1380
+ curve(f: (x: number) => number, options?: {
1381
+ color?: ColorInput;
1382
+ width?: number;
1383
+ samples?: number;
1384
+ }): Node;
1385
+ }
1386
+ declare function histogram(samples: readonly number[], options?: HistogramOptions): Histogram;
1387
+ interface ScatterPoint {
1388
+ x: number;
1389
+ y: number;
1390
+ color?: ColorInput;
1391
+ radius?: number;
1392
+ /** Points with the same group share a color and one direct label. */
1393
+ group?: string;
1394
+ }
1395
+ interface ScatterOptions extends ChartOptions {
1396
+ x?: readonly [number, number];
1397
+ y?: readonly [number, number];
1398
+ radius?: number;
1399
+ xLabel?: string;
1400
+ yLabel?: string;
1401
+ /** Label each group near its center, instead of using a legend. */
1402
+ groupLabels?: boolean;
1403
+ }
1404
+ declare class Scatter extends Node {
1405
+ readonly dots: Node[];
1406
+ readonly axis: Node;
1407
+ readonly groupLabels: Node[];
1408
+ private readonly frame;
1409
+ constructor(points: readonly ScatterPoint[], options?: ScatterOptions);
1410
+ p(x: number, y: number): [number, number];
1411
+ /** Axes draw, then points land from left to right. */
1412
+ enter(options?: AnimOptions): Anim;
1413
+ /** A straight or curved fit through the data, drawn on the same axes. */
1414
+ fit(f: (x: number) => number, options?: {
1415
+ color?: ColorInput;
1416
+ width?: number;
1417
+ samples?: number;
1418
+ }): Node;
1419
+ }
1420
+ declare function scatter(points: readonly ScatterPoint[], options?: ScatterOptions): Scatter;
1421
+ interface LineSeries {
1422
+ name?: string;
1423
+ /** Y values at x = 0, 1, 2, ... */
1424
+ values?: readonly number[];
1425
+ points?: readonly Vec[];
1426
+ color?: ColorInput;
1427
+ width?: number;
1428
+ dash?: readonly number[];
1429
+ /** Soft fill under the line. */
1430
+ area?: number;
1431
+ smooth?: boolean;
1432
+ }
1433
+ interface LineChartOptions extends ChartOptions {
1434
+ x?: readonly [number, number];
1435
+ y?: readonly [number, number];
1436
+ xLabel?: string;
1437
+ yLabel?: string;
1438
+ xFormat?: (x: number) => string;
1439
+ yFormat?: (y: number) => string;
1440
+ xTicks?: number;
1441
+ yTicks?: number;
1442
+ }
1443
+ declare class LineChart extends Node {
1444
+ readonly lines: Node[];
1445
+ readonly areas: Node[];
1446
+ readonly names: Node[];
1447
+ readonly axis: Node;
1448
+ private readonly byName;
1449
+ private readonly frame;
1450
+ constructor(series: readonly LineSeries[], options?: LineChartOptions);
1451
+ p(x: number, y: number): [number, number];
1452
+ series(name: string): Node;
1453
+ /** Axes fade in, lines draw left to right, and their labels arrive as each line lands. */
1454
+ enter(options?: AnimOptions): Anim;
1455
+ }
1456
+ declare function lineChart(series: readonly LineSeries[], options?: LineChartOptions): LineChart;
1457
+ interface PieDatum {
1458
+ label: string;
1459
+ value: number;
1460
+ color?: ColorInput;
1461
+ }
1462
+ interface PieOptions {
1463
+ radius?: number;
1464
+ /** Inner radius as a fraction of the outer radius. 0 makes a pie. */
1465
+ hole?: number;
1466
+ /** Angular gap between wedges, in radians. */
1467
+ gap?: number;
1468
+ labelSize?: number;
1469
+ /** Show each share as a percentage beside its label. */
1470
+ percent?: boolean;
1471
+ labels?: boolean;
1472
+ centerLabel?: string;
1473
+ centerSize?: number;
1474
+ }
1475
+ /** Share of a whole, labeled directly. `enter()` sweeps around, and `update()` re-divides it. */
1476
+ declare class PieChart extends Node {
1477
+ readonly wedges: Node[];
1478
+ readonly labels: Node[];
1479
+ readonly leaders: Node[];
1480
+ readonly centerText: Node | null;
1481
+ private readonly shares;
1482
+ private readonly inner;
1483
+ private readonly outer;
1484
+ private readonly gap;
1485
+ constructor(data: readonly PieDatum[], options?: PieOptions);
1486
+ private angles;
1487
+ /** Wedges sweep open around the circle, then the labels arrive. */
1488
+ enter(options?: AnimOptions): Anim;
1489
+ /** Re-divide the circle. Geometry animates, and labels follow their wedges. */
1490
+ update(values: readonly number[], options?: AnimOptions): Anim;
1491
+ }
1492
+ declare function pie(data: readonly PieDatum[], options?: PieOptions): PieChart;
1493
+ declare function donut(data: readonly PieDatum[], options?: PieOptions): PieChart;
1494
+ interface HeatmapOptions {
1495
+ /** Cell edge in stage pixels. */
1496
+ cell?: number;
1497
+ cellWidth?: number;
1498
+ cellHeight?: number;
1499
+ gap?: number;
1500
+ colors?: readonly ColorInput[];
1501
+ /** Value range for the color ramp. */
1502
+ domain?: readonly [number, number];
1503
+ /** Print values in cells. */
1504
+ values?: boolean;
1505
+ format?: (value: number) => string;
1506
+ valueSize?: number;
1507
+ rowLabels?: readonly string[];
1508
+ columnLabels?: readonly string[];
1509
+ labelSize?: number;
1510
+ /** Tilt column labels so long names fit, in radians. */
1511
+ columnLabelAngle?: number;
1512
+ radius?: number;
1513
+ }
1514
+ declare class Heatmap extends Node {
1515
+ readonly cells: Node[][];
1516
+ readonly rowLabels: Node[];
1517
+ readonly columnLabels: Node[];
1518
+ readonly numbers: Node[][];
1519
+ readonly rowCount: number;
1520
+ readonly colCount: number;
1521
+ private readonly stops;
1522
+ private readonly domain;
1523
+ constructor(values: readonly (readonly number[])[], options?: HeatmapOptions);
1524
+ colorFor(value: number): Rgba;
1525
+ cell(row: number, column: number): Node;
1526
+ row(index: number): Node[];
1527
+ col(index: number): Node[];
1528
+ /** Cells fade in along the diagonal. */
1529
+ enter(options?: AnimOptions): Anim;
1530
+ /** Recolor every cell to new values. */
1531
+ update(values: readonly (readonly number[])[], options?: AnimOptions): Anim;
1532
+ }
1533
+ declare function heatmap(values: readonly (readonly number[])[], options?: HeatmapOptions): Heatmap;
1534
+
1535
+ interface GraphNodeSpec {
1536
+ id: string;
1537
+ label?: string;
1538
+ color?: ColorInput;
1539
+ /** Circle radius. */
1540
+ radius?: number;
1541
+ /** Box size. A node with a width draws as a rounded box. */
1542
+ width?: number;
1543
+ height?: number;
1544
+ /** Manual position, used by layout: 'manual'. */
1545
+ at?: Vec;
1546
+ /** Typeset the label as math. */
1547
+ math?: boolean;
1548
+ }
1549
+ interface GraphEdgeSpec {
1550
+ from: string;
1551
+ to: string;
1552
+ label?: string;
1553
+ color?: ColorInput;
1554
+ width?: number;
1555
+ dash?: readonly number[];
1556
+ directed?: boolean;
1557
+ }
1558
+ interface GraphOptions {
1559
+ layout?: 'dagre' | 'force' | 'circle' | 'manual';
1560
+ direction?: 'LR' | 'RL' | 'TB' | 'BT';
1561
+ /** Bounding size for force and circle layouts. */
1562
+ width?: number;
1563
+ height?: number;
1564
+ nodeGap?: number;
1565
+ rankGap?: number;
1566
+ radius?: number;
1567
+ labelSize?: number;
1568
+ edgeLabelSize?: number;
1569
+ directed?: boolean;
1570
+ nodeColor?: ColorInput;
1571
+ edgeColor?: ColorInput;
1572
+ seed?: number;
1573
+ /** Fill nodes softly with their color instead of leaving them hollow. */
1574
+ fillOpacity?: number;
1575
+ }
1576
+ declare class GraphNode extends Node {
1577
+ shape: Node;
1578
+ caption: Node | null;
1579
+ halfWidth: number;
1580
+ halfHeight: number;
1581
+ round: boolean;
1582
+ /** Point on this node's outline facing a stage point, in graph space. */
1583
+ edgePoint(fx: number, fy: number, tx: number, ty: number, pad?: number): Vec;
1584
+ }
1585
+ declare class GraphEdge extends Node {
1586
+ shaft: Node;
1587
+ tip: Node | null;
1588
+ caption: Node | null;
1589
+ from: string;
1590
+ to: string;
1591
+ tipSize: number;
1592
+ }
1593
+ /**
1594
+ * Nodes and edges with a stable layout. `node(id)` and `edge(from, to)` return
1595
+ * ordinary nodes, so every verb works on them, and `visit` and `pulseEdge` tell
1596
+ * an algorithm's story.
1597
+ */
1598
+ declare class Graph extends Node {
1599
+ readonly nodes: Map<string, GraphNode>;
1600
+ readonly edges: GraphEdge[];
1601
+ readonly edgeLayer: Node;
1602
+ readonly nodeLayer: Node;
1603
+ private readonly specs;
1604
+ constructor(nodes: readonly GraphNodeSpec[], edges: readonly GraphEdgeSpec[], options?: GraphOptions);
1605
+ node(id: string): GraphNode;
1606
+ edge(from: string, to: string): GraphEdge;
1607
+ /** Nodes pop in by order, and each edge draws as its source is shown. */
1608
+ enter(options?: AnimOptions): Anim;
1609
+ /** A lit signal travels along an edge. */
1610
+ pulseEdge(from: string, to: string, options?: AnimOptions & {
1611
+ color?: ColorInput;
1612
+ length?: number;
1613
+ }): Anim;
1614
+ /** Mark a node as reached: its color changes and it swells for a moment. */
1615
+ visit(id: string, options?: AnimOptions & {
1616
+ color?: ColorInput;
1617
+ }): Anim;
1618
+ /** Move a node. Its edges follow, re-routed as straight lines. */
1619
+ moveNode(id: string, to: Vec, options?: AnimOptions): Anim;
1620
+ }
1621
+ declare function graph(nodes: readonly GraphNodeSpec[], edges: readonly GraphEdgeSpec[], options?: GraphOptions): Graph;
1622
+ interface TreeSpec {
1623
+ id?: string;
1624
+ label?: string;
1625
+ color?: ColorInput;
1626
+ children?: readonly TreeSpec[];
1627
+ math?: boolean;
1628
+ }
1629
+ interface TreeOptions extends Pick<GraphOptions, 'radius' | 'labelSize' | 'nodeColor' | 'edgeColor' | 'fillOpacity'> {
1630
+ levelGap?: number;
1631
+ siblingGap?: number;
1632
+ direction?: 'down' | 'right';
1633
+ }
1634
+ /** A tidy tree: parents center over children, and subtrees never overlap. */
1635
+ declare class TreeGraph extends Graph {
1636
+ readonly depths: Map<string, number>;
1637
+ constructor(root: TreeSpec, options?: TreeOptions);
1638
+ /** Grow from the root, one level at a time. */
1639
+ enter(options?: AnimOptions): Anim;
1640
+ }
1641
+ declare function tree(root: TreeSpec, options?: TreeOptions): TreeGraph;
1642
+ interface ArrayCellsOptions {
1643
+ cell?: number;
1644
+ gap?: number;
1645
+ size?: number;
1646
+ color?: ColorInput;
1647
+ indices?: boolean;
1648
+ indexSize?: number;
1649
+ font?: 'mono' | 'sans';
1650
+ }
1651
+ /** A row of boxes. `swap(i, j)` lifts two items over each other, and `.cell(i)` follows them. */
1652
+ declare class ArrayCells extends Node {
1653
+ readonly slots: Node[];
1654
+ readonly indexLabels: Node[];
1655
+ /** The item at each index, updated as swaps are authored. */
1656
+ readonly items: Node[];
1657
+ private readonly cellSize;
1658
+ private readonly step;
1659
+ constructor(values: readonly (string | number)[], options?: ArrayCellsOptions);
1660
+ /** The item currently at an index. */
1661
+ cell(index: number): Node;
1662
+ /** Local stage position of a slot. */
1663
+ slotAt(index: number): Vec;
1664
+ /** Exchange two items along opposite arcs. */
1665
+ swap(i: number, j: number, options?: AnimOptions & {
1666
+ lift?: number;
1667
+ }): Anim;
1668
+ /** Recolor an item. */
1669
+ mark(index: number, color: ColorInput, options?: AnimOptions): Anim;
1670
+ /** Cells appear from left to right. */
1671
+ enter(options?: AnimOptions): Anim;
1672
+ }
1673
+ declare function arrayCells(values: readonly (string | number)[], options?: ArrayCellsOptions): ArrayCells;
1674
+ type TokenKind = 'keyword' | 'string' | 'number' | 'comment' | 'function' | 'type' | 'punctuation' | 'plain' | 'space';
1675
+ interface CodeToken {
1676
+ text: string;
1677
+ kind: TokenKind;
1678
+ line: number;
1679
+ glyphs: Node[];
1680
+ }
1681
+ /** A small tokenizer for film code. It colors the common cases and never blocks on odd input. */
1682
+ declare function tokenize(source: string, language?: string): Omit<CodeToken, 'glyphs'>[];
1683
+ interface CodeBlockOptions {
1684
+ language?: string;
1685
+ size?: number;
1686
+ /** Line height as a multiple of size. */
1687
+ leading?: number;
1688
+ lineNumbers?: boolean;
1689
+ /** Draw a quiet panel behind the code. */
1690
+ panel?: boolean;
1691
+ padding?: number;
1692
+ /** Minimum panel width, so versions of a snippet can share one frame. */
1693
+ minWidth?: number;
1694
+ colors?: Partial<Record<Exclude<TokenKind, 'space'>, ColorInput>>;
1695
+ }
1696
+ /**
1697
+ * Syntax-colored code as real glyphs. It can be written on, focused line by
1698
+ * line, and morphed token by token into a new version with `morphCode`.
1699
+ */
1700
+ declare class CodeBlock extends Node {
1701
+ readonly lines: Node[];
1702
+ readonly tokens: CodeToken[];
1703
+ readonly chars: Node[];
1704
+ readonly panelNode: Node | null;
1705
+ readonly body: Node;
1706
+ readonly source: string;
1707
+ private readonly bar;
1708
+ private readonly rowHeight;
1709
+ private readonly originY;
1710
+ private readonly contentWidth;
1711
+ constructor(source: string, options?: CodeBlockOptions);
1712
+ /** One line of code, as a node. Lines count from 0. */
1713
+ line(index: number): Node;
1714
+ /** Glyphs of every token whose text matches. */
1715
+ find(fragment: string): Node[];
1716
+ /** Dim everything except these lines, and lay a soft bar behind them. */
1717
+ focus(lines: number | readonly number[], options?: AnimOptions & {
1718
+ dim?: number;
1719
+ color?: ColorInput;
1720
+ }): Anim;
1721
+ /** Restore all lines and remove the focus bar. */
1722
+ unfocus(options?: AnimOptions): Anim;
1723
+ }
1724
+ declare function codeBlock(source: string, options?: CodeBlockOptions): CodeBlock;
1725
+ /**
1726
+ * Morph one version of code into another. Tokens are matched in order, so
1727
+ * unchanged code slides to its new place and only real edits fade.
1728
+ */
1729
+ declare function morphCode(from: CodeBlock, to: CodeBlock, options?: AnimOptions): Anim;
1730
+ interface NeuralNetOptions {
1731
+ width?: number;
1732
+ height?: number;
1733
+ radius?: number;
1734
+ /** Show at most this many neurons per layer, with an ellipsis for the rest. */
1735
+ collapse?: number;
1736
+ colors?: readonly ColorInput[];
1737
+ edgeColor?: ColorInput;
1738
+ edgeOpacity?: number;
1739
+ layerLabels?: readonly string[];
1740
+ labelSize?: number;
1741
+ /** Seed for the default activations. */
1742
+ seed?: number;
1743
+ }
1744
+ /** Layers of neurons joined by hairline weights. `forward()` runs a signal through it. */
1745
+ declare class NeuralNet extends Node {
1746
+ readonly neurons: Node[][];
1747
+ /** Edges between layer i and layer i + 1, by [from][to]. */
1748
+ readonly links: Node[][][];
1749
+ readonly edgeLayer: Node;
1750
+ readonly neuronLayer: Node;
1751
+ readonly captions: Node[];
1752
+ private readonly seed;
1753
+ private readonly layerColors;
1754
+ constructor(layers: readonly number[], options?: NeuralNetOptions);
1755
+ layer(index: number): Node[];
1756
+ /** Neurons appear layer by layer, then the weights draw between them. */
1757
+ enter(options?: AnimOptions): Anim;
1758
+ /** Set how strongly each neuron in a layer fires, from 0 to 1. */
1759
+ activate(layer: number, values: readonly number[], options?: AnimOptions & {
1760
+ color?: ColorInput;
1761
+ }): Anim;
1762
+ /**
1763
+ * Run a signal from the first layer to the last. Pass activations per layer,
1764
+ * or let a seeded generator pick plausible ones. The strongest paths light up.
1765
+ */
1766
+ forward(options?: AnimOptions & {
1767
+ activations?: readonly (readonly number[])[];
1768
+ color?: ColorInput;
1769
+ pulses?: number;
1770
+ }): Anim;
1771
+ }
1772
+ declare function neuralNet(layers: readonly number[], options?: NeuralNetOptions): NeuralNet;
1773
+ interface TokenSpec {
1774
+ text: string;
1775
+ /** Small line under the chip, such as an id or a probability. */
1776
+ sub?: string;
1777
+ color?: ColorInput;
1778
+ }
1779
+ interface TokensOptions {
1780
+ size?: number;
1781
+ /** Wrap to this width. */
1782
+ maxWidth?: number;
1783
+ gap?: number;
1784
+ color?: ColorInput;
1785
+ /** Ramp of colors across the row. */
1786
+ colors?: readonly ColorInput[];
1787
+ font?: 'mono' | 'sans';
1788
+ subSize?: number;
1789
+ radius?: number;
1790
+ }
1791
+ /** A sequence of token chips, as in a tokenizer's output. Small type by default. */
1792
+ declare class TokenRow extends Node {
1793
+ readonly chips: Node[];
1794
+ constructor(items: readonly (string | TokenSpec)[], options?: TokensOptions);
1795
+ token(index: number): Node;
1796
+ /** Chips arrive from left to right. */
1797
+ enter(options?: AnimOptions): Anim;
1798
+ /**
1799
+ * Curved links from one token to others, brighter for stronger weights.
1800
+ * Add the result to the stage after this row is in place.
1801
+ */
1802
+ arcs(from: number, weights: readonly number[], options?: {
1803
+ color?: ColorInput;
1804
+ maxWidth?: number;
1805
+ lift?: number;
1806
+ }): Node;
1807
+ }
1808
+ declare function tokens(items: readonly (string | TokenSpec)[], options?: TokensOptions): TokenRow;
1809
+ interface AttentionMatrixOptions {
1810
+ cell?: number;
1811
+ colors?: readonly ColorInput[];
1812
+ values?: boolean;
1813
+ labelSize?: number;
1814
+ gap?: number;
1815
+ }
1816
+ /**
1817
+ * Attention weights as a heatmap, with source tokens across the top and targets
1818
+ * down the side. It is a Heatmap, so `.cell(i, j)` and `.row(i)` work.
1819
+ */
1820
+ declare function attentionMatrix(rows: readonly string[], columns: readonly string[], weights: readonly (readonly number[])[], options?: AttentionMatrixOptions): Heatmap;
1821
+
1822
+ interface InfoRow {
1823
+ label: string;
1824
+ value?: string;
1825
+ /** Color for the value. */
1826
+ tone?: ColorInput;
1827
+ /** Thin meter under the row, from 0 to 1. */
1828
+ meter?: number;
1829
+ /** Small trend drawn at the end of the row. */
1830
+ spark?: readonly number[];
1831
+ }
1832
+ interface InfoBoxOptions {
1833
+ title: string;
1834
+ subtitle?: string;
1835
+ /** Short status tag at the top right, such as "p99" or "degraded". */
1836
+ badge?: string;
1837
+ badgeTone?: ColorInput;
1838
+ rows?: readonly InfoRow[];
1839
+ /** Small chips along the bottom. */
1840
+ tags?: readonly string[];
1841
+ /** Width in stage pixels. Grows to fit the content when omitted. */
1842
+ width?: number;
1843
+ /** Base text size. Everything scales from it. Raise it for a presentation. */
1844
+ size?: number;
1845
+ /** Color of the left edge. */
1846
+ accent?: ColorInput;
1847
+ fill?: ColorInput;
1848
+ border?: ColorInput;
1849
+ radius?: number;
1850
+ }
1851
+ /**
1852
+ * A compact node for system stories: a title, a status, and rows of labeled
1853
+ * metrics at reading size. It packs information like an engineering figure,
1854
+ * not a slide. For a talk, raise `size` and the whole box scales with it.
1855
+ */
1856
+ declare class InfoBox extends Node {
1857
+ readonly frame: Node;
1858
+ readonly accentBar: Node | null;
1859
+ readonly titleNode: Node;
1860
+ readonly subtitleNode: Node | null;
1861
+ readonly badgeNode: Node | null;
1862
+ readonly rowLabels: Node[];
1863
+ readonly rowValues: (Node | null)[];
1864
+ readonly meters: Node[];
1865
+ readonly tagNodes: Node[];
1866
+ readonly boxWidth: number;
1867
+ readonly boxHeight: number;
1868
+ private readonly valueSize;
1869
+ constructor(options: InfoBoxOptions);
1870
+ /** Stage point on one side of the box. `at` moves along the side, from -1 to 1. */
1871
+ port(side: Edge, at?: number): [number, number];
1872
+ /** The frame draws, then the contents settle in, top to bottom. */
1873
+ enter(options?: AnimOptions): Anim;
1874
+ /** Change a row's value in place. Matching digits slide, and the others cross-fade. */
1875
+ setValue(row: number, value: string, options?: AnimOptions & {
1876
+ tone?: ColorInput;
1877
+ }): Anim;
1878
+ }
1879
+ declare function infoBox(options: InfoBoxOptions): InfoBox;
1880
+ interface SparklineOptions {
1881
+ width?: number;
1882
+ height?: number;
1883
+ color?: ColorInput;
1884
+ weight?: number;
1885
+ /** Mark the latest value. */
1886
+ dotted?: boolean;
1887
+ area?: number;
1888
+ }
1889
+ /** A word-sized line chart, with no axes. */
1890
+ declare function sparkline(values: readonly number[], options?: SparklineOptions): Node;
1891
+ type ConnectorEnd = Node | Vec;
1892
+ interface ConnectorOptions {
1893
+ /** Side to leave from and arrive at. Chosen automatically when omitted. */
1894
+ from?: Edge;
1895
+ to?: Edge;
1896
+ route?: 'curve' | 'ortho' | 'straight';
1897
+ color?: ColorInput;
1898
+ width?: number;
1899
+ dash?: readonly number[];
1900
+ /** Draw an arrowhead at the end. */
1901
+ tip?: boolean;
1902
+ tipSize?: number;
1903
+ /** Label on the line, on a plate so the line never crosses its text. */
1904
+ label?: string;
1905
+ labelSize?: number;
1906
+ labelColor?: ColorInput;
1907
+ labelBackground?: ColorInput;
1908
+ /** Where the label sits along the line. */
1909
+ labelAt?: number;
1910
+ /** Space between the line and the box it touches. */
1911
+ gap?: number;
1912
+ /** Slide each end along its side, from -1 to 1. Use it to separate parallel lines. */
1913
+ fromOffset?: number;
1914
+ toOffset?: number;
1915
+ curvature?: number;
1916
+ radius?: number;
1917
+ /** Dashes travel along the line at this many pixels per second. */
1918
+ flow?: number;
1919
+ }
1920
+ /**
1921
+ * A line between two nodes that is routed fresh on every frame. Move a node and
1922
+ * the line follows. `draw(connector)` traces it, and `.pulse()` sends a signal.
1923
+ */
1924
+ declare class Connector extends Node {
1925
+ private readonly fromEnd;
1926
+ private readonly toEnd;
1927
+ private readonly options;
1928
+ private readonly pulses;
1929
+ private plate;
1930
+ private caption;
1931
+ constructor(from: ConnectorEnd, to: ConnectorEnd, options?: ConnectorOptions);
1932
+ private anchors;
1933
+ /** Geometry from end to end at this moment, in stage coordinates. */
1934
+ routeNow(): Path;
1935
+ private build;
1936
+ /** Send a signal along the line. Pulses can overlap, and they follow a moving route. */
1937
+ pulse(options?: AnimOptions & {
1938
+ color?: ColorInput;
1939
+ length?: number;
1940
+ width?: number;
1941
+ glow?: number;
1942
+ }): Anim;
1943
+ /** Point at a fraction along the current route, for placing notes beside the line. */
1944
+ pointNow(fraction?: number): [number, number];
1945
+ }
1946
+ declare function connector(from: ConnectorEnd, to: ConnectorEnd, options?: ConnectorOptions): Connector;
1947
+ interface LegendItem {
1948
+ label: string;
1949
+ color?: ColorInput;
1950
+ kind?: 'swatch' | 'line' | 'dash' | 'dot' | 'ring';
1951
+ }
1952
+ interface LegendOptions {
1953
+ direction?: 'row' | 'column';
1954
+ size?: number;
1955
+ gap?: number;
1956
+ }
1957
+ /** A small key. Prefer direct labels. Use this when a figure holds too many marks to label. */
1958
+ declare function legend(items: readonly LegendItem[], options?: LegendOptions): Node;
1959
+ interface CalloutOptions {
1960
+ title?: string;
1961
+ /** Which way the text sits from its target. */
1962
+ side?: Edge;
1963
+ /** Distance from the target to the text, in stage pixels. */
1964
+ distance?: number;
1965
+ /** Slide the text along the other axis. */
1966
+ offset?: number;
1967
+ /** Wrap width for the body. */
1968
+ width?: number;
1969
+ size?: number;
1970
+ color?: ColorInput;
1971
+ bodyColor?: ColorInput;
1972
+ /** Plate behind the text, for placing a note over busy marks. */
1973
+ plate?: boolean;
1974
+ }
1975
+ /**
1976
+ * A note with a leader line back to what it describes. The leader stops at the
1977
+ * text block's edge, so it never runs through the words.
1978
+ */
1979
+ declare class Callout extends Node {
1980
+ readonly leader: Node;
1981
+ readonly marker: Node;
1982
+ readonly body: Node;
1983
+ readonly titleNode: Node | null;
1984
+ constructor(target: Node | Vec, body: string, options?: CalloutOptions);
1985
+ /** The marker lands, the leader runs out, and the text settles at the end of it. */
1986
+ enter(options?: AnimOptions): Anim;
1987
+ }
1988
+ declare function callout(target: Node | Vec, body: string, options?: CalloutOptions): Callout;
1989
+
1990
+ interface TypewriterOptions extends AnimOptions {
1991
+ /** Show a block cursor at the writing position. */
1992
+ cursor?: boolean;
1993
+ cursorColor?: ColorInput;
1994
+ }
1995
+ /** Characters appear one at a time, at a steady rate, with an optional cursor. */
1996
+ declare function typewriter(target: Target, options?: TypewriterOptions): Anim;
1997
+ interface WipeOptions extends AnimOptions {
1998
+ /** Edge the reveal starts from. */
1999
+ from?: 'left' | 'right' | 'top' | 'bottom';
2000
+ /** Share of the time each mark takes to fade up as the edge passes. */
2001
+ soft?: number;
2002
+ /** Slide each mark this far as it arrives. */
2003
+ travel?: number;
2004
+ }
2005
+ /**
2006
+ * Reveal marks in the order a moving edge reaches them. Each mark fades up as
2007
+ * the edge passes, so a dense diagram opens like a sweep across the page.
2008
+ */
2009
+ declare function wipe(target: Target, options?: WipeOptions): Anim;
2010
+ interface CounterOptions {
2011
+ digits?: number;
2012
+ size?: number;
2013
+ color?: ColorInput;
2014
+ font?: 'mono' | 'sans' | 'serif';
2015
+ weight?: 400 | 600 | 700;
2016
+ prefix?: string;
2017
+ suffix?: string;
2018
+ /** Thousands separators. */
2019
+ grouped?: boolean;
2020
+ }
2021
+ /** A number readout. Animate it with `countUp`. */
2022
+ declare class Counter extends Node {
2023
+ readonly value: Value;
2024
+ constructor(initial?: number, options?: CounterOptions);
2025
+ }
2026
+ declare function counter(initial?: number, options?: CounterOptions): Counter;
2027
+ /** Count a Counter or Value to a target. */
2028
+ declare function countUp(target: Counter | Value, to: number, options?: AnimOptions): Anim;
2029
+ /** Steady rotation for as long as it plays: radians per second, around the center or a point. */
2030
+ declare function spin(node: Node, rate: number, options?: AnimOptions & {
2031
+ about?: Vec;
2032
+ }): Anim;
2033
+ /** Two nodes trade places along opposite arcs. */
2034
+ declare function swap(a: Node, b: Node, options?: AnimOptions & {
2035
+ lift?: number;
2036
+ }): Anim;
2037
+ interface HighlightOptions extends AnimOptions {
2038
+ color?: ColorInput;
2039
+ opacity?: number;
2040
+ /** Extra room around the target. */
2041
+ pad?: number;
2042
+ radius?: number;
2043
+ /** Keep the mark afterwards. By default it stays until you fade it. */
2044
+ from?: 'left' | 'right';
2045
+ }
2046
+ /**
2047
+ * A marker stroke sweeps across a target and stays behind it. `.mark` is the
2048
+ * node, so it can be faded out later.
2049
+ */
2050
+ declare function highlightSweep(target: Node | readonly Node[], options?: HighlightOptions): Anim & {
2051
+ mark: Node;
2052
+ };
2053
+
2054
+ interface FromSvgOptions {
2055
+ /** Fit into this box, keeping proportions. Defaults to the SVG's own size. */
2056
+ width?: number;
2057
+ height?: number;
2058
+ /** Center the picture on the node's origin. On by default. */
2059
+ center?: boolean;
2060
+ /** Keep a full-canvas background rectangle. Films have their own, so it is dropped by default. */
2061
+ background?: boolean;
2062
+ /** Split filled multi-glyph outlines into one node per glyph, so text writes letter by letter. */
2063
+ splitGlyphs?: boolean;
2064
+ }
2065
+ /** An imported picture. It is a regular node tree, so every verb works on it. */
2066
+ declare class SvgNode extends Node {
2067
+ readonly byId: Map<string, Node>;
2068
+ pictureWidth: number;
2069
+ pictureHeight: number;
2070
+ /** Find an element by its SVG id. */
2071
+ find(id: string): Node;
2072
+ }
2073
+ /**
2074
+ * Turn SVG markup into stage nodes. Each shape becomes a leaf whose origin is its
2075
+ * center, so it can be drawn, faded, scaled, and morphed like anything else.
2076
+ * Filters and masks are skipped, because shapes draw without them.
2077
+ */
2078
+ declare function fromSvg(source: string, options?: FromSvgOptions): SvgNode;
2079
+
2080
+ /**
2081
+ * 3D on the stage: a camera, meshes, curves, and points, all projected to paths
2082
+ * on every frame and drawn back to front. There is no GPU dependency, so the
2083
+ * browser and the video exporter produce the same picture. Camera angles and
2084
+ * every object's opacity and reveal live on the timeline like anything else.
2085
+ */
2086
+
2087
+ type Vec3 = readonly [number, number, number];
2088
+ type Reactive3 = Vec3 | (() => Vec3);
2089
+ interface Scene3DOptions {
2090
+ /** Angle down from straight overhead, in radians. 0 looks straight down. */
2091
+ phi?: number;
2092
+ /** Rotation around the vertical axis, in radians. */
2093
+ theta?: number;
2094
+ /** Camera distance in math units. Smaller exaggerates perspective. */
2095
+ distance?: number;
2096
+ /** Stage pixels per math unit. */
2097
+ unit?: number;
2098
+ focus?: Vec3;
2099
+ /** Set to false for an orthographic view. */
2100
+ perspective?: boolean;
2101
+ /** Direction toward the light, in world space. */
2102
+ light?: Vec3;
2103
+ /** Share of light that reaches every face, from 0 to 1. */
2104
+ ambient?: number;
2105
+ /** Size of the bright highlight. 0 turns it off. */
2106
+ shine?: number;
2107
+ /** How much distant marks sink toward the background, from 0 to 1. */
2108
+ fog?: number;
2109
+ fogColor?: ColorInput;
2110
+ /** Multiplies lit surface color. Defaults to 0.8 on dark looks, where large areas also bloom. */
2111
+ brightness?: number;
2112
+ }
2113
+ /** Everything an object needs to project itself for one frame. */
2114
+ declare class View3D {
2115
+ readonly ops: PathOp[];
2116
+ readonly depths: number[];
2117
+ rx: number;
2118
+ ry: number;
2119
+ ux: number;
2120
+ uy: number;
2121
+ uz: number;
2122
+ dx: number;
2123
+ dy: number;
2124
+ dz: number;
2125
+ fx: number;
2126
+ fy: number;
2127
+ fz: number;
2128
+ distance: number;
2129
+ unit: number;
2130
+ perspective: boolean;
2131
+ matrix: Mat;
2132
+ alpha: number;
2133
+ scale: number;
2134
+ light: Vec3;
2135
+ half: Vec3;
2136
+ ambient: number;
2137
+ shine: number;
2138
+ fog: number;
2139
+ fogColor: Rgba;
2140
+ depthRange: number;
2141
+ brightness: number;
2142
+ px: number;
2143
+ py: number;
2144
+ pz: number;
2145
+ ps: number;
2146
+ /** Project a world point. Returns false when it falls behind the camera. */
2147
+ project(x: number, y: number, z: number): boolean;
2148
+ /** Local stage point before the scene's own transform, for placing labels. */
2149
+ screen(x: number, y: number, z: number): [number, number] | null;
2150
+ /** Mix a color toward the background for marks further from the camera. */
2151
+ fogged(r: number, g: number, b: number, depth: number): Rgba;
2152
+ push(op: PathOp, depth: number): void;
2153
+ }
2154
+ /**
2155
+ * A thing in a 3D scene. It is a regular node with an empty 2D path, so verbs
2156
+ * work on it: fadeIn sets opacity, and draw animates its reveal through trimTo.
2157
+ */
2158
+ declare abstract class Object3D extends Node {
2159
+ constructor();
2160
+ abstract emit(view: View3D, time: number): void;
2161
+ /** Screen-facing labels, drawn on top. */
2162
+ labelsNow(_view: View3D): Node[];
2163
+ protected objectAlpha(view: View3D): number;
2164
+ }
2165
+ declare class Scene3D extends Node {
2166
+ readonly phi: Value;
2167
+ readonly theta: Value;
2168
+ readonly distance: Value;
2169
+ readonly unit: Value;
2170
+ readonly focusX: Value;
2171
+ readonly focusY: Value;
2172
+ readonly focusZ: Value;
2173
+ private readonly orthographic;
2174
+ private readonly settings;
2175
+ private readonly spins;
2176
+ private openSpin;
2177
+ constructor(options?: Scene3DOptions);
2178
+ private readonly worldless;
2179
+ private view;
2180
+ private render;
2181
+ /** Move the camera over time. Any subset of phi, theta, distance, unit, and focus. */
2182
+ orbit(target: {
2183
+ phi?: number;
2184
+ theta?: number;
2185
+ distance?: number;
2186
+ unit?: number;
2187
+ focus?: Vec3;
2188
+ }, options?: AnimOptions): Anim;
2189
+ /** Start a slow ambient rotation here on the timeline, in radians per second. */
2190
+ spin(rate?: number): this;
2191
+ stopSpin(): this;
2192
+ /** Stage point of a world position at this moment, for placing 2D notes. */
2193
+ stagePoint(point: Vec3): [number, number];
2194
+ }
2195
+ declare function scene3d(options?: Scene3DOptions): Scene3D;
2196
+ interface SurfaceOptions {
2197
+ /** Grid cells in each direction. A number applies to both. */
2198
+ resolution?: number | readonly [number, number];
2199
+ /** One color for the whole surface. */
2200
+ color?: ColorInput;
2201
+ /** Color ramp by height. */
2202
+ colors?: readonly ColorInput[];
2203
+ /** Two colors in a checker pattern. */
2204
+ checker?: readonly [ColorInput, ColorInput];
2205
+ /** Any color per face. */
2206
+ colorAt?: (x: number, y: number, z: number, u: number, v: number) => Rgba;
2207
+ opacity?: number;
2208
+ /** Thin lines along the cells. */
2209
+ mesh?: ColorInput | false;
2210
+ meshOpacity?: number;
2211
+ meshWidth?: number;
2212
+ /** Set to false for flat, unlit color. */
2213
+ shaded?: boolean;
2214
+ /** Skip faces pointing away. Good for closed shapes such as spheres. */
2215
+ cull?: boolean;
2216
+ /** Recompute the shape on every frame from time. */
2217
+ animate?: boolean;
2218
+ /** Point normals away from this point. Closed shapes need it so `cull` keeps the near side. */
2219
+ outwardFrom?: Vec3;
2220
+ }
2221
+ type ParametricFn = (u: number, v: number, t: number) => Vec3;
2222
+ /** A shaded mesh. Faces sort with everything else in the scene, so objects can intersect. */
2223
+ declare class Surface3D extends Object3D {
2224
+ private readonly fn;
2225
+ private readonly uRange;
2226
+ private readonly vRange;
2227
+ private readonly options;
2228
+ private readonly nu;
2229
+ private readonly nv;
2230
+ private readonly positions;
2231
+ private readonly normals;
2232
+ private readonly vertexNormals;
2233
+ private readonly shadingNormals;
2234
+ private readonly faceColors;
2235
+ private computedFor;
2236
+ private readonly screenX;
2237
+ private readonly screenY;
2238
+ private readonly screenZ;
2239
+ private readonly valid;
2240
+ private readonly meshColor;
2241
+ private ramp;
2242
+ private checkerColors;
2243
+ constructor(fn: ParametricFn, uRange: readonly [number, number], vRange: readonly [number, number], options?: SurfaceOptions);
2244
+ private compute;
2245
+ emit(view: View3D, time: number): void;
2246
+ }
2247
+ /** A surface over any two parameters. */
2248
+ declare function parametricSurface(fn: ParametricFn, u: readonly [number, number], v: readonly [number, number], options?: SurfaceOptions): Surface3D;
2249
+ /** A height field z = f(x, y). `f` also receives time when `animate` is on. */
2250
+ declare function surface(f: (x: number, y: number, t: number) => number, options?: SurfaceOptions & {
2251
+ x?: readonly [number, number];
2252
+ y?: readonly [number, number];
2253
+ }): Surface3D;
2254
+ declare function sphere(radius?: number, options?: SurfaceOptions & {
2255
+ center?: Vec3;
2256
+ }): Surface3D;
2257
+ interface Line3DStyle {
2258
+ color?: ColorInput;
2259
+ /** Color ramp along the line. */
2260
+ colors?: readonly ColorInput[];
2261
+ width?: number;
2262
+ opacity?: number;
2263
+ glow?: number;
2264
+ /** Draw over everything else in the scene. */
2265
+ onTop?: boolean;
2266
+ /** Nudge toward the camera so a line lying on a surface stays visible. */
2267
+ bias?: number;
2268
+ }
2269
+ /** A curve in space, cut into pieces so it passes correctly in front of and behind other marks. */
2270
+ declare class Curve3D extends Object3D {
2271
+ private readonly style;
2272
+ private readonly points;
2273
+ private readonly stops;
2274
+ constructor(f: (t: number) => Vec3, from: number, to: number, style?: Line3DStyle & {
2275
+ samples?: number;
2276
+ });
2277
+ emit(view: View3D): void;
2278
+ }
2279
+ declare function curve3d(f: (t: number) => Vec3, from: number, to: number, style?: Line3DStyle & {
2280
+ samples?: number;
2281
+ }): Curve3D;
2282
+ /** A straight line in space. Ends can be functions, so it can follow moving points. */
2283
+ declare class Line3D extends Object3D {
2284
+ private readonly a;
2285
+ private readonly b;
2286
+ private readonly style;
2287
+ constructor(a: Reactive3, b: Reactive3, style?: Line3DStyle & {
2288
+ pieces?: number;
2289
+ });
2290
+ emit(view: View3D): void;
2291
+ }
2292
+ declare function line3d(a: Reactive3, b: Reactive3, style?: Line3DStyle & {
2293
+ pieces?: number;
2294
+ }): Line3D;
2295
+ /** An arrow in space. The head always faces the camera, so it reads from any angle. */
2296
+ declare class Vector3D extends Line3D {
2297
+ private readonly from3;
2298
+ private readonly to3;
2299
+ private readonly tipSize;
2300
+ constructor(from: Reactive3, to: Reactive3, style?: Line3DStyle & {
2301
+ tip?: number;
2302
+ });
2303
+ emit(view: View3D): void;
2304
+ }
2305
+ declare function vector3d(from: Reactive3, to: Reactive3, style?: Line3DStyle & {
2306
+ tip?: number;
2307
+ }): Vector3D;
2308
+ interface Points3DStyle {
2309
+ color?: ColorInput;
2310
+ /** Per-point color. */
2311
+ colorAt?: (index: number, point: Vec3) => ColorInput;
2312
+ /** Radius in stage pixels at the focus. */
2313
+ radius?: number;
2314
+ opacity?: number;
2315
+ onTop?: boolean;
2316
+ /** Soft ring around each point. */
2317
+ halo?: number;
2318
+ }
2319
+ /** Points in space. Pass a function to move them. They shrink with distance and sort with everything else. */
2320
+ declare class Points3D extends Object3D {
2321
+ private readonly source;
2322
+ private readonly style;
2323
+ constructor(source: readonly Vec3[] | (() => readonly Vec3[]), style?: Points3DStyle);
2324
+ emit(view: View3D): void;
2325
+ }
2326
+ declare function points3d(points: readonly Vec3[] | (() => readonly Vec3[]), style?: Points3DStyle): Points3D;
2327
+ /** One point in space, as a convenience over points3d. */
2328
+ declare function point3d(point: Reactive3, style?: Points3DStyle): Points3D;
2329
+ /** The path a moving point has taken, with a fading tail. Scrubs correctly in both directions. */
2330
+ declare class Trail3D extends Object3D {
2331
+ private readonly point;
2332
+ private readonly from;
2333
+ private readonly to;
2334
+ private readonly style;
2335
+ private readonly cache;
2336
+ constructor(point: () => Vec3, from: number, to: number, style?: Line3DStyle & {
2337
+ tail?: number;
2338
+ rate?: number;
2339
+ fade?: number;
2340
+ });
2341
+ private sample;
2342
+ emit(view: View3D, time: number): void;
2343
+ }
2344
+ declare function trail3d(point: () => Vec3, from: number, to: number, style?: Line3DStyle & {
2345
+ tail?: number;
2346
+ rate?: number;
2347
+ fade?: number;
2348
+ }): Trail3D;
2349
+ interface Axes3DOptions {
2350
+ x?: readonly [number, number];
2351
+ y?: readonly [number, number];
2352
+ z?: readonly [number, number];
2353
+ step?: number;
2354
+ color?: ColorInput;
2355
+ width?: number;
2356
+ /** Labels at the axis tips. Pass false to leave them off. */
2357
+ labels?: boolean | readonly [string, string, string];
2358
+ labelSize?: number;
2359
+ numbers?: boolean;
2360
+ ticks?: boolean;
2361
+ /** Pull toward the camera, so axes lying in a surface do not break into dashes. */
2362
+ bias?: number;
2363
+ onTop?: boolean;
2364
+ }
2365
+ /** Three axes with ticks and tips. */
2366
+ declare class Axes3D extends Object3D {
2367
+ private readonly options;
2368
+ private readonly ranges;
2369
+ private readonly step;
2370
+ private readonly tags;
2371
+ private readonly numberNodes;
2372
+ constructor(options?: Axes3DOptions);
2373
+ emit(view: View3D): void;
2374
+ labelsNow(view: View3D): Node[];
2375
+ }
2376
+ declare function axes3d(options?: Axes3DOptions): Axes3D;
2377
+ interface GridPlaneOptions {
2378
+ x?: readonly [number, number];
2379
+ y?: readonly [number, number];
2380
+ z?: number;
2381
+ step?: number;
2382
+ color?: ColorInput;
2383
+ width?: number;
2384
+ opacity?: number;
2385
+ }
2386
+ /** A hairline grid on a horizontal plane, to ground a scene. */
2387
+ declare class GridPlane3D extends Object3D {
2388
+ private readonly options;
2389
+ constructor(options?: GridPlaneOptions);
2390
+ emit(view: View3D): void;
2391
+ }
2392
+ declare function gridPlane3d(options?: GridPlaneOptions): GridPlane3D;
2393
+ /** A label pinned to a point in space. It always faces the camera. */
2394
+ declare class Label3D extends Object3D {
2395
+ private readonly position;
2396
+ private readonly content;
2397
+ constructor(content: string | Node, position: Reactive3, options?: {
2398
+ size?: number;
2399
+ color?: ColorInput;
2400
+ math?: boolean;
2401
+ offset?: Vec;
2402
+ });
2403
+ private readonly offset;
2404
+ emit(): void;
2405
+ labelsNow(view: View3D): Node[];
2406
+ }
2407
+ declare function label3d(content: string | Node, position: Reactive3, options?: {
2408
+ size?: number;
2409
+ color?: ColorInput;
2410
+ math?: boolean;
2411
+ offset?: Vec;
2412
+ }): Label3D;
2413
+
2414
+ interface PlayerOptions {
2415
+ loop?: boolean;
2416
+ autoplay?: boolean;
2417
+ speed?: number;
2418
+ /** Stop at each chapter and wait for `play()` or `next()`. Use it for presentations. */
2419
+ stepped?: boolean;
2420
+ /** Device pixels per CSS pixel. Defaults to the display's ratio, capped for speed. */
2421
+ pixelRatio?: number;
2422
+ onTime?: (time: number) => void;
2423
+ onState?: (state: {
2424
+ playing: boolean;
2425
+ }) => void;
2426
+ }
2427
+ /** Plays a compiled film on a canvas. Seeking is instant, in either direction. */
2428
+ declare class FilmPlayer {
2429
+ film: CompiledFilm;
2430
+ readonly canvas: HTMLCanvasElement;
2431
+ private readonly ctx;
2432
+ private readonly options;
2433
+ private raf;
2434
+ private last;
2435
+ private currentTime;
2436
+ private playing;
2437
+ private scale;
2438
+ private readonly images;
2439
+ private bloomLayers;
2440
+ private observer;
2441
+ speed: number;
2442
+ constructor(canvas: HTMLCanvasElement, film: CompiledFilm, options?: PlayerOptions);
2443
+ get time(): number;
2444
+ get isPlaying(): boolean;
2445
+ /** Replace the film with one of the same size, such as after an edit. The time stays. */
2446
+ swap(film: CompiledFilm): void;
2447
+ /** Match the canvas buffer to its displayed size. */
2448
+ resize(): void;
2449
+ play(): void;
2450
+ pause(): void;
2451
+ toggle(): void;
2452
+ seek(time: number): void;
2453
+ /** Jump to the next chapter boundary, or to the end. */
2454
+ next(): void;
2455
+ previous(): void;
2456
+ destroy(): void;
2457
+ private readonly tick;
2458
+ private lookupImage;
2459
+ private paint;
2460
+ /** Bright marks spill soft light. The layers hold marks only, so the background never lifts. */
2461
+ private applyBloom;
2462
+ }
2463
+ /** Per-element overrides for `<vz-film look="paper" background="#f7f3ea">`. */
2464
+ interface FilmLoadOptions {
2465
+ look?: string;
2466
+ background?: string;
2467
+ }
2468
+ /**
2469
+ * `<vz-film src="./my-film.js" autoplay loop></vz-film>`
2470
+ *
2471
+ * Embeds a live, seekable film. It compiles when scrolled near, pauses when out
2472
+ * of view, and honors prefers-reduced-motion by showing the final frame.
2473
+ */
2474
+ declare function defineFilmElement(load: (src: string, options?: FilmLoadOptions) => Promise<CompiledFilm>, name?: string): void;
2475
+
2476
+ /** Browser entry: the engine, the player, and the <vz-film> element. */
2477
+
2478
+ /** Load a film module by URL and compile it once per look and background. */
2479
+ declare function loadFilm(src: string, options?: FilmLoadOptions): Promise<CompiledFilm>;
2480
+
2481
+ export { ArrayCells, Axes, Axes3D, BarChart, Callout, CodeBlock, CompiledFilm, ComplexPlane, Connector, Counter, Curve3D, EMPTY_BOUNDS, Epicycles, FilmPlayer, Graph, GraphEdge, GraphNode, GridPlane3D, Heatmap, Histogram, IDENTITY, InfoBox, LOOKS, Label3D, LabeledDot, Line3D, LineChart, MatrixNode, NeuralNet, Node, NumberLine, NumberPlane, Object3D, PieChart, Points3D, Scatter, Scene3D, Stage, StreamLines, Surface3D, Suspend, SvgNode, TexNode, TextNode, TokenRow, Trail3D, TreeGraph, Value, Vector3D, VectorField, View3D, along, angleMark, appear, apply, applyComplex, applyMatrix, arc, arcPath, areaUnder, arrayCells, arrow, attentionMatrix, axes, axes3d, barChart, blueprint, bounce, brace, braceLabel, buildOps, call, callout, chalk, checkFilm, circle, circlePath, circumscribe, codeBlock, along$1 as colorAlong, compileFilm, complex, complexPlane, compose, concat, connector, countUp, counter, css, cubicBezier, curve, curve3d, curveThrough, dashedGuides, decimal, defineFilmElement, delay, donut, dot, draw, during, dynamic, easeInCubic, easeInExpo, easeInOutCubic, easeInOutQuint, easeInQuad, easeOutCubic, easeOutExpo, easeOutQuad, easeOutQuint, ellipse, epicycles, erase, fade, fadeIn, fadeOut, film, flash, fontFor, fourier, fourierPoint, frameInkBounds, frameToSvg, fromSvg, glyphPath, graph, gridPlane3d, group, grow, heatmap, highlightSweep, histogram, indicate, infoBox, invert, isFilm, isSuspend, label3d, labeledDot, lagged, legend, line, line3d, lineChart, linePath, linear, linearGradient, lingering, loadFilm, matScale, matrix, midnight, mixColor, morph, morphCode, morphMatching, moveTo, mul, neon, neuralNet, notQuiteThere, numberLine, overshoot, paintFrame, paper, par, parametric, parametricPath, parametricSurface, parseColor, parseFont, parseSvgPath, pathBounds, pathLength, pathToD, pie, plane, point3d, pointAt, points3d, polyPath, polygon, polyline, pulse, radialGradient, ramp, recolor, rect, rectPath, regularPolygon, resolveLook, retime, reverseRing, riemann, rightAngle, ring, ringCenter, ringLength, ringThrough, ripple, rotate, runningStart, rushFrom, rushInto, samplePath, scaleBy, scatter, scene3d, secantLine, segmentCount, seq, setAssetBase, shake, shape, shift, signedArea, slowInto, smooth, smoothBy, smoothPath, smoother, sparkline, sphere, spin, spring, streamLines, subdivideEach, surface, surroundingBox, svgPath, swap, tangentAt, tangentLine, tex, text, thereAndBack, thereAndBackWithPause, to, toPaint, tokenize, tokens, traced, trail3d, transformPath, tree, trimPath, trimRing, typewriter, unionBounds, vanish, vector3d, vectorField, warp, warpPath, wiggle, wipe, write };
2482
+ export type { AngleOptions, Anim, AnimContext, AnimOptions, AreaOptions, ArrayCellsOptions, ArrowStyle, Aspect, AttentionMatrixOptions, Axes3DOptions, AxesOptions, BarChartOptions, BarDatum, BlendMode, Bounds, BraceLabelOptions, CalloutOptions, Canvas2D, Caption, Chapter, ChartOptions, Clip, CodeBlockOptions, CodeToken, ColorInput, CompileOverrides, ComplexPlaneOptions, ConnectorEnd, ConnectorOptions, CounterOptions, DecimalOptions, DrawOp, Ease, Edge, EpicyclesOptions, FadeOptions, FieldFn, FilmCheckOptions, FilmCheckReport, FilmDefinition, FilmDiagnostic, FilmDiagnosticCode, FilmLoadOptions, FilmOptions, FontFamily, FontWeight, FourierTerm, Frame, FromSvgOptions, Gradient, GraphEdgeSpec, GraphNodeSpec, GraphOptions, GridPlaneOptions, HeatmapOptions, HighlightOptions, HistogramOptions, ImageOp, InfoBoxOptions, InfoRow, LabeledDotOptions, LegendItem, LegendOptions, Line3DStyle, LineChartOptions, LineSeries, LoadedFont, Look, LookName, LookToken, Mat, MatrixOptions, NeuralNetOptions, NodeProps, NumberLineOptions, Paint, ParametricFn, Path, PathOp, PieDatum, PieOptions, PlaneOptions, PlayOptions, PlayerOptions, Points3DStyle, PropName, Rgba, RiemannOptions, Ring, ScatterOptions, ScatterPoint, Scene3DOptions, SecantOptions, ShapeStyle, Side, SparklineOptions, StageImage, StreamLinesOptions, SurfaceOptions, SurroundOptions, TangentOptions, Target, TexOptions, TextOptions, TokenKind, TokenSpec, TokensOptions, TracedOptions, TreeOptions, TreeSpec, TypewriterOptions, Vec, Vec3, VectorFieldOptions, WipeOptions };