manim-web 0.19.0 → 0.21.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 (36) hide show
  1. package/dist/audio/AudioAnalyzer.d.ts +132 -0
  2. package/dist/audio/AudioAnalyzer.d.ts.map +1 -0
  3. package/dist/core/AudioManager.d.ts +8 -0
  4. package/dist/core/AudioManager.d.ts.map +1 -1
  5. package/dist/export/FrameExporter.d.ts +25 -12
  6. package/dist/export/FrameExporter.d.ts.map +1 -1
  7. package/dist/export/SvgExporter.d.ts +104 -0
  8. package/dist/export/SvgExporter.d.ts.map +1 -0
  9. package/dist/export/WebCodecsExporter.d.ts +39 -0
  10. package/dist/export/WebCodecsExporter.d.ts.map +1 -1
  11. package/dist/export/alphaBackground.d.ts +78 -0
  12. package/dist/export/alphaBackground.d.ts.map +1 -0
  13. package/dist/export/index.d.ts +1 -0
  14. package/dist/export/index.d.ts.map +1 -1
  15. package/dist/index.d.ts +5 -3
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +3 -3
  18. package/dist/integrations/react.js +17 -17
  19. package/dist/integrations/vue.js +16 -16
  20. package/dist/manim-web.browser.js +2525 -1691
  21. package/dist/mobjects/graphing/PieChart.d.ts +180 -0
  22. package/dist/mobjects/graphing/PieChart.d.ts.map +1 -0
  23. package/dist/mobjects/graphing/index.d.ts +1 -0
  24. package/dist/mobjects/graphing/index.d.ts.map +1 -1
  25. package/dist/mobjects/particles/ParticleSystem.d.ts +162 -0
  26. package/dist/mobjects/particles/ParticleSystem.d.ts.map +1 -0
  27. package/dist/mobjects/particles/index.d.ts +6 -0
  28. package/dist/mobjects/particles/index.d.ts.map +1 -0
  29. package/dist/mobjects/text/TextOnPath.d.ts +70 -0
  30. package/dist/mobjects/text/TextOnPath.d.ts.map +1 -0
  31. package/dist/mobjects/text/index.d.ts +2 -0
  32. package/dist/mobjects/text/index.d.ts.map +1 -1
  33. package/dist/mobjects/text/textOnPathLayout.d.ts +110 -0
  34. package/dist/mobjects/text/textOnPathLayout.d.ts.map +1 -0
  35. package/dist/{src-B3jkHw_D.js → src-B_DX0DD1.js} +2507 -1673
  36. package/package.json +1 -1
@@ -0,0 +1,132 @@
1
+ import { Mobject, UpdaterFunction } from '../core/Mobject';
2
+ import { ValueTracker } from '../mobjects/value-tracker/ValueTracker';
3
+ import { AudioManager } from '../core/AudioManager';
4
+ /**
5
+ * The subset of `AnalyserNode` the analyzer reads from.
6
+ *
7
+ * A real `AnalyserNode` satisfies this interface. Tests inject a stub that
8
+ * implements only these members, so no real `AudioContext` is required.
9
+ */
10
+ export interface SpectrumAnalyser {
11
+ /** FFT window size (power of two). */
12
+ readonly fftSize: number;
13
+ /** Number of frequency bins (`fftSize / 2`). */
14
+ readonly frequencyBinCount: number;
15
+ /** The owning context; only its sample rate is read. */
16
+ readonly context: Pick<BaseAudioContext, 'sampleRate'>;
17
+ /** Fill `array` with the current byte frequency spectrum. */
18
+ getByteFrequencyData(array: Uint8Array): void;
19
+ /** Fill `array` with the current byte time-domain waveform. */
20
+ getByteTimeDomainData(array: Uint8Array): void;
21
+ }
22
+ /** Options for constructing an {@link AudioAnalyzer}. */
23
+ export interface AudioAnalyzerOptions {
24
+ /** FFT window size (power of two, 32..32768). Defaults to 2048. */
25
+ fftSize?: number;
26
+ /** Smoothing between frames [0, 1]. Defaults to 0.8. */
27
+ smoothingTimeConstant?: number;
28
+ /** Pre-built analyser to read from (dependency injection / testing). */
29
+ analyser?: SpectrumAnalyser;
30
+ }
31
+ /** Options for mapping an audio read onto a {@link ValueTracker} value. */
32
+ export interface AudioReactiveBindOptions {
33
+ /** Multiplier applied to the raw read. Defaults to 1. */
34
+ scale?: number;
35
+ /** Constant added after scaling. Defaults to 0. */
36
+ offset?: number;
37
+ }
38
+ /** Whether the Web Audio analysis API is available in this environment. */
39
+ export declare function isAudioAnalysisSupported(): boolean;
40
+ /**
41
+ * Reads a live frequency spectrum and feeds it into manim-web animations.
42
+ */
43
+ export declare class AudioAnalyzer {
44
+ private _analyser;
45
+ private readonly _fftSize;
46
+ private readonly _smoothing;
47
+ private _freqBuffer;
48
+ private _timeBuffer;
49
+ /** Context this analyzer created itself (closed on {@link dispose}). */
50
+ private _ownedContext;
51
+ constructor(options?: AudioAnalyzerOptions);
52
+ /**
53
+ * Create an analyzer tapping an `<audio>` / `<video>` element.
54
+ * The element stays audible (the analyser is wired to the destination).
55
+ * No-op (silent, returns zeros) when Web Audio is unavailable.
56
+ */
57
+ static fromMediaElement(element: HTMLMediaElement, options?: AudioAnalyzerOptions): AudioAnalyzer;
58
+ /**
59
+ * Create an analyzer tapping the master output of an {@link AudioManager}.
60
+ * No-op (silent, returns zeros) when Web Audio is unavailable.
61
+ */
62
+ static fromAudioManager(manager: AudioManager, options?: AudioAnalyzerOptions): AudioAnalyzer;
63
+ /**
64
+ * Tap an `<audio>` / `<video>` element. Creates an owned `AudioContext`.
65
+ * @returns this for chaining
66
+ */
67
+ connectMediaElement(element: HTMLMediaElement): this;
68
+ /**
69
+ * Tap an existing `AudioNode` (for example a `BufferSource` or `GainNode`).
70
+ * The node's own `AudioContext` is used; no new context is created.
71
+ * @returns this for chaining
72
+ */
73
+ connectSource(node: AudioNode): this;
74
+ /**
75
+ * Fill `target` (or an internal buffer) with the byte frequency spectrum.
76
+ * Returns a zero-filled buffer when no analyser is connected.
77
+ * @returns The buffer that was written
78
+ */
79
+ getByteFrequencyData(target?: Uint8Array): Uint8Array;
80
+ /** Alias of {@link getByteFrequencyData} that returns the internal buffer. */
81
+ getFrequencyData(): Uint8Array;
82
+ /**
83
+ * Average the normalized energy [0, 1] across the band `[lowHz, highHz]`.
84
+ * Returns 0 when no analyser is connected or the band is empty.
85
+ */
86
+ getBand(lowHz: number, highHz: number): number;
87
+ /** Normalized bass energy [0, 1] (20-250 Hz). */
88
+ getBass(): number;
89
+ /** Normalized mid energy [0, 1] (250-4000 Hz). */
90
+ getMid(): number;
91
+ /** Normalized treble energy [0, 1] (4000-20000 Hz). */
92
+ getTreble(): number;
93
+ /**
94
+ * Overall loudness as the RMS [0, 1] of the time-domain waveform.
95
+ * Returns 0 when no analyser is connected.
96
+ */
97
+ getLevel(): number;
98
+ /**
99
+ * Drive a {@link ValueTracker} from an audio read each frame.
100
+ *
101
+ * Adds an updater to the tracker that sets its value to
102
+ * `offset + read() * scale` on every `update(dt)`. Other mobjects follow the
103
+ * tracker through their own updaters.
104
+ *
105
+ * @param tracker - The tracker to drive
106
+ * @param read - Audio read to sample (defaults to {@link getLevel})
107
+ * @param options - Scale and offset applied to the read
108
+ * @returns The updater, so it can be removed with `tracker.removeUpdater`
109
+ */
110
+ bindToTracker(tracker: ValueTracker, read?: () => number, options?: AudioReactiveBindOptions): UpdaterFunction;
111
+ /**
112
+ * Build an updater that maps the spectrum onto any mobject property.
113
+ *
114
+ * The returned updater passes the mobject, this analyzer, and `dt` to
115
+ * `apply`, so `apply` can read bands and set any property. Add it with
116
+ * `mobject.addUpdater(analyzer.createUpdater(...))`.
117
+ */
118
+ createUpdater<M extends Mobject>(apply: (mobject: M, analyzer: AudioAnalyzer, dt: number) => void): UpdaterFunction;
119
+ /** Whether an analyser is connected (reads return live data). */
120
+ get connected(): boolean;
121
+ /** The number of frequency bins the spectrum reads produce. */
122
+ get frequencyBinCount(): number;
123
+ /** The connected analyser, or `null` when unavailable. */
124
+ get analyser(): SpectrumAnalyser | null;
125
+ /** Release the owned `AudioContext`, if this analyzer created one. */
126
+ dispose(): void;
127
+ /** Create and configure a real `AnalyserNode` on `ctx`. */
128
+ private _createAnalyser;
129
+ /** Adopt an analyser and resize the read buffers to match it. */
130
+ private _setAnalyser;
131
+ }
132
+ //# sourceMappingURL=AudioAnalyzer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AudioAnalyzer.d.ts","sourceRoot":"","sources":["../../src/audio/AudioAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,KAAK,EAAE,OAAO,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E,OAAO,IAAI,IAAI;IAYf,2DAA2D;IAC3D,OAAO,CAAC,eAAe;IAOvB,iEAAiE;IACjE,OAAO,CAAC,YAAY;CASrB"}
@@ -183,6 +183,14 @@ export declare class AudioManager {
183
183
  * @returns MediaStreamAudioDestinationNode connected to the master gain
184
184
  */
185
185
  createStreamDestination(): MediaStreamAudioDestinationNode;
186
+ /**
187
+ * Connect the master output to an external node (for example an
188
+ * `AnalyserNode` used for audio-reactive visualization). The node keeps
189
+ * receiving the mixed output until the context is closed.
190
+ *
191
+ * @param node - The destination node to feed from the master gain
192
+ */
193
+ connectOutput(node: AudioNode): void;
186
194
  /**
187
195
  * Encode an AudioBuffer as a WAV Blob (PCM 16-bit).
188
196
  */
@@ -1 +1 @@
1
- {"version":3,"file":"AudioManager.d.ts","sourceRoot":"","sources":["../../src/core/AudioManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAMnD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,qFAAqF;IACrF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oFAAoF;IACpF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,qCAAqC;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3B,uDAAuD;IACvD,SAAS,EAAE,M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;;;;;;OAMG;IACG,OAAO,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,UAAU,GAAE,MAAc,GAAG,OAAO,CAAC,WAAW,CAAC;IA8ClF;;;;;;OAMG;IACG,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,UAAU,GAAE,MAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAK7E;;;;;;OAMG;IACH,uBAAuB,IAAI,+BAA+B;IAO1D;;;;;;OAMG;IACH,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;IASpC;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAuDlD;;OAEG;IACH,OAAO,IAAI,IAAI;IAef;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAgF1B;;OAEG;IACH,OAAO,CAAC,eAAe;CAgBxB"}
@@ -1,18 +1,9 @@
1
- /**
2
- * FrameExporter - in-browser PNG frame export for manim-web scenes.
3
- *
4
- * Captures the scene's WebGL canvas as PNG image data with no ffmpeg and no
5
- * server round-trip. It uses `canvas.toBlob` when available and falls back to
6
- * `canvas.toDataURL` so it also works where `toBlob` is missing.
7
- *
8
- * Two capture modes are provided:
9
- * - `exportFramePNG` captures one frame (the current frame, or a seeked time).
10
- * - `exportPNGSequence` seeks and captures one frame per timeline step, the
11
- * same frame loop VideoExporter uses.
12
- */
1
+ import { AlphaRenderer } from './alphaBackground';
13
2
  /**
14
3
  * Duck-type interface for Scene, used to avoid a circular import.
15
4
  * FrameExporter only needs canvas access, seek, and the timeline duration.
5
+ *
6
+ * `renderer` and `render` are optional and used only for transparent export.
16
7
  */
17
8
  interface ExportableScene {
18
9
  getCanvas(): HTMLCanvasElement;
@@ -20,6 +11,12 @@ interface ExportableScene {
20
11
  getHeight(): number;
21
12
  seek(time: number): void;
22
13
  getTimelineDuration(): number | null;
14
+ /** The WebGL renderer, used only for transparent export. */
15
+ renderer?: {
16
+ getThreeRenderer(): AlphaRenderer;
17
+ } | null;
18
+ /** Re-render the current frame, used only for transparent single-frame export. */
19
+ render?(): void;
23
20
  }
24
21
  /** Options for a single-frame PNG capture. */
25
22
  export interface FrameExportOptions {
@@ -29,6 +26,14 @@ export interface FrameExportOptions {
29
26
  type?: string;
30
27
  /** Quality from 0-1 for lossy types such as 'image/jpeg'. Ignored for PNG. */
31
28
  quality?: number;
29
+ /**
30
+ * Render with a transparent background, so the PNG carries a real alpha
31
+ * channel (RGBA, transparent where nothing is drawn). Defaults to false.
32
+ * Needs a Scene created with `{ alpha: true }` (or `backgroundOpacity < 1`);
33
+ * otherwise the export throws a clear error instead of producing an opaque
34
+ * image. Use a lossless type such as 'image/png' to keep the alpha channel.
35
+ */
36
+ transparent?: boolean;
32
37
  }
33
38
  /** Options for a PNG frame-sequence capture. */
34
39
  export interface PNGSequenceOptions {
@@ -44,6 +49,14 @@ export interface PNGSequenceOptions {
44
49
  quality?: number;
45
50
  /** Progress callback (0-1). */
46
51
  onProgress?: (progress: number) => void;
52
+ /**
53
+ * Render with a transparent background, so each PNG carries a real alpha
54
+ * channel (RGBA, transparent where nothing is drawn). Defaults to false.
55
+ * Needs a Scene created with `{ alpha: true }` (or `backgroundOpacity < 1`);
56
+ * otherwise the export throws a clear error instead of producing opaque
57
+ * frames. Use a lossless type such as 'image/png' to keep the alpha channel.
58
+ */
59
+ transparent?: boolean;
47
60
  }
48
61
  /**
49
62
  * Export a single frame as a PNG Blob.
@@ -1 +1 @@
1
- {"version":3,"file":"FrameExporter.d.ts","sourceRoot":"","sources":["../../src/export/FrameExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;GAGG;AACH,UAAU,eAAe;IACvB,SAAS,IAAI,iBAAiB,CAAC;IAC/B,QAAQ,IAAI,MAAM,CAAC;IACnB,SAAS,IAAI,MAAM,CAAC;IACpB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,mBAAmB,IAAI,MAAM,GAAG,IAAI,CAAC;CAC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CAgBf;AA6BD;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,EAAE,CAAC,CA4BjB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAS/D;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,eAAe,EACtB,QAAQ,GAAE,MAAoB,EAC9B,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAGf"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * SvgExporter - in-browser scene-to-SVG vector export for manim-web.
3
+ *
4
+ * Walks the scene's VMobjects and writes each one as an SVG `<path>` with the
5
+ * correct fill (color, opacity, fill-rule) and stroke (color, width, opacity).
6
+ * The output is a complete, standalone `<svg>` string with a `viewBox` that
7
+ * matches the raster exporters' pixel aspect, so the vector result lines up
8
+ * with a PNG of the same frame. Unlike GIF/Video/PNG/WebCodecs export, the
9
+ * result is resolution-independent and editable in a vector tool.
10
+ *
11
+ * Scope: 2D VMobjects. The scene camera is treated as the orthographic 2D
12
+ * frame, so each point maps through its world transform and then flattens onto
13
+ * the x/y plane (z is dropped). True 3D mobjects (meshes such as Surface) are
14
+ * not VMobjects and are skipped. A VMobject authored in a 3D/perspective scene
15
+ * is projected with the same 2D frame mapping, which is only exact for the 2D
16
+ * orthographic case.
17
+ *
18
+ * Three capture entry points are provided, mirroring FrameExporter:
19
+ * - `sceneToSVG` returns the SVG markup as a string.
20
+ * - `exportSVG` returns the SVG as a Blob.
21
+ * - `exportAndDownloadSVG` triggers a browser download (guards the DOM).
22
+ */
23
+ /**
24
+ * Duck-type interface for the scene camera the exporter needs.
25
+ *
26
+ * It matches Camera2D: a frame width/height in world units and a world-space
27
+ * center position. The frame is the orthographic box the raster exporters use.
28
+ */
29
+ export interface SvgExportableCamera {
30
+ /** Frame width in world units. */
31
+ frameWidth: number;
32
+ /** Frame height in world units. */
33
+ frameHeight: number;
34
+ /** World-space camera center (only x and y are read). */
35
+ position: {
36
+ x: number;
37
+ y: number;
38
+ };
39
+ }
40
+ /**
41
+ * Duck-type interface for Scene, used to avoid a circular import.
42
+ *
43
+ * The exporter needs the pixel dimensions (to match the raster aspect), the
44
+ * camera frame, and the top-level mobjects in draw order.
45
+ */
46
+ export interface SvgExportableScene {
47
+ /** Canvas width in pixels. */
48
+ getWidth(): number;
49
+ /** Canvas height in pixels. */
50
+ getHeight(): number;
51
+ /** The scene camera (orthographic 2D frame). */
52
+ camera: SvgExportableCamera;
53
+ /** Top-level mobjects, in insertion (draw) order. */
54
+ mobjects: Iterable<{
55
+ getFamily(): unknown[];
56
+ userId?: string;
57
+ }>;
58
+ }
59
+ /** Options for an SVG export. */
60
+ export interface SvgExportOptions {
61
+ /**
62
+ * Decimal places for coordinates and numeric attributes. Defaults to 3.
63
+ * Fewer places give smaller output; more give higher precision.
64
+ */
65
+ precision?: number;
66
+ /**
67
+ * Background color for the `<svg>` (a solid `<rect>` behind everything).
68
+ * Omit for a transparent background.
69
+ */
70
+ background?: string;
71
+ }
72
+ /**
73
+ * Convert a scene to a complete, standalone SVG string.
74
+ *
75
+ * Each top-level mobject becomes a `<g>` group holding the `<path>` elements of
76
+ * its VMobject family, in draw order. World coordinates map to the pixel
77
+ * viewBox through the camera frame, matching the raster exporters' aspect.
78
+ * An empty scene yields a valid, empty `<svg>`.
79
+ *
80
+ * @param scene - The scene to export
81
+ * @param options - Export options
82
+ * @returns The SVG markup
83
+ */
84
+ export declare function sceneToSVG(scene: SvgExportableScene, options?: SvgExportOptions): string;
85
+ /**
86
+ * Export a scene as an SVG Blob.
87
+ *
88
+ * @param scene - The scene to export
89
+ * @param options - Export options
90
+ * @returns A Blob of type `image/svg+xml`
91
+ */
92
+ export declare function exportSVG(scene: SvgExportableScene, options?: SvgExportOptions): Blob;
93
+ /**
94
+ * Convenience helper: export a scene as SVG and download it.
95
+ *
96
+ * Guards the DOM: it throws a clear error when no `document` is available
97
+ * (for example in a worker or during server-side use).
98
+ *
99
+ * @param scene - The scene to export
100
+ * @param filename - The target filename. Defaults to 'scene.svg'.
101
+ * @param options - Export options
102
+ */
103
+ export declare function exportAndDownloadSVG(scene: SvgExportableScene, filename?: string, options?: SvgExportOptions): void;
104
+ //# sourceMappingURL=SvgExporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SvgExporter.d.ts","sourceRoot":"","sources":["../../src/export/SvgExporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAMH;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACpC;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,8BAA8B;IAC9B,QAAQ,IAAI,MAAM,CAAC;IACnB,+BAA+B;IAC/B,SAAS,IAAI,MAAM,CAAC;IACpB,gDAAgD;IAChD,MAAM,EAAE,mBAAmB,CAAC;IAC5B,qDAAqD;IACrD,QAAQ,EAAE,QAAQ,CAAC;QAAE,SAAS,IAAI,OAAO,EAAE,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACjE;AAED,iCAAiC;AACjC,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAwKD;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAgCxF;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAGrF;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,kBAAkB,EACzB,QAAQ,GAAE,MAAoB,EAC9B,OAAO,CAAC,EAAE,gBAAgB,GACzB,IAAI,CAKN"}
@@ -1,3 +1,4 @@
1
+ import { AlphaRenderer } from './alphaBackground';
1
2
  /**
2
3
  * WebCodecsExporter - deterministic, high-quality video export for manim-web.
3
4
  *
@@ -25,6 +26,10 @@ interface ExportableScene {
25
26
  getHeight(): number;
26
27
  seek(time: number): void;
27
28
  getTimelineDuration(): number | null;
29
+ /** The WebGL renderer, used only for transparent (alpha) export. */
30
+ renderer?: {
31
+ getThreeRenderer(): AlphaRenderer;
32
+ } | null;
28
33
  }
29
34
  /** Video codec, shared by the encoder and the container track. */
30
35
  export type WebCodecsVideoCodec = 'avc' | 'hevc' | 'vp9' | 'av1';
@@ -48,6 +53,18 @@ export interface WebCodecsExportOptions {
48
53
  keyFrameInterval?: number;
49
54
  /** Progress callback (0-1). */
50
55
  onProgress?: (progress: number) => void;
56
+ /**
57
+ * Export with a transparent background, so the video carries an alpha
58
+ * channel to composite over other footage. Defaults to false.
59
+ *
60
+ * Alpha needs the 'webm' format with the 'vp9' codec, because only that path
61
+ * carries an alpha side channel. When `alpha` is set and `format`/`codec` are
62
+ * not given, they default to 'webm' and 'vp9'. It also needs a Scene created
63
+ * with `{ alpha: true }` (or `backgroundOpacity < 1`) and a browser that can
64
+ * encode VP9 with alpha. When any requirement is unmet, `export()` throws a
65
+ * clear error instead of producing opaque video that claims transparency.
66
+ */
67
+ alpha?: boolean;
51
68
  }
52
69
  interface ResolvedWebCodecsExportOptions {
53
70
  fps: number;
@@ -59,6 +76,7 @@ interface ResolvedWebCodecsExportOptions {
59
76
  duration: number;
60
77
  keyFrameInterval: number;
61
78
  onProgress: (progress: number) => void;
79
+ alpha: boolean;
62
80
  }
63
81
  /**
64
82
  * Deterministic WebCodecs-based video exporter for manim-web scenes.
@@ -87,6 +105,27 @@ export declare class WebCodecsExporter {
87
105
  * @throws Error if WebCodecs is unavailable (use VideoExporter instead)
88
106
  */
89
107
  export(): Promise<Blob>;
108
+ /**
109
+ * Validate that the configured codec and format can carry an alpha channel.
110
+ *
111
+ * Only webm with vp9 carries an alpha side channel, so any other combination
112
+ * cannot produce a transparent video.
113
+ *
114
+ * @throws Error when the format or codec cannot carry alpha
115
+ */
116
+ private _assertAlphaCodec;
117
+ /**
118
+ * Check that the browser can encode the codec with an alpha channel.
119
+ *
120
+ * Uses `VideoEncoder.isConfigSupported` when available. When the browser
121
+ * reports the alpha config as unsupported, this throws rather than silently
122
+ * producing opaque video. When detection is unavailable, it proceeds and
123
+ * lets the encoder's error callback surface any failure.
124
+ *
125
+ * @param mapping - The codec mapping for the configured codec
126
+ * @throws Error when the browser cannot encode the codec with alpha
127
+ */
128
+ private _assertAlphaEncodeSupport;
90
129
  /**
91
130
  * Lazily import the muxer for the configured container and wrap it in a
92
131
  * container-agnostic handle.
@@ -1 +1 @@
1
- {"version":3,"file":"WebCodecsExporter.d.ts","sourceRoot":"","sources":["../../src/export/WebCodecsExporter.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;GAGG;AACH,UAAU,eAAe;IACvB,SAAS,IAAI,iBAAiB,CAAC;IAC/B,QAAQ,IAAI,MAAM,CAAC;IACnB,SAAS,IAAI,MAAM,CAAC;IACpB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,mBAAmB,IAAI,MAAM,GAAG,IAAI,CAAC;CACtC;AAED,kEAAkE;AAClE,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;AAEjE,sDAAsD;AACtD,MAAM,WAAW,sBAAsB;I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CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;;;;;;;;;OAUG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,UAAU,8BAA8B;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;IACvB,KAAK,EAAE,mBAAmB,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,KAAK,EAAE,OAAO,CAAC;CAChB;AAyBD;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,QAAQ,CAAiC;IAEjD;;;;OAIG;gBACS,KAAK,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,sBAAsB;IAoBpE;;OAEG;IACH,MAAM,CAAC,WAAW,IAAI,OAAO;IAI7B;;;;;;;;;OASG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IA8E7B;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB;IAYzB;;;;;;;;;;OAUG;YACW,yBAAyB;IAuBvC;;;OAGG;YACW,YAAY;IAuC1B;;OAEG;IACH,UAAU,IAAI,QAAQ,CAAC,8BAA8B,CAAC;CAGvD;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,eAAe,EACtB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,iBAAiB,CAEnB"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Shared helpers for transparent / alpha background export.
3
+ *
4
+ * Both the PNG frame exporter and the WebCodecs video exporter can render the
5
+ * scene with a transparent background, so the exported frames carry a real
6
+ * alpha channel instead of the opaque background color. The pixels are
7
+ * transparent where nothing is drawn, so the result composites over other
8
+ * footage.
9
+ *
10
+ * A transparent export has two requirements:
11
+ * 1. The WebGL context was created with an alpha channel. The Scene enables it
12
+ * with `{ alpha: true }` (or `backgroundOpacity < 1`). Without it the canvas
13
+ * has no alpha to export, so a transparent export would silently produce an
14
+ * opaque image. This module detects that and throws a clear error instead.
15
+ * 2. The renderer clears to a transparent color while it captures the frames.
16
+ * `withTransparentClear` sets the clear alpha to 0 for the capture, then
17
+ * restores the previous clear alpha, so normal rendering is unchanged.
18
+ */
19
+ /**
20
+ * Minimal duck-type of `THREE.WebGLRenderer`, limited to the alpha controls the
21
+ * exporters need. It avoids a direct dependency on three.js in the exporters.
22
+ */
23
+ export interface AlphaRenderer {
24
+ /** Get the current clear alpha (0 = transparent, 1 = opaque). */
25
+ getClearAlpha(): number;
26
+ /** Set the clear alpha used on the next render. */
27
+ setClearAlpha(alpha: number): void;
28
+ /** Get the WebGL context, used to read its context attributes. */
29
+ getContext(): {
30
+ getContextAttributes(): WebGLContextAttributes | null;
31
+ };
32
+ }
33
+ /**
34
+ * Minimal duck-type of a Scene that can expose its WebGL renderer for alpha
35
+ * export. The real Scene satisfies this through its `renderer` getter.
36
+ */
37
+ export interface AlphaCapableScene {
38
+ renderer?: {
39
+ getThreeRenderer(): AlphaRenderer;
40
+ } | null;
41
+ }
42
+ /** Error message when the WebGL context has no alpha channel to export. */
43
+ export declare const ALPHA_CONTEXT_ERROR: string;
44
+ /** Error message when the scene does not expose a WebGL renderer. */
45
+ export declare const ALPHA_RENDERER_ERROR: string;
46
+ /**
47
+ * Resolve the underlying WebGL renderer from a scene.
48
+ * @param scene - The scene to read the renderer from
49
+ * @returns The WebGL renderer, or null when the scene exposes none
50
+ */
51
+ export declare function resolveAlphaRenderer(scene: AlphaCapableScene): AlphaRenderer | null;
52
+ /**
53
+ * Report whether the WebGL context was created with an alpha channel.
54
+ * @param renderer - The WebGL renderer to inspect
55
+ * @returns True when the context has an alpha channel
56
+ */
57
+ export declare function hasAlphaChannel(renderer: AlphaRenderer): boolean;
58
+ /**
59
+ * Resolve the WebGL renderer for a transparent export, or throw a clear error.
60
+ *
61
+ * @param scene - The scene to export
62
+ * @returns The WebGL renderer, ready for a transparent capture
63
+ * @throws Error when the scene exposes no renderer, or the context has no alpha
64
+ */
65
+ export declare function requireAlphaRenderer(scene: AlphaCapableScene): AlphaRenderer;
66
+ /**
67
+ * Run a capture with a transparent clear color, then restore the previous one.
68
+ *
69
+ * The clear alpha is set to 0 for the duration of `fn`, so frames rendered
70
+ * inside it clear to transparent. The previous clear alpha is restored even
71
+ * when `fn` throws, so normal rendering is unchanged after the export.
72
+ *
73
+ * @param renderer - The WebGL renderer to control
74
+ * @param fn - The capture function to run under a transparent clear
75
+ * @returns The value `fn` resolves to
76
+ */
77
+ export declare function withTransparentClear<T>(renderer: AlphaRenderer, fn: () => Promise<T> | T): Promise<T>;
78
+ //# sourceMappingURL=alphaBackground.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alphaBackground.d.ts","sourceRoot":"","sources":["../../src/export/alphaBackground.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,iEAAiE;IACjE,aAAa,IAAI,MAAM,CAAC;IACxB,mDAAmD;IACnD,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,kEAAkE;IAClE,UAAU,IAAI;QAAE,oBAAoB,IAAI,sBAAsB,GAAG,IAAI,CAAA;KAAE,CAAC;CACzE;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE;QAAE,gBAAgB,IAAI,aAAa,CAAA;KAAE,GAAG,IAAI,CAAC;CACzD;AAED,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,QAGkB,CAAC;AAEnD,qEAAqE;AACrE,eAAO,MAAM,oBAAoB,QACgE,CAAC;AAElG;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,GAAG,aAAa,GAAG,IAAI,CAMnF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAGhE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,GAAG,aAAa,CAS5E;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CAAC,CAAC,EAC1C,QAAQ,EAAE,aAAa,EACvB,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,GACvB,OAAO,CAAC,CAAC,CAAC,CAQZ"}
@@ -3,4 +3,5 @@ export { VideoExporter, createVideoExporter, type VideoExportOptions } from './V
3
3
  export { exportFramePNG, exportPNGSequence, downloadBlob, exportAndDownloadPNG, type FrameExportOptions, type PNGSequenceOptions, } from './FrameExporter';
4
4
  export { WebCodecsExporter, createWebCodecsExporter, type WebCodecsExportOptions, type WebCodecsVideoCodec, } from './WebCodecsExporter';
5
5
  export { chooseVideoExporterStrategy, type VideoExporterStrategy } from './chooseExporter';
6
+ export { sceneToSVG, exportSVG, exportAndDownloadSVG, type SvgExportOptions, type SvgExportableScene, type SvgExportableCamera, } from './SvgExporter';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/export/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG9F,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,EACpB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,GACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,2BAA2B,EAAE,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/export/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG9F,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,EACpB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,GACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,2BAA2B,EAAE,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EACL,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB,MAAM,eAAe,CAAC"}
package/dist/index.d.ts CHANGED
@@ -23,6 +23,7 @@ export { Voiceover, type VoiceoverOptions, type VoiceoverCallback, type Voiceove
23
23
  export { VoiceoverScene, type VoiceoverSceneOptions, type VoiceoverSceneAudioOptions, } from './audio/VoiceoverScene';
24
24
  export { setSpeechSynthesizer, getSpeechSynthesizer, isSpeechSupported, WebSpeechSynthesizer, type SpeechSynthesizer, type SpeechUtteranceHandle, type SpeechOptions, type SpeechBoundaryInfo, } from './audio/speechSynthesizer';
25
25
  export { parseBookmarks, type Bookmark, type ParsedTranscript } from './audio/bookmarks';
26
+ export { AudioAnalyzer, isAudioAnalysisSupported, type AudioAnalyzerOptions, type AudioReactiveBindOptions, type SpectrumAnalyser, } from './audio/AudioAnalyzer';
26
27
  export { attachCaptionTrack, formatVttTimestamp, voiceoverToVTT, type CaptionTrackHandle, type CaptionTrackOptions, type VoiceoverCaptionCue, } from './a11y/captions';
27
28
  export { applyReducedMotion, getReducedMotionRunTime, isReducedMotionEnabled, prefersReducedMotion, reducedRunTime, resetReducedMotion, setReducedMotion, shouldReduceMotion, type ReducedMotionOptions, } from './a11y/reducedMotion';
28
29
  export { announceMobject, AriaNarrator, createLiveRegion, describeMobject, type AriaDescribable, type LiveRegionOptions, } from './a11y/ariaNarration';
@@ -35,10 +36,10 @@ export { MovingCamera, ThreeDCamera, MultiCamera, MappingCamera, SplitScreenCame
35
36
  export { CameraFrame, CameraAnimateProxy, type CameraFrameOptions, type CameraFrameState, type CameraAnimationOptions, } from './core/CameraFrame';
36
37
  export { Lighting, type AmbientLightOptions, type DirectionalLightOptions, type PointLightOptions, type SpotLightOptions, } from './core/Lighting';
37
38
  export { Circle, type CircleOptions, Line, type LineOptions, Rectangle, Square, type RectangleOptions, Polygon, Triangle, RegularPolygon, Hexagon, Pentagon, type PolygonOptions, Polygram, type PolygramOptions, TipableVMobject, type TipableVMobjectOptions, type TipOptions, Arrow, DoubleArrow, Vector, type ArrowOptions, Arc, type ArcOptions, ArcBetweenPoints, type ArcBetweenPointsOptions, Ellipse, type EllipseOptions, Annulus, type AnnulusOptions, AnnularSector, type AnnularSectorOptions, Sector, type SectorOptions, ArcPolygon, type ArcPolygonOptions, type ArcConfig, CurvedArrow, CurvedDoubleArrow, type CurvedArrowOptions, TangentialArc, type TangentialArcOptions, DashedLine, type DashedLineOptions, DashedVMobject, type DashedVMobjectOptions, CubicBezier, type CubicBezierOptions, Dot, SmallDot, LargeDot, type DotOptions, BackgroundRectangle, SurroundingRectangle, Underline, Cross, type BackgroundRectangleOptions, type SurroundingRectangleOptions, type UnderlineOptions, type CrossOptions, Label, type LabelOptions, RoundedRectangle, type RoundedRectangleOptions, Star, type StarOptions, RegularPolygram, type RegularPolygramOptions, Cutout, type CutoutOptions, ConvexHull, type ConvexHullOptions, Angle, RightAngle, Elbow, TangentLine, type AngleOptions, type AngleInput, type RightAngleOptions, type ElbowOptions, type TangentLineOptions, ArrowTip, ArrowTriangleTip, ArrowTriangleFilledTip, ArrowCircleTip, ArrowCircleFilledTip, ArrowSquareTip, ArrowSquareFilledTip, StealthTip, type ArrowTipOptions, type CubicBezierPoints, Union, Intersection, Difference, Exclusion, BooleanResult, union, intersection, difference, exclusion, type BooleanOperationOptions, LabeledPolygram, type LabeledPolygramOptions, LabeledLine, LabeledArrow, LabeledDot, AnnotationDot, type LabeledLineOptions, type LabeledArrowOptions, type LabeledDotOptions, type AnnotationDotOptions, type LabelDirection, type LabelOrientation, } from './mobjects/geometry';
38
- export { NumberLine, type NumberLineOptions, UnitInterval, type UnitIntervalOptions, Axes, type AxesOptions, NumberPlane, type NumberPlaneOptions, type BackgroundLineStyle, FunctionGraph, type FunctionGraphOptions, ImplicitFunction, type ImplicitFunctionOptions, ParametricFunction, type ParametricFunctionOptions, VectorFieldVector, type VectorFieldVectorOptions, ComplexPlane, type ComplexPlaneOptions, PolarPlane, type PolarPlaneOptions, BarChart, type BarChartOptions, VectorField, ArrowVectorField, StreamLines, stepVectorField, type Integrator, type VectorFunction, type ColorFunction, type VectorFieldBaseOptions, type ArrowVectorFieldOptions, type StreamLinesOptions, type ContinuousMotionOptions, } from './mobjects/graphing';
39
+ export { NumberLine, type NumberLineOptions, UnitInterval, type UnitIntervalOptions, Axes, type AxesOptions, NumberPlane, type NumberPlaneOptions, type BackgroundLineStyle, FunctionGraph, type FunctionGraphOptions, ImplicitFunction, type ImplicitFunctionOptions, ParametricFunction, type ParametricFunctionOptions, VectorFieldVector, type VectorFieldVectorOptions, ComplexPlane, type ComplexPlaneOptions, PolarPlane, type PolarPlaneOptions, BarChart, type BarChartOptions, PieChart, type PieChartOptions, DonutChart, type DonutChartOptions, computeSliceGeometry, type SliceGeometry, type LabelPosition, VectorField, ArrowVectorField, StreamLines, stepVectorField, type Integrator, type VectorFunction, type ColorFunction, type VectorFieldBaseOptions, type ArrowVectorFieldOptions, type StreamLinesOptions, type ContinuousMotionOptions, } from './mobjects/graphing';
39
40
  export { type CoordinateSystem, ScaleBase, LinearBase, LogBase, type GetCustomLabelsOptions, } from './mobjects/graphing';
40
41
  export { HeatMap, type HeatMapOptions, type ScalarField2D, ContourPlot, type ContourPlotOptions, type ContourField, sampleColormap, valueToColor, VIRIDIS, INFERNO, COOLWARM, marchingSquares, type ContourSegment, } from './mobjects/graphing';
41
- export { Text, type TextOptions, Paragraph, type ParagraphOptions, MarkupText, type MarkupTextOptions, MathTex, type MathTexOptions, MathTexSVG, type MathTexSVGOptions, MathTexImage, type MathTexImageOptions, type TexRenderer, Tex, type TexOptions, ensureKatexStyles, areKatexStylesLoaded, setKatexStylesheetUrl, renderLatexToSVG, preloadMathJax, isMathJaxLoaded, katexCanRender, setMathJaxScriptUrl, type MathJaxRenderOptions, type MathJaxRenderResult, parseSVGPathData, svgToVMobjects, type SVGToVMobjectOptions, DecimalNumber, Integer, type DecimalNumberOptions, Variable, type VariableOptions, GlyphVMobject, type GlyphVMobjectOptions, TextGlyphGroup, type TextGlyphGroupOptions, Code, type CodeOptions, type CodeColorScheme, type CodeToken, type Token, type TokenType, DEFAULT_COLOR_SCHEME, MONOKAI_COLOR_SCHEME, SingleStringMathTex, type SingleStringMathTexOptions, MathTexPart, type MathTexPartOptions, BulletedList, Title, MarkdownText, type BulletedListOptions, type TitleOptions, type MarkdownTextOptions, type StyledTextSegment, type TextStyleMaps, type TextStyleRun, buildStyledTextLines, Typst, MathTypst, type TypstOptions, type MathTypstOptions, renderTypstToSVG, preloadTypst, isTypstLoaded, setTypstCompiler, type TypstRenderOptions, type TypstRenderResult, type TypstSvgCompiler, } from './mobjects/text';
42
+ export { Text, type TextOptions, Paragraph, type ParagraphOptions, MarkupText, type MarkupTextOptions, MathTex, type MathTexOptions, MathTexSVG, type MathTexSVGOptions, MathTexImage, type MathTexImageOptions, type TexRenderer, Tex, type TexOptions, ensureKatexStyles, areKatexStylesLoaded, setKatexStylesheetUrl, renderLatexToSVG, preloadMathJax, isMathJaxLoaded, katexCanRender, setMathJaxScriptUrl, type MathJaxRenderOptions, type MathJaxRenderResult, parseSVGPathData, svgToVMobjects, type SVGToVMobjectOptions, DecimalNumber, Integer, type DecimalNumberOptions, Variable, type VariableOptions, GlyphVMobject, type GlyphVMobjectOptions, TextGlyphGroup, type TextGlyphGroupOptions, TextOnPath, type TextOnPathOptions, type TextOnPathGlyph, type TextOnPathSource, computeGlyphPlacements, sampledPathFromPoints, sampledPathFromFunction, visibleGlyphChars, alignmentToOffset, type SampledPath, type GlyphLayoutEntry, type GlyphLayoutOptions, type GlyphPlacement, type TextOnPathAlignment, type TextOnPathOverflow, type PathPoint, Code, type CodeOptions, type CodeColorScheme, type CodeToken, type Token, type TokenType, DEFAULT_COLOR_SCHEME, MONOKAI_COLOR_SCHEME, SingleStringMathTex, type SingleStringMathTexOptions, MathTexPart, type MathTexPartOptions, BulletedList, Title, MarkdownText, type BulletedListOptions, type TitleOptions, type MarkdownTextOptions, type StyledTextSegment, type TextStyleMaps, type TextStyleRun, buildStyledTextLines, Typst, MathTypst, type TypstOptions, type MathTypstOptions, renderTypstToSVG, preloadTypst, isTypstLoaded, setTypstCompiler, type TypstRenderOptions, type TypstRenderResult, type TypstSvgCompiler, } from './mobjects/text';
42
43
  export { Mobject3D, Sphere, type SphereOptions, Cube, Box3D, type CubeOptions, type Box3DOptions, Cylinder, Cone, type CylinderOptions, type ConeOptions, Torus, type TorusOptions, Line3D, type Line3DOptions, Arrow3D, Vector3D, type Arrow3DOptions, Surface3D, Surface3D as Surface, type Surface3DOptions, ParametricSurface, SurfacePresets, type ParametricSurfaceOptions, TexturedSurface, texturedSphere, type TexturedSurfaceOptions, type TexturedSphereOptions, ThreeDAxes, type ThreeDAxesOptions, Polyhedron, Tetrahedron, Octahedron, Icosahedron, Dodecahedron, type PolyhedronOptions, type TetrahedronOptions, type OctahedronOptions, type IcosahedronOptions, type DodecahedronOptions, Prism, Dot3D, ThreeDVMobject, type PrismOptions, type Dot3DOptions, type ThreeDVMobjectOptions, ConvexHull3D, type ConvexHull3DOptions, ImplicitSurface, type ImplicitSurfaceOptions, marchingCubes, type MarchingCubesOptions, type MarchingCubesResult, type ScalarField3D, InstancedMobject, type InstancedMobjectOptions, type InstanceTransform, } from './mobjects/three-d';
43
44
  export { ModelMobject, setModelLoaderFactory, detectModelFormat, type ModelMobjectOptions, type ModelFormat, type ModelUpAxis, type ModelLoader, type ModelLoaderFactory, } from './mobjects/three-d/ModelMobject';
44
45
  export { applyObjMaterials, setMtlLoaderFactory, deriveMtlUrl, deriveBasePath, type MtlLoader, type MtlLoaderFactory, type MtlMaterials, type ObjMaterialSink, type ObjMaterialOptions, } from './mobjects/three-d/objMaterials';
@@ -53,6 +54,7 @@ export { VideoMobject, type VideoMobjectOptions } from './mobjects/video';
53
54
  export { AnimatedImageMobject, setGifDecoder, type AnimatedImageMobjectOptions, type DecodedGif, type DecodedGifFrame, type GifDecoder, } from './mobjects/image/AnimatedImageMobject';
54
55
  export { ScreenRectangle, type ScreenRectangleOptions, FullScreenRectangle, type FullScreenRectangleOptions, FullScreenFadeRectangle, type FullScreenFadeRectangleOptions, createFadeToBlack, createFadeToWhite, DEFAULT_ASPECT_RATIO, } from './mobjects/frame';
55
56
  export { PMobject, PGroup, PointMobject, PointCloudDot, type PMobjectOptions, type PGroupOptions, type PointMobjectOptions, type PointCloudDotOptions, type PointData, Mobject1D, type Mobject1DOptions, Mobject2D, type Mobject2DOptions, type Distribution2D, } from './mobjects/point';
57
+ export { ParticleSystem, type ParticleSystemOptions, type ParticleForces, type ParticleSnapshot, } from './mobjects/particles';
56
58
  export { MandelbrotSet, type MandelbrotSetOptions, NewtonFractal, type NewtonFractalOptions, } from './mobjects/fractals';
57
59
  export { SampleSpace, type SampleSpaceOptions, type Partition, type DivideOptions, type BraceAnnotationOptions, DiceFace, createDiceRow, type DiceFaceOptions, } from './mobjects/probability';
58
60
  export { Animation, type AnimationOptions, type RateFunction } from './animation/Animation';
@@ -103,7 +105,7 @@ export { OrbitControls, type OrbitControlsOptions } from './interaction';
103
105
  export { MovablePoint, makeMovablePoint, type MovablePointOptions, Slider, makeSlider, type SliderOptions, } from './interaction';
104
106
  export { MatrixTracker, makeMatrixTracker, applyMatrixLive, type Matrix2x2, type MatrixSource, type BasisVectorSource, type DependentPoint, type DynamicMatrixOptions, type LiveMatrixBinding, } from './interaction';
105
107
  export { GifExporter, createGifExporter, type GifExportOptions, VideoExporter, createVideoExporter, type VideoExportOptions, } from './export';
106
- export { exportFramePNG, exportPNGSequence, downloadBlob, exportAndDownloadPNG, type FrameExportOptions, type PNGSequenceOptions, WebCodecsExporter, createWebCodecsExporter, type WebCodecsExportOptions, type WebCodecsVideoCodec, chooseVideoExporterStrategy, type VideoExporterStrategy, } from './export';
108
+ export { exportFramePNG, exportPNGSequence, downloadBlob, exportAndDownloadPNG, type FrameExportOptions, type PNGSequenceOptions, WebCodecsExporter, createWebCodecsExporter, type WebCodecsExportOptions, type WebCodecsVideoCodec, chooseVideoExporterStrategy, type VideoExporterStrategy, sceneToSVG, exportSVG, exportAndDownloadSVG, type SvgExportOptions, type SvgExportableScene, type SvgExportableCamera, } from './export';
107
109
  export { scaleVec, addVec, subVec, linspace, dotVec, crossVec, lengthVec, normalizeVec, unitPerpendicularTo, orthonormalFrame, orientation2D, } from './utils/vectors';
108
110
  export { Player, type PlayerOptions } from './player';
109
111
  export { PlayerUI, type PlayerUIOptions, type PlayerUICallbacks } from './player';