manim-web 0.27.0 → 0.29.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 (67) hide show
  1. package/dist/index.d.ts +6 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +3 -3
  4. package/dist/integrations/notebook.js +11 -11
  5. package/dist/integrations/react.js +17 -17
  6. package/dist/integrations/vue.js +16 -16
  7. package/dist/manim-web.browser.js +2112 -952
  8. package/dist/mobjects/chemistry/MoleculeMobject.d.ts +64 -0
  9. package/dist/mobjects/chemistry/MoleculeMobject.d.ts.map +1 -0
  10. package/dist/mobjects/chemistry/chemistryTypes.d.ts +79 -0
  11. package/dist/mobjects/chemistry/chemistryTypes.d.ts.map +1 -0
  12. package/dist/mobjects/chemistry/cpkColors.d.ts +36 -0
  13. package/dist/mobjects/chemistry/cpkColors.d.ts.map +1 -0
  14. package/dist/mobjects/chemistry/index.d.ts +12 -0
  15. package/dist/mobjects/chemistry/index.d.ts.map +1 -0
  16. package/dist/mobjects/chemistry/molecules.d.ts +19 -0
  17. package/dist/mobjects/chemistry/molecules.d.ts.map +1 -0
  18. package/dist/mobjects/effects/dropShadow.d.ts +30 -0
  19. package/dist/mobjects/effects/dropShadow.d.ts.map +1 -0
  20. package/dist/mobjects/effects/index.d.ts +5 -0
  21. package/dist/mobjects/effects/index.d.ts.map +1 -0
  22. package/dist/mobjects/ml/ConvolutionalLayer.d.ts +19 -0
  23. package/dist/mobjects/ml/ConvolutionalLayer.d.ts.map +1 -0
  24. package/dist/mobjects/ml/EdgePulse.d.ts +30 -0
  25. package/dist/mobjects/ml/EdgePulse.d.ts.map +1 -0
  26. package/dist/mobjects/ml/FeedForwardLayer.d.ts +31 -0
  27. package/dist/mobjects/ml/FeedForwardLayer.d.ts.map +1 -0
  28. package/dist/mobjects/ml/ImageLayer.d.ts +29 -0
  29. package/dist/mobjects/ml/ImageLayer.d.ts.map +1 -0
  30. package/dist/mobjects/ml/NeuralNetwork.d.ts +69 -0
  31. package/dist/mobjects/ml/NeuralNetwork.d.ts.map +1 -0
  32. package/dist/mobjects/ml/NeuralNetworkLayer.d.ts +54 -0
  33. package/dist/mobjects/ml/NeuralNetworkLayer.d.ts.map +1 -0
  34. package/dist/mobjects/ml/PoolingLayer.d.ts +19 -0
  35. package/dist/mobjects/ml/PoolingLayer.d.ts.map +1 -0
  36. package/dist/mobjects/ml/featureMapStack.d.ts +25 -0
  37. package/dist/mobjects/ml/featureMapStack.d.ts.map +1 -0
  38. package/dist/mobjects/ml/forwardPass.d.ts +28 -0
  39. package/dist/mobjects/ml/forwardPass.d.ts.map +1 -0
  40. package/dist/mobjects/ml/index.d.ts +18 -0
  41. package/dist/mobjects/ml/index.d.ts.map +1 -0
  42. package/dist/mobjects/ml/mlStyles.d.ts +52 -0
  43. package/dist/mobjects/ml/mlStyles.d.ts.map +1 -0
  44. package/dist/mobjects/physics/PhysicsWorld.d.ts +83 -0
  45. package/dist/mobjects/physics/PhysicsWorld.d.ts.map +1 -0
  46. package/dist/mobjects/physics/bodies.d.ts +91 -0
  47. package/dist/mobjects/physics/bodies.d.ts.map +1 -0
  48. package/dist/mobjects/physics/builders.d.ts +59 -0
  49. package/dist/mobjects/physics/builders.d.ts.map +1 -0
  50. package/dist/mobjects/physics/collisions.d.ts +29 -0
  51. package/dist/mobjects/physics/collisions.d.ts.map +1 -0
  52. package/dist/mobjects/physics/constraints.d.ts +67 -0
  53. package/dist/mobjects/physics/constraints.d.ts.map +1 -0
  54. package/dist/mobjects/physics/index.d.ts +13 -0
  55. package/dist/mobjects/physics/index.d.ts.map +1 -0
  56. package/dist/mobjects/physics/vec2.d.ts +17 -0
  57. package/dist/mobjects/physics/vec2.d.ts.map +1 -0
  58. package/dist/mobjects/shader/ShaderMobject.d.ts +105 -0
  59. package/dist/mobjects/shader/ShaderMobject.d.ts.map +1 -0
  60. package/dist/mobjects/shader/index.d.ts +2 -0
  61. package/dist/mobjects/shader/index.d.ts.map +1 -0
  62. package/dist/mobjects/sketch/index.d.ts +5 -0
  63. package/dist/mobjects/sketch/index.d.ts.map +1 -0
  64. package/dist/mobjects/sketch/sketch.d.ts +30 -0
  65. package/dist/mobjects/sketch/sketch.d.ts.map +1 -0
  66. package/dist/{src-C3q2JQb_.js → src-CVtpypS8.js} +2094 -934
  67. package/package.json +1 -1
@@ -0,0 +1,64 @@
1
+ import { VGroup } from '../../core/VGroup';
2
+ import { Mobject, Vector3Tuple } from '../../core/Mobject';
3
+ import { AtomSpec, BondSpec, BondOrder, BondStyle, MoleculeOptions, AtomRender, BondRender } from './chemistryTypes';
4
+ export declare class MoleculeMobject extends VGroup {
5
+ /** The atom specs as given, scaled to world coordinates. */
6
+ protected _atomSpecs: AtomSpec[];
7
+ /** The bond specs as given. */
8
+ protected _bondSpecs: BondSpec[];
9
+ /** Resolved atoms, parallel to _atomSpecs. */
10
+ protected _atoms: AtomRender[];
11
+ /** Resolved bonds, parallel to _bondSpecs. */
12
+ protected _bonds: BondRender[];
13
+ protected _bondLength: number;
14
+ protected _colors: Record<string, string>;
15
+ protected _showCarbonLabels: boolean;
16
+ protected _labelFontSize: number;
17
+ protected _bondColor: string;
18
+ protected _bondSpacing: number;
19
+ /** The bond line mobjects, drawn behind the atoms. */
20
+ readonly bondsGroup: VGroup;
21
+ /** The atom label mobjects, drawn in front of the bonds. */
22
+ readonly atomsGroup: VGroup;
23
+ constructor(options: MoleculeOptions);
24
+ /** World position of an atom spec after the bond-length scale. */
25
+ protected _atomPosition(spec: AtomSpec): Vector3Tuple;
26
+ /** Whether an element should carry a label. Carbons are implicit by default. */
27
+ protected _hasLabel(element: string): boolean;
28
+ /** Resolve each atom spec into an AtomRender (position and color; label added later). */
29
+ protected _resolveAtoms(): void;
30
+ /** Create a label Text for every atom that needs one, and add it to atomsGroup. */
31
+ protected _buildAtomLabels(): void;
32
+ /** Build every bond and add its line mobjects to bondsGroup. */
33
+ protected _buildBonds(): void;
34
+ /**
35
+ * Build the line mobjects for one bond.
36
+ *
37
+ * A bond that references a missing atom produces no lines (handled
38
+ * gracefully, no throw). A wedge or dash bond produces one mobject. A normal
39
+ * bond produces `order` parallel lines.
40
+ */
41
+ protected _buildBondLines(spec: BondSpec, order: BondOrder, type: BondStyle): Mobject[];
42
+ /** Trim the bond endpoints inward at labeled atoms so the line clears the label. */
43
+ protected _trimForLabels(fromAtom: AtomRender, toAtom: AtomRender): [Vector3Tuple, Vector3Tuple];
44
+ /** Unit perpendicular to the segment, in the XY plane. */
45
+ protected _perpendicular(start: Vector3Tuple, end: Vector3Tuple): Vector3Tuple;
46
+ /** Build `order` parallel lines, evenly offset about the bond axis. */
47
+ protected _buildParallelLines(start: Vector3Tuple, end: Vector3Tuple, order: BondOrder): Mobject[];
48
+ /** Build a filled triangle wedge from `start` (point) to `end` (wide base). */
49
+ protected _buildWedge(start: Vector3Tuple, end: Vector3Tuple): Mobject;
50
+ /** Get all resolved atoms, in input order. */
51
+ getAtoms(): AtomRender[];
52
+ /** Get all resolved bonds, in input order. */
53
+ getBonds(): BondRender[];
54
+ /** Get the resolved atom at an index, or undefined. */
55
+ getAtom(index: number): AtomRender | undefined;
56
+ /** Get the resolved bond at an index, or undefined. */
57
+ getBond(index: number): BondRender | undefined;
58
+ /** The number of atoms. */
59
+ get numAtoms(): number;
60
+ /** The number of bonds. */
61
+ get numBonds(): number;
62
+ copy(): MoleculeMobject;
63
+ }
64
+ //# sourceMappingURL=MoleculeMobject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MoleculeMobject.d.ts","sourceRoot":"","sources":["../../../src/mobjects/chemistry/MoleculeMobject.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQ3D,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,SAAS,EACT,eAAe,EACf,UAAU,EACV,UAAU,EACX,MAAM,kBAAkB,CAAC;AAK1B,qBAAa,eAAgB,SAAQ,MAAM;IACzC,4DAA4D;IAC5D,SAAS,CAAC,UAAU,EAAE,QAAQ,EAAE,CAAC;IACjC,+BAA+B;IAC/B,SAAS,CAAC,UAAU,EAAE,QAAQ,EAAE,CAAC;IACjC,8CAA8C;IAC9C,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,CAAM;IACpC,8CAA8C;IAC9C,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,CAAM;IAEpC,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC;IAC9B,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,SAAS,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACrC,SAAS,CAAC,cAAc,EAAE,MAAM,CAAC;IACjC,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC;IAE/B,sDAAsD;IACtD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,4DAA4D;IAC5D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,OAAO,EAAE,eAAe;IAoCpC,kEAAkE;IAClE,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,YAAY;IAIrD,gFAAgF;IAChF,SAAS,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAO7C,yFAAyF;IACzF,SAAS,CAAC,aAAa,IAAI,IAAI;IAS/B,mFAAmF;IACnF,SAAS,CAAC,gBAAgB,IAAI,IAAI;IAgBlC,gEAAgE;IAChE,SAAS,CAAC,WAAW,IAAI,IAAI;IAY7B;;;;;;OAMG;IACH,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,EAAE;IAkBvF,oFAAoF;IACpF,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC;IAwBhG,0DAA0D;IAC1D,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY,GAAG,YAAY;IAU9E,uEAAuE;IACvE,SAAS,CAAC,mBAAmB,CAC3B,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,SAAS,GACf,OAAO,EAAE;IAwBZ,+EAA+E;IAC/E,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO;IAetE,8CAA8C;IAC9C,QAAQ,IAAI,UAAU,EAAE;IAIxB,8CAA8C;IAC9C,QAAQ,IAAI,UAAU,EAAE;IAIxB,uDAAuD;IACvD,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAI9C,uDAAuD;IACvD,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAI9C,2BAA2B;IAC3B,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,2BAA2B;IAC3B,IAAI,QAAQ,IAAI,MAAM,CAErB;IAEQ,IAAI,IAAI,eAAe;CAcjC"}
@@ -0,0 +1,79 @@
1
+ import { Vector3Tuple, Mobject } from '../../core/Mobject';
2
+ import { Text } from '../text/Text';
3
+ /** Bond multiplicity. 1 = single, 2 = double, 3 = triple. */
4
+ export type BondOrder = 1 | 2 | 3;
5
+ /**
6
+ * Bond drawing style.
7
+ * - 'normal' draws plain parallel lines by order.
8
+ * - 'wedge' draws a filled triangle (a bond toward the viewer).
9
+ * - 'dash' draws a dashed line (a bond away from the viewer).
10
+ */
11
+ export type BondStyle = 'normal' | 'wedge' | 'dash';
12
+ /** One atom in the input: an element symbol and 2D coordinates. */
13
+ export interface AtomSpec {
14
+ /** Element symbol, e.g. 'C', 'O', 'Cl'. */
15
+ element: string;
16
+ /** X coordinate in bond-length units. */
17
+ x: number;
18
+ /** Y coordinate in bond-length units. */
19
+ y: number;
20
+ }
21
+ /** One bond in the input: two atom indices and an optional order/style. */
22
+ export interface BondSpec {
23
+ /** Index of the first atom in the atoms array. */
24
+ from: number;
25
+ /** Index of the second atom in the atoms array. */
26
+ to: number;
27
+ /** Bond order. Default: 1. */
28
+ order?: BondOrder;
29
+ /** Bond style. Default: 'normal'. */
30
+ type?: BondStyle;
31
+ }
32
+ /** Options for a {@link MoleculeMobject}. */
33
+ export interface MoleculeOptions {
34
+ /** The atoms of the molecule. */
35
+ atoms: AtomSpec[];
36
+ /** The bonds between atoms. Default: []. */
37
+ bonds?: BondSpec[];
38
+ /** Scale applied to every atom coordinate. Default: 1. */
39
+ bondLength?: number;
40
+ /** Per-element color overrides, e.g. { C: '#000000' }. Merged over the CPK palette. */
41
+ colors?: Record<string, string>;
42
+ /** Whether to draw a label on carbon atoms. Default: false (skeletal convention). */
43
+ showCarbonLabels?: boolean;
44
+ /** Font size for atom labels. Default: 28. */
45
+ labelFontSize?: number;
46
+ /** Color of the bond lines. Default: white. */
47
+ bondColor?: string;
48
+ /** Distance between the parallel lines of a double or triple bond. Default: 0.08. */
49
+ bondSpacing?: number;
50
+ }
51
+ /** A resolved atom: its element, world position, color and optional label. */
52
+ export interface AtomRender {
53
+ /** Element symbol. */
54
+ element: string;
55
+ /** Position after the bond-length scale. */
56
+ position: Vector3Tuple;
57
+ /** Resolved CPK (or overridden) color. */
58
+ color: string;
59
+ /** The label mobject, or null for an implicit (unlabeled) carbon. */
60
+ label: Text | null;
61
+ }
62
+ /** A resolved bond: its endpoints, order, style and line mobjects. */
63
+ export interface BondRender {
64
+ /** Index of the first atom. */
65
+ from: number;
66
+ /** Index of the second atom. */
67
+ to: number;
68
+ /** Bond order. */
69
+ order: BondOrder;
70
+ /** Bond style. */
71
+ type: BondStyle;
72
+ /**
73
+ * The mobjects that draw this bond. A normal bond of order N has N line
74
+ * mobjects; a wedge or dash bond has one. A bond that references a missing
75
+ * atom has none.
76
+ */
77
+ lines: Mobject[];
78
+ }
79
+ //# sourceMappingURL=chemistryTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chemistryTypes.d.ts","sourceRoot":"","sources":["../../../src/mobjects/chemistry/chemistryTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,6DAA6D;AAC7D,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAElC;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAEpD,mEAAmE;AACnE,MAAM,WAAW,QAAQ;IACvB,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,CAAC,EAAE,MAAM,CAAC;IACV,yCAAyC;IACzC,CAAC,EAAE,MAAM,CAAC;CACX;AAED,2EAA2E;AAC3E,MAAM,WAAW,QAAQ;IACvB,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,EAAE,EAAE,MAAM,CAAC;IACX,8BAA8B;IAC9B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,qCAAqC;IACrC,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,iCAAiC;IACjC,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uFAAuF;IACvF,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,qFAAqF;IACrF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,8CAA8C;IAC9C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qFAAqF;IACrF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACzB,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,QAAQ,EAAE,YAAY,CAAC;IACvB,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB;AAED,sEAAsE;AACtE,MAAM,WAAW,UAAU;IACzB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB;IAClB,KAAK,EAAE,SAAS,CAAC;IACjB,kBAAkB;IAClB,IAAI,EAAE,SAAS,CAAC;IAChB;;;;OAIG;IACH,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * CPK / Jmol color palette for chemical elements.
3
+ *
4
+ * The CPK coloring convention assigns a standard color to each element
5
+ * (oxygen red, nitrogen blue, and so on). These hex values follow the Jmol
6
+ * palette, which is the de-facto standard used by most molecular viewers.
7
+ */
8
+ /** Fallback color for an element that is not in the palette. */
9
+ export declare const DEFAULT_ELEMENT_COLOR = "#DDDDDD";
10
+ /**
11
+ * Element symbol to hex color (CPK / Jmol convention).
12
+ *
13
+ * Carbon uses a visible mid-gray rather than pure black so it reads on a dark
14
+ * background; callers can override any element through MoleculeOptions.colors.
15
+ */
16
+ export declare const CPK_COLORS: Readonly<Record<string, string>>;
17
+ /**
18
+ * Normalize an element symbol to its canonical case.
19
+ *
20
+ * A symbol is an uppercase first letter and a lowercase second letter, so
21
+ * 'cl', 'CL' and 'Cl' all resolve to 'Cl'. The input is trimmed first.
22
+ * @param element - The raw element symbol.
23
+ * @returns The canonical symbol.
24
+ */
25
+ export declare function normalizeElement(element: string): string;
26
+ /**
27
+ * Resolve the color for an element.
28
+ *
29
+ * The lookup order is: caller overrides, then the CPK palette, then the
30
+ * default color. Overrides are matched on the canonical symbol.
31
+ * @param element - The element symbol (any case).
32
+ * @param overrides - Optional per-element color overrides.
33
+ * @returns The hex color string.
34
+ */
35
+ export declare function cpkColor(element: string, overrides?: Record<string, string>): string;
36
+ //# sourceMappingURL=cpkColors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cpkColors.d.ts","sourceRoot":"","sources":["../../../src/mobjects/chemistry/cpkColors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,gEAAgE;AAChE,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAE/C;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAuBvD,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMxD;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAWpF"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Chemistry mobjects for manim-web.
3
+ *
4
+ * 2D skeletal molecule structures: atoms as element labels, bonds as
5
+ * single/double/triple lines with optional wedge/dash stereochemistry, plus
6
+ * prebuilt example molecules and the CPK color palette.
7
+ */
8
+ export { MoleculeMobject } from './MoleculeMobject';
9
+ export { water, methane, benzene, ethanol, type MoleculeBuilderOptions } from './molecules';
10
+ export { cpkColor, normalizeElement, CPK_COLORS, DEFAULT_ELEMENT_COLOR } from './cpkColors';
11
+ export { type AtomSpec, type BondSpec, type BondOrder, type BondStyle, type MoleculeOptions, type AtomRender, type BondRender, } from './chemistryTypes';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mobjects/chemistry/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAC5F,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,UAAU,GAChB,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { MoleculeMobject } from './MoleculeMobject';
2
+ import { MoleculeOptions } from './chemistryTypes';
3
+ /** Style overrides a builder forwards to the MoleculeMobject (no atoms/bonds). */
4
+ export type MoleculeBuilderOptions = Partial<Omit<MoleculeOptions, 'atoms' | 'bonds'>>;
5
+ /** Water, H2O. An oxygen with two hydrogens at the bent 104.5 degree angle. */
6
+ export declare function water(options?: MoleculeBuilderOptions): MoleculeMobject;
7
+ /** Methane, CH4. A central carbon with four hydrogens; the carbon is labeled. */
8
+ export declare function methane(options?: MoleculeBuilderOptions): MoleculeMobject;
9
+ /**
10
+ * Benzene, C6H6. Six carbons in a regular hexagon ring with alternating single
11
+ * and double bonds (Kekule structure). Carbons stay implicit (skeletal).
12
+ */
13
+ export declare function benzene(options?: MoleculeBuilderOptions): MoleculeMobject;
14
+ /**
15
+ * Ethanol, C2H5OH. Two carbons and a hydroxyl group, drawn skeletal: the
16
+ * carbons are implicit, the oxygen and its hydrogen are labeled.
17
+ */
18
+ export declare function ethanol(options?: MoleculeBuilderOptions): MoleculeMobject;
19
+ //# sourceMappingURL=molecules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"molecules.d.ts","sourceRoot":"","sources":["../../../src/mobjects/chemistry/molecules.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,kFAAkF;AAClF,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;AAEvF,+EAA+E;AAC/E,wBAAgB,KAAK,CAAC,OAAO,GAAE,sBAA2B,GAAG,eAAe,CAa3E;AAED,iFAAiF;AACjF,wBAAgB,OAAO,CAAC,OAAO,GAAE,sBAA2B,GAAG,eAAe,CAkB7E;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,OAAO,GAAE,sBAA2B,GAAG,eAAe,CAW7E;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,OAAO,GAAE,sBAA2B,GAAG,eAAe,CAe7E"}
@@ -0,0 +1,30 @@
1
+ import { VGroup } from '../../core/VGroup';
2
+ import { VMobject } from '../../core/VMobject';
3
+ /** Options for {@link withDropShadow}. */
4
+ export interface DropShadowOptions {
5
+ /** Shadow offset `[dx, dy]` in scene units. Default `[0.1, -0.1]` (down-right). */
6
+ offset?: [number, number];
7
+ /** Shadow color. Default black `#000000`. */
8
+ color?: string;
9
+ /** Shadow opacity of the strongest layer (0..1). Default `0.5`. */
10
+ opacity?: number;
11
+ /** Number of shadow copies. More copies fake a softer edge. Default `1`. */
12
+ layers?: number;
13
+ /** Extra outward spread of the outer layers, as a fraction of `offset`. */
14
+ blur?: number;
15
+ /** Uniform scale of each shadow copy about its center. Default `1`. */
16
+ scale?: number;
17
+ }
18
+ /**
19
+ * Return a VGroup with a drop shadow behind `mobject`.
20
+ *
21
+ * The source is copied for every shadow layer, so it is never recolored,
22
+ * moved, or scaled. The returned group holds the shadow layers first (drawn
23
+ * behind) and the original last (drawn in front).
24
+ *
25
+ * @param mobject - Source VMobject (shape, text, group, ...)
26
+ * @param options - Shadow options; see {@link DropShadowOptions}
27
+ * @returns A VGroup = `[shadow layers..., original]`
28
+ */
29
+ export declare function withDropShadow<T extends VMobject>(mobject: T, options?: DropShadowOptions): VGroup;
30
+ //# sourceMappingURL=dropShadow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dropShadow.d.ts","sourceRoot":"","sources":["../../../src/mobjects/effects/dropShadow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,0CAA0C;AAC1C,MAAM,WAAW,iBAAiB;IAChC,mFAAmF;IACnF,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAsCD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,QAAQ,EAC/C,OAAO,EAAE,CAAC,EACV,OAAO,GAAE,iBAAsB,GAC9B,MAAM,CA4BR"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Visual effects that wrap a mobject into a styled derivative.
3
+ */
4
+ export { withDropShadow, type DropShadowOptions } from './dropShadow';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mobjects/effects/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { NeuralNetworkLayer } from './NeuralNetworkLayer';
2
+ import { NodeStyleOptions } from './mlStyles';
3
+ export interface ConvolutionalLayerOptions {
4
+ /** Number of feature-map squares in the stack. Default: 3. Must be >= 0. */
5
+ numFeatureMaps?: number;
6
+ /** Side length of each square feature map. Default: 0.5. */
7
+ mapSize?: number;
8
+ /** Diagonal offset between adjacent squares. Default: 0.15. */
9
+ offset?: number;
10
+ /** Node style overrides for the squares. */
11
+ nodeStyle?: NodeStyleOptions;
12
+ }
13
+ export declare class ConvolutionalLayer extends NeuralNetworkLayer {
14
+ private readonly _width;
15
+ constructor(options?: ConvolutionalLayerOptions);
16
+ /** Horizontal extent of the feature-map stack, used for spacing. */
17
+ layerWidth(): number;
18
+ }
19
+ //# sourceMappingURL=ConvolutionalLayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConvolutionalLayer.d.ts","sourceRoot":"","sources":["../../../src/mobjects/ml/ConvolutionalLayer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EACL,gBAAgB,EAIjB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,yBAAyB;IACxC,4EAA4E;IAC5E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC9B;AAED,qBAAa,kBAAmB,SAAQ,kBAAkB;IACxD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,OAAO,GAAE,yBAA8B;IAgBnD,oEAAoE;IAC3D,UAAU,IAAI,MAAM;CAG9B"}
@@ -0,0 +1,30 @@
1
+ import { VMobject } from '../../core/VMobject';
2
+ import { Animation, AnimationOptions } from '../../animation/Animation';
3
+ export interface EdgePulseOptions extends AnimationOptions {
4
+ /** Color the line takes when fully active. Default: white. */
5
+ activationColor?: string;
6
+ /** Peak stroke opacity at full activation. Default: 1. */
7
+ peakOpacity?: number;
8
+ /** When true, the line fades back to its resting look at alpha 1. Default: false. */
9
+ restore?: boolean;
10
+ }
11
+ export declare class EdgePulse extends Animation {
12
+ /** The activation level set on the most recent interpolate call, 0 to 1. */
13
+ activation: number;
14
+ private readonly _activationColor;
15
+ private readonly _peakOpacity;
16
+ private readonly _restore;
17
+ private _baseOpacity;
18
+ private _baseColor;
19
+ constructor(line: VMobject, options?: EdgePulseOptions);
20
+ begin(): void;
21
+ interpolate(alpha: number): void;
22
+ finish(): void;
23
+ }
24
+ /**
25
+ * Create an EdgePulse animation for one connection line.
26
+ * @param line - The connection line to animate.
27
+ * @param options - Activation color, peak opacity, restore and timing options.
28
+ */
29
+ export declare function edgePulse(line: VMobject, options?: EdgePulseOptions): EdgePulse;
30
+ //# sourceMappingURL=EdgePulse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EdgePulse.d.ts","sourceRoot":"","sources":["../../../src/mobjects/ml/EdgePulse.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAIxE,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,8DAA8D;IAC9D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qFAAqF;IACrF,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,qBAAa,SAAU,SAAQ,SAAS;IACtC,4EAA4E;IAC5E,UAAU,EAAE,MAAM,CAAK;IAEvB,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IACnC,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,UAAU,CAAc;gBAEpB,IAAI,EAAE,QAAQ,EAAE,OAAO,GAAE,gBAAqB;IAWjD,KAAK,IAAI,IAAI;IAOtB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAYvB,MAAM,IAAI,IAAI;CAWxB;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAE/E"}
@@ -0,0 +1,31 @@
1
+ import { NeuralNetworkLayer } from './NeuralNetworkLayer';
2
+ import { NodeStyleOptions } from './mlStyles';
3
+ export interface FeedForwardLayerOptions {
4
+ /** Number of nodes (circles) in the column. Default: 3. Must be >= 0. */
5
+ numNodes?: number;
6
+ /** Radius of each node circle. Default: 0.25. */
7
+ nodeRadius?: number;
8
+ /** Vertical gap between the centers of adjacent nodes. Default: 0.7. */
9
+ nodeSpacing?: number;
10
+ /** Node style overrides. */
11
+ nodeStyle?: NodeStyleOptions;
12
+ }
13
+ export declare class FeedForwardLayer extends NeuralNetworkLayer {
14
+ private readonly _nodeRadius;
15
+ private readonly _nodeSpacing;
16
+ private readonly _nodeStyle;
17
+ constructor(options?: FeedForwardLayerOptions);
18
+ /**
19
+ * Build `count` circles in a vertical column centered on the local origin.
20
+ * @param count - Number of circles to create (0 leaves the layer empty).
21
+ */
22
+ private _buildNodes;
23
+ /** Get the radius of each node circle. */
24
+ getNodeRadius(): number;
25
+ /**
26
+ * Horizontal extent of the column (one circle wide), used for spacing.
27
+ * Stays positive even with zero nodes so the network can place an empty layer.
28
+ */
29
+ layerWidth(): number;
30
+ }
31
+ //# sourceMappingURL=FeedForwardLayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FeedForwardLayer.d.ts","sourceRoot":"","sources":["../../../src/mobjects/ml/FeedForwardLayer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACL,gBAAgB,EAIjB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,uBAAuB;IACtC,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wEAAwE;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC9B;AAED,qBAAa,gBAAiB,SAAQ,kBAAkB;IACtD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoB;gBAEnC,OAAO,GAAE,uBAA4B;IAYjD;;;OAGG;IACH,OAAO,CAAC,WAAW;IAoBnB,0CAA0C;IAC1C,aAAa,IAAI,MAAM;IAIvB;;;OAGG;IACM,UAAU,IAAI,MAAM;CAG9B"}
@@ -0,0 +1,29 @@
1
+ import { NeuralNetworkLayer } from './NeuralNetworkLayer';
2
+ import { NodeStyleOptions } from './mlStyles';
3
+ export interface ImageLayerOptions {
4
+ /** Number of pixel rows. Default: 3. Must be >= 0. */
5
+ rows?: number;
6
+ /** Number of pixel columns. Default: 3. Must be >= 0. */
7
+ cols?: number;
8
+ /** Side length of each pixel cell. Default: 0.25. */
9
+ cellSize?: number;
10
+ /** Cell style overrides. */
11
+ nodeStyle?: NodeStyleOptions;
12
+ }
13
+ export declare class ImageLayer extends NeuralNetworkLayer {
14
+ private readonly _cols;
15
+ private readonly _cellSize;
16
+ private readonly _grid;
17
+ constructor(options?: ImageLayerOptions);
18
+ /**
19
+ * Build the pixel grid centered on the local origin.
20
+ * @param rows - Number of rows.
21
+ * @param cols - Number of columns.
22
+ * @param style - Resolved cell style.
23
+ * @returns A VGroup of cell rectangles (empty when rows or cols is 0).
24
+ */
25
+ private _buildGrid;
26
+ /** Horizontal extent of the grid, always positive for spacing. */
27
+ layerWidth(): number;
28
+ }
29
+ //# sourceMappingURL=ImageLayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageLayer.d.ts","sourceRoot":"","sources":["../../../src/mobjects/ml/ImageLayer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACL,gBAAgB,EAIjB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,iBAAiB;IAChC,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC9B;AAED,qBAAa,UAAW,SAAQ,kBAAkB;IAChD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;gBAEnB,OAAO,GAAE,iBAAsB;IAiB3C;;;;;;OAMG;IACH,OAAO,CAAC,UAAU;IAwBlB,kEAAkE;IACzD,UAAU,IAAI,MAAM;CAG9B"}
@@ -0,0 +1,69 @@
1
+ import { VGroup } from '../../core/VGroup';
2
+ import { Line } from '../geometry/Line';
3
+ import { NeuralNetworkLayer } from './NeuralNetworkLayer';
4
+ import { ConnectionStyleOptions } from './mlStyles';
5
+ /**
6
+ * NeuralNetwork - a diagram of stacked layers with connection lines between
7
+ * adjacent layers (a manim-ml NeuralNetwork analogue).
8
+ *
9
+ * The network is a VGroup built from a list of layers. It places the layers
10
+ * left to right and, for every adjacent pair, draws a dense set of connection
11
+ * lines between their node anchors (n_i x n_{i+1} lines). Connections are added
12
+ * before the layers so they render behind the nodes.
13
+ */
14
+ import * as THREE from 'three';
15
+ export interface NeuralNetworkOptions {
16
+ /** Horizontal gap between adjacent layers. Default: 1. */
17
+ layerSpacing?: number;
18
+ /** Connection line style overrides. */
19
+ edgeStyle?: ConnectionStyleOptions;
20
+ /** When false, no connection lines are drawn. Default: true. */
21
+ connectAdjacent?: boolean;
22
+ }
23
+ export declare class NeuralNetwork extends VGroup {
24
+ private readonly _layers;
25
+ private readonly _connections;
26
+ /** Connection lines grouped by the gap they cross (stage i joins layer i and i+1). */
27
+ private readonly _stages;
28
+ private readonly _edgeStyle;
29
+ /**
30
+ * @param layers - The layers, drawn left to right in array order.
31
+ * @param options - Spacing, edge style and whether to connect layers.
32
+ */
33
+ constructor(layers?: NeuralNetworkLayer[], options?: NeuralNetworkOptions);
34
+ /**
35
+ * A container flattens its transform into its children (layers and lines)
36
+ * rather than baking its own geometry, matching GenericGraph.
37
+ */
38
+ normalizeTransform(worldMatrix?: THREE.Matrix4): this;
39
+ /**
40
+ * Place each layer so its center sits on a strictly increasing x, spaced by
41
+ * the layers' own widths plus `layerSpacing`. Uses shift (not moveTo) so an
42
+ * empty layer is positioned without measuring absent geometry.
43
+ * @param layerSpacing - Horizontal gap between adjacent layer edges.
44
+ */
45
+ private _placeLayers;
46
+ /**
47
+ * Build dense connection lines between every adjacent pair of layers.
48
+ * A pair contributes n_i x n_{i+1} lines; a 0-node layer contributes none.
49
+ */
50
+ private _buildConnections;
51
+ /** Get the layers in left-to-right order. */
52
+ getLayers(): NeuralNetworkLayer[];
53
+ /**
54
+ * Get a single layer by index.
55
+ * @param index - Zero-based layer index.
56
+ * @returns The layer, or undefined when the index is out of range.
57
+ */
58
+ getLayer(index: number): NeuralNetworkLayer | undefined;
59
+ /** Get the number of layers. */
60
+ get numLayers(): number;
61
+ /** Get every connection line, flattened across all gaps. */
62
+ getConnections(): Line[];
63
+ /**
64
+ * Get the connection lines grouped by gap. Entry i holds the lines that join
65
+ * layer i and layer i+1.
66
+ */
67
+ getConnectionStages(): Line[][];
68
+ }
69
+ //# sourceMappingURL=NeuralNetwork.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NeuralNetwork.d.ts","sourceRoot":"","sources":["../../../src/mobjects/ml/NeuralNetwork.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACL,sBAAsB,EAIvB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,oBAAoB;IACnC,0DAA0D;IAC1D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,SAAS,CAAC,EAAE,sBAAsB,CAAC;IACnC,gEAAgE;IAChE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,qBAAa,aAAc,SAAQ,MAAM;IACvC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAuB;IAC/C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;IAC3C,sFAAsF;IACtF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;IACxC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoB;IAE/C;;;OAGG;gBACS,MAAM,GAAE,kBAAkB,EAAO,EAAE,OAAO,GAAE,oBAAyB;IAkBjF;;;OAGG;IACM,kBAAkB,CAAC,WAAW,GAAE,KAAK,CAAC,OAA2B,GAAG,IAAI;IAIjF;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAapB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAsBzB,6CAA6C;IAC7C,SAAS,IAAI,kBAAkB,EAAE;IAIjC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAIvD,gCAAgC;IAChC,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,4DAA4D;IAC5D,cAAc,IAAI,IAAI,EAAE;IAIxB;;;OAGG;IACH,mBAAmB,IAAI,IAAI,EAAE,EAAE;CAGhC"}
@@ -0,0 +1,54 @@
1
+ import { VGroup } from '../../core/VGroup';
2
+ import { VMobject } from '../../core/VMobject';
3
+ import { Vector3Tuple } from '../../core/Mobject';
4
+ /**
5
+ * NeuralNetworkLayer - abstract base for every layer in a NeuralNetwork.
6
+ *
7
+ * A layer is a VGroup of node mobjects (circles, feature-map squares, a pixel
8
+ * grid). The NeuralNetwork places layers left to right and draws connection
9
+ * lines between the anchor points of adjacent layers. Each concrete layer
10
+ * exposes the same small interface so the network can treat them uniformly.
11
+ */
12
+ import * as THREE from 'three';
13
+ export declare abstract class NeuralNetworkLayer extends VGroup {
14
+ /**
15
+ * The node mobjects of this layer, in top-to-bottom order.
16
+ *
17
+ * A connection attaches to a node's center, so this list defines how many
18
+ * edges the network draws to the next layer. It may be empty (a layer with
19
+ * zero nodes), which the network treats as "no connections".
20
+ */
21
+ protected _nodes: VMobject[];
22
+ /**
23
+ * A container flattens its own transform into its children instead of baking
24
+ * geometry, exactly like GenericGraph. This keeps node centers and the
25
+ * connection lines (which the network positions in world space) correct when
26
+ * a scene normalizes the family.
27
+ */
28
+ normalizeTransform(worldMatrix?: THREE.Matrix4): this;
29
+ /**
30
+ * Get the node mobjects of this layer.
31
+ * @returns The nodes in top-to-bottom order (an empty array for a 0-node layer).
32
+ */
33
+ getNodes(): VMobject[];
34
+ /**
35
+ * Get the number of nodes (connection anchors) in this layer.
36
+ */
37
+ get numNodes(): number;
38
+ /**
39
+ * Get the world-space anchor point of each node, in node order.
40
+ *
41
+ * The network calls this after it has positioned the layer, so the centers
42
+ * already include the layer's placement offset.
43
+ * @returns One center per node (an empty array for a 0-node layer).
44
+ */
45
+ nodeAnchors(): Vector3Tuple[];
46
+ /**
47
+ * Get the horizontal extent used to space this layer from its neighbours.
48
+ *
49
+ * It must return a positive number even when the layer has zero nodes, so the
50
+ * network can lay out an empty layer without measuring absent geometry.
51
+ */
52
+ abstract layerWidth(): number;
53
+ }
54
+ //# sourceMappingURL=NeuralNetworkLayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NeuralNetworkLayer.d.ts","sourceRoot":"","sources":["../../../src/mobjects/ml/NeuralNetworkLayer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,8BAAsB,kBAAmB,SAAQ,MAAM;IACrD;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAM;IAElC;;;;;OAKG;IACM,kBAAkB,CAAC,WAAW,GAAE,KAAK,CAAC,OAA2B,GAAG,IAAI;IAIjF;;;OAGG;IACH,QAAQ,IAAI,QAAQ,EAAE;IAItB;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED;;;;;;OAMG;IACH,WAAW,IAAI,YAAY,EAAE;IAI7B;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,IAAI,MAAM;CAC9B"}
@@ -0,0 +1,19 @@
1
+ import { NeuralNetworkLayer } from './NeuralNetworkLayer';
2
+ import { NodeStyleOptions } from './mlStyles';
3
+ export interface PoolingLayerOptions {
4
+ /** Number of feature-map squares in the stack. Default: 3. Must be >= 0. */
5
+ numFeatureMaps?: number;
6
+ /** Side length of each square feature map. Default: 0.3. */
7
+ mapSize?: number;
8
+ /** Diagonal offset between adjacent squares. Default: 0.12. */
9
+ offset?: number;
10
+ /** Node style overrides for the squares. */
11
+ nodeStyle?: NodeStyleOptions;
12
+ }
13
+ export declare class PoolingLayer extends NeuralNetworkLayer {
14
+ private readonly _width;
15
+ constructor(options?: PoolingLayerOptions);
16
+ /** Horizontal extent of the feature-map stack, used for spacing. */
17
+ layerWidth(): number;
18
+ }
19
+ //# sourceMappingURL=PoolingLayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PoolingLayer.d.ts","sourceRoot":"","sources":["../../../src/mobjects/ml/PoolingLayer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EACL,gBAAgB,EAIjB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,mBAAmB;IAClC,4EAA4E;IAC5E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC9B;AAED,qBAAa,YAAa,SAAQ,kBAAkB;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,OAAO,GAAE,mBAAwB;IAgB7C,oEAAoE;IAC3D,UAAU,IAAI,MAAM;CAG9B"}
@@ -0,0 +1,25 @@
1
+ import { VMobject } from '../../core/VMobject';
2
+ import { ResolvedNodeStyle } from './mlStyles';
3
+ export interface FeatureMapStackConfig {
4
+ /** Number of stacked feature-map squares. Must be >= 0. */
5
+ numFeatureMaps: number;
6
+ /** Side length of each square feature map. */
7
+ mapSize: number;
8
+ /** Diagonal offset between adjacent squares in the stack. */
9
+ offset: number;
10
+ /** Resolved node style for the squares. */
11
+ style: ResolvedNodeStyle;
12
+ }
13
+ export interface FeatureMapStackResult {
14
+ /** The feature-map squares, front (first) to back (last). */
15
+ nodes: VMobject[];
16
+ /** Horizontal extent of the stack, always positive. */
17
+ width: number;
18
+ }
19
+ /**
20
+ * Build a diagonal stack of square feature maps centered on the local origin.
21
+ * @param config - Count, size, offset and style of the stack.
22
+ * @returns The square nodes and the stack's horizontal extent.
23
+ */
24
+ export declare function buildFeatureMapStack(config: FeatureMapStackConfig): FeatureMapStackResult;
25
+ //# sourceMappingURL=featureMapStack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"featureMapStack.d.ts","sourceRoot":"","sources":["../../../src/mobjects/ml/featureMapStack.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,WAAW,qBAAqB;IACpC,2DAA2D;IAC3D,cAAc,EAAE,MAAM,CAAC;IACvB,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,KAAK,EAAE,iBAAiB,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,6DAA6D;IAC7D,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,qBAAqB,GAAG,qBAAqB,CAyBzF"}
@@ -0,0 +1,28 @@
1
+ import { Animation } from '../../animation/Animation';
2
+ import { NeuralNetwork } from './NeuralNetwork';
3
+ import { EdgePulseOptions } from './EdgePulse';
4
+ export interface ForwardPassOptions extends EdgePulseOptions {
5
+ /**
6
+ * Overlap between consecutive gaps. 1 is strictly sequential (one gap fully
7
+ * lit before the next starts), 0 is all gaps at once. Default: 1.
8
+ */
9
+ lagRatio?: number;
10
+ /** Duration of each gap's pulse in seconds. Default: 1. */
11
+ gapDuration?: number;
12
+ }
13
+ /**
14
+ * Animate a forward pass: light each gap's connections from input to output.
15
+ * @param network - The network to animate.
16
+ * @param options - Pulse color/opacity, lagRatio and per-gap duration.
17
+ * @returns A LaggedStart over the gaps (an empty, zero-duration one for a
18
+ * network with fewer than two layers).
19
+ */
20
+ export declare function forwardPass(network: NeuralNetwork, options?: ForwardPassOptions): Animation;
21
+ /**
22
+ * Animate a backward pass: light each gap's connections from output to input.
23
+ * @param network - The network to animate.
24
+ * @param options - Pulse color/opacity, lagRatio and per-gap duration.
25
+ * @returns A LaggedStart over the gaps in reverse order.
26
+ */
27
+ export declare function backwardPass(network: NeuralNetwork, options?: ForwardPassOptions): Animation;
28
+ //# sourceMappingURL=forwardPass.d.ts.map