manim-web 0.3.24 → 0.11.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 (145) hide show
  1. package/README.md +5 -1
  2. package/dist/GLTFLoader-CisHz7tR.js +1381 -0
  3. package/dist/GLTFLoader-DMbWuMln.js +1381 -0
  4. package/dist/{MathJaxBundle-xSidSV0E.js → MathJaxBundle-BSrlS0Dh.js} +3338 -3320
  5. package/dist/OBJLoader-Clh2POv9.js +287 -0
  6. package/dist/OBJLoader-kkTsEhJf.js +287 -0
  7. package/dist/animation/Always.d.ts +72 -0
  8. package/dist/animation/Always.d.ts.map +1 -0
  9. package/dist/animation/AlwaysRedraw.d.ts +15 -0
  10. package/dist/animation/AlwaysRedraw.d.ts.map +1 -0
  11. package/dist/animation/Animation.d.ts +9 -0
  12. package/dist/animation/Animation.d.ts.map +1 -1
  13. package/dist/animation/AnimationUtilities.d.ts +25 -0
  14. package/dist/animation/AnimationUtilities.d.ts.map +1 -1
  15. package/dist/animation/creation/Create.d.ts +40 -11
  16. package/dist/animation/creation/Create.d.ts.map +1 -1
  17. package/dist/animation/transform/PointMorphStrategy.d.ts +6 -0
  18. package/dist/animation/transform/PointMorphStrategy.d.ts.map +1 -1
  19. package/dist/animation/transform/Transform.d.ts.map +1 -1
  20. package/dist/animation/transform/TransformPairing.d.ts +17 -0
  21. package/dist/animation/transform/TransformPairing.d.ts.map +1 -1
  22. package/dist/animation/updaters.d.ts +69 -0
  23. package/dist/animation/updaters.d.ts.map +1 -0
  24. package/dist/compiler-CfW6eH2M.js +2 -0
  25. package/dist/constants/index.d.ts +1 -0
  26. package/dist/constants/index.d.ts.map +1 -1
  27. package/dist/constants/parity.d.ts +78 -0
  28. package/dist/constants/parity.d.ts.map +1 -0
  29. package/dist/core/Mobject.d.ts +48 -3
  30. package/dist/core/Mobject.d.ts.map +1 -1
  31. package/dist/core/MobjectTraversal.d.ts +7 -0
  32. package/dist/core/MobjectTraversal.d.ts.map +1 -1
  33. package/dist/core/MobjectTypes.d.ts +15 -0
  34. package/dist/core/MobjectTypes.d.ts.map +1 -1
  35. package/dist/core/Scene.d.ts +14 -0
  36. package/dist/core/Scene.d.ts.map +1 -1
  37. package/dist/core/SpecialThreeDScene.d.ts +64 -0
  38. package/dist/core/SpecialThreeDScene.d.ts.map +1 -0
  39. package/dist/core/VMobject.d.ts +143 -0
  40. package/dist/core/VMobject.d.ts.map +1 -1
  41. package/dist/core/VMobjectColorGradient.d.ts +20 -0
  42. package/dist/core/VMobjectColorGradient.d.ts.map +1 -0
  43. package/dist/core/VMobjectCurveMath.d.ts +128 -0
  44. package/dist/core/VMobjectCurveMath.d.ts.map +1 -0
  45. package/dist/core/VMobjectRendering.d.ts +38 -1
  46. package/dist/core/VMobjectRendering.d.ts.map +1 -1
  47. package/dist/core/VMobjectRoundCorners.d.ts +37 -0
  48. package/dist/core/VMobjectRoundCorners.d.ts.map +1 -0
  49. package/dist/esm-CiMKSfxz.js +1273 -0
  50. package/dist/export/FrameExporter.d.ts +86 -0
  51. package/dist/export/FrameExporter.d.ts.map +1 -0
  52. package/dist/export/GifExporter.d.ts +4 -0
  53. package/dist/export/GifExporter.d.ts.map +1 -1
  54. package/dist/export/WebCodecsExporter.d.ts +108 -0
  55. package/dist/export/WebCodecsExporter.d.ts.map +1 -0
  56. package/dist/export/index.d.ts +2 -0
  57. package/dist/export/index.d.ts.map +1 -1
  58. package/dist/global-compiler-D_nF-JaV.js +8 -0
  59. package/dist/global-renderer-gyshX_QF.js +8 -0
  60. package/dist/index.d.ts +29 -4
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +3 -2
  63. package/dist/integrations/react.js +17 -16
  64. package/dist/integrations/vue.js +16 -15
  65. package/dist/integrations/webcomponent.d.ts +65 -0
  66. package/dist/integrations/webcomponent.d.ts.map +1 -0
  67. package/dist/integrations/webcomponent.js +2 -0
  68. package/dist/manim-web.browser.js +36877 -45066
  69. package/dist/mobjects/geometry/AngleShapes.d.ts.map +1 -1
  70. package/dist/mobjects/geometry/ArcPolygon.d.ts +30 -0
  71. package/dist/mobjects/geometry/ArcPolygon.d.ts.map +1 -1
  72. package/dist/mobjects/geometry/DashedLine.d.ts.map +1 -1
  73. package/dist/mobjects/geometry/Label.d.ts +32 -0
  74. package/dist/mobjects/geometry/Label.d.ts.map +1 -0
  75. package/dist/mobjects/geometry/index.d.ts +2 -1
  76. package/dist/mobjects/geometry/index.d.ts.map +1 -1
  77. package/dist/mobjects/graphing/Axes.d.ts +73 -6
  78. package/dist/mobjects/graphing/Axes.d.ts.map +1 -1
  79. package/dist/mobjects/graphing/CoordinateSystem.d.ts +40 -0
  80. package/dist/mobjects/graphing/CoordinateSystem.d.ts.map +1 -0
  81. package/dist/mobjects/graphing/axes-calculus.d.ts +79 -0
  82. package/dist/mobjects/graphing/axes-calculus.d.ts.map +1 -0
  83. package/dist/mobjects/graphing/index.d.ts +3 -0
  84. package/dist/mobjects/graphing/index.d.ts.map +1 -1
  85. package/dist/mobjects/graphing/scale.d.ts +72 -0
  86. package/dist/mobjects/graphing/scale.d.ts.map +1 -0
  87. package/dist/mobjects/text/MathJaxRenderer.d.ts +5 -0
  88. package/dist/mobjects/text/MathJaxRenderer.d.ts.map +1 -1
  89. package/dist/mobjects/text/MathTex.d.ts +23 -0
  90. package/dist/mobjects/text/MathTex.d.ts.map +1 -1
  91. package/dist/mobjects/text/MathTexImage.d.ts.map +1 -1
  92. package/dist/mobjects/text/Text.d.ts +53 -0
  93. package/dist/mobjects/text/Text.d.ts.map +1 -1
  94. package/dist/mobjects/text/Typst.d.ts +113 -0
  95. package/dist/mobjects/text/Typst.d.ts.map +1 -0
  96. package/dist/mobjects/text/TypstRenderer.d.ts +57 -0
  97. package/dist/mobjects/text/TypstRenderer.d.ts.map +1 -0
  98. package/dist/mobjects/text/index.d.ts +5 -2
  99. package/dist/mobjects/text/index.d.ts.map +1 -1
  100. package/dist/mobjects/text/katexStyles.d.ts +5 -0
  101. package/dist/mobjects/text/katexStyles.d.ts.map +1 -1
  102. package/dist/mobjects/text/registerFont.d.ts +38 -0
  103. package/dist/mobjects/text/registerFont.d.ts.map +1 -0
  104. package/dist/mobjects/text/textStyleRuns.d.ts +111 -0
  105. package/dist/mobjects/text/textStyleRuns.d.ts.map +1 -0
  106. package/dist/mobjects/three-d/ModelMobject.d.ts +122 -0
  107. package/dist/mobjects/three-d/ModelMobject.d.ts.map +1 -0
  108. package/dist/mobjects/three-d/ThreeDAxes.d.ts +37 -4
  109. package/dist/mobjects/three-d/ThreeDAxes.d.ts.map +1 -1
  110. package/dist/mobjects/three-d/threeDVmobUtils.d.ts +25 -0
  111. package/dist/mobjects/three-d/threeDVmobUtils.d.ts.map +1 -0
  112. package/dist/mobjects/video/VideoMobject.d.ts +126 -0
  113. package/dist/mobjects/video/VideoMobject.d.ts.map +1 -0
  114. package/dist/mobjects/video/index.d.ts +2 -0
  115. package/dist/mobjects/video/index.d.ts.map +1 -0
  116. package/dist/mp4-muxer-5DGKGEJk.js +900 -0
  117. package/dist/player/Player.d.ts +4 -0
  118. package/dist/player/Player.d.ts.map +1 -1
  119. package/dist/renderer-DR_79fB0.js +2 -0
  120. package/dist/{src-Cc3xTIkV.js → src-C817VR8M.js} +10693 -7971
  121. package/dist/three.core-1aHSpGwp.js +11626 -0
  122. package/dist/utils/ManimColor.d.ts +163 -0
  123. package/dist/utils/ManimColor.d.ts.map +1 -0
  124. package/dist/utils/bezier.d.ts +95 -0
  125. package/dist/utils/bezier.d.ts.map +1 -0
  126. package/dist/utils/color.d.ts +99 -0
  127. package/dist/utils/color.d.ts.map +1 -0
  128. package/dist/utils/debug.d.ts +36 -0
  129. package/dist/utils/debug.d.ts.map +1 -0
  130. package/dist/utils/iterables.d.ts +162 -0
  131. package/dist/utils/iterables.d.ts.map +1 -0
  132. package/dist/utils/paths.d.ts +38 -0
  133. package/dist/utils/paths.d.ts.map +1 -0
  134. package/dist/utils/simpleFunctions.d.ts +26 -0
  135. package/dist/utils/simpleFunctions.d.ts.map +1 -0
  136. package/dist/utils/spaceOps.d.ts +119 -0
  137. package/dist/utils/spaceOps.d.ts.map +1 -0
  138. package/dist/utils/unit.d.ts +28 -0
  139. package/dist/utils/unit.d.ts.map +1 -0
  140. package/dist/wasm-CIlzm7By.js +76 -0
  141. package/dist/wasm-pack-shim-B3C4KoWa.js +1688 -0
  142. package/dist/wasm-pack-shim-BgTFpSvJ.js +911 -0
  143. package/dist/webcomponent-BS5WnkDO.js +707 -0
  144. package/dist/webm-muxer-BGY-Mgbp.js +857 -0
  145. package/package.json +19 -8
@@ -0,0 +1,163 @@
1
+ /**
2
+ * Class layer ported from ManimCE's `manim/utils/color/core.py` (ManimCE 0.22.0).
3
+ *
4
+ * The free color functions (hex/rgb/hsv conversion, interpolation, gradients)
5
+ * live in `./color` and use the 0.0..1.0 float convention. This module adds the
6
+ * `ManimColor` object on top of them.
7
+ *
8
+ * manim-web otherwise stores a color as a `#rrggbb` hex string end to end, so a
9
+ * `ManimColor` stays interoperable by exposing {@link ManimColor.toHex}: the
10
+ * returned string works everywhere the repo expects a color.
11
+ *
12
+ * Deliberate divergences from ManimCE (documented for parity readers):
13
+ * - TypeScript cannot tell an integer tuple from a float tuple at run time, so a
14
+ * numeric array is always read as a float RGB(A) array in 0.0..1.0. ManimCE's
15
+ * int-vs-float auto-detection is not reproduced.
16
+ * - {@link RandomColorGenerator} is deterministic for a given seed, but it does
17
+ * not reproduce CPython's Mersenne Twister sequence; it uses a `mulberry32`
18
+ * PRNG instead.
19
+ */
20
+ /** A color channel. Name-parity with ManimCE's numpy `float64` dtype. */
21
+ export type ManimColorDType = number;
22
+ type Rgb = [number, number, number];
23
+ type Rgba = [number, number, number, number];
24
+ type Hsv = [number, number, number];
25
+ /** Every type that {@link ManimColor.parse} and the constructor accept. */
26
+ export type ParsableManimColor = ManimColor | number | string | [number, number, number] | [number, number, number, number];
27
+ /**
28
+ * Internal color data structure, ported from ManimCE's `ManimColor`.
29
+ *
30
+ * The internal representation is an `[r,g,b,a]` array of floats in 0.0..1.0.
31
+ */
32
+ export declare class ManimColor {
33
+ protected readonly value: Rgba;
34
+ /**
35
+ * @param value Any {@link ParsableManimColor}, or `null` for black.
36
+ * @param alpha Opacity in 0.0..1.0. Default `1.0`. Ignored for an 8-digit hex
37
+ * string and for a 4-element (RGBA) array, which carry their own alpha.
38
+ */
39
+ constructor(value: ParsableManimColor | null, alpha?: number);
40
+ /** The `[r,g,b,a]` internal value. Overridden by subclasses. */
41
+ protected internalRgba(): Rgba;
42
+ /** The space used for operators and interpolation (`[r,g,b,a]` for the base). */
43
+ protected getSpace(): number[];
44
+ /** Build a color of this class from a space array. Overridden by subclasses. */
45
+ protected constructFromSpace(space: number[]): ManimColor;
46
+ /** Build a color of this class from an `[r,g,b,a]` value (ManimCE `_from_internal`). */
47
+ protected fromInternal(rgba: Rgba): ManimColor;
48
+ /** Convert to an `[r,g,b]` float array (0.0..1.0). */
49
+ toRgb(): Rgb;
50
+ /** Convert to an `[r,g,b,a]` float array (0.0..1.0). */
51
+ toRgba(): Rgba;
52
+ /** Convert to an `[r,g,b]` integer array (0..255, truncated). */
53
+ toIntRgb(): Rgb;
54
+ /** Convert to an `[r,g,b,a]` integer array (0..255, truncated). */
55
+ toIntRgba(): Rgba;
56
+ /**
57
+ * Convert to a `#RRGGBB` hex string, or `#RRGGBBAA` when `withAlpha` is true.
58
+ */
59
+ toHex(withAlpha?: boolean): string;
60
+ /** Convert to an `[h,s,v]` float array (0.0..1.0). */
61
+ toHsv(): Hsv;
62
+ /**
63
+ * Interpolate toward `other` in this color's space.
64
+ *
65
+ * `alpha` 0.0 returns a copy of this color, 1.0 returns `other`.
66
+ */
67
+ interpolate(other: ManimColor, alpha: number): ManimColor;
68
+ /**
69
+ * Return a linearly inverted color (`1 - channel`).
70
+ *
71
+ * @param withAlpha If true, the alpha is inverted too. Default `false`.
72
+ */
73
+ invert(withAlpha?: boolean): ManimColor;
74
+ /** Return a new color with the given opacity and the same color values. */
75
+ opacity(opacity: number): ManimColor;
76
+ /** Alias of {@link opacity}. */
77
+ withAlpha(alpha: number): ManimColor;
78
+ /**
79
+ * Return a darker color: interpolated toward black. The opacity is unchanged.
80
+ *
81
+ * @param blend 0.0 (unchanged) to 1.0 (pure black). Default `0.2`.
82
+ */
83
+ darker(blend?: number): ManimColor;
84
+ /**
85
+ * Return a lighter color: interpolated toward white. The opacity is unchanged.
86
+ *
87
+ * @param blend 0.0 (unchanged) to 1.0 (pure white). Default `0.2`.
88
+ */
89
+ lighter(blend?: number): ManimColor;
90
+ /** Compare two colors with a numpy-style `allclose` tolerance. */
91
+ equals(other: ManimColor): boolean;
92
+ /** Return the `#RRGGBB` hex string, so a color interpolates into templates. */
93
+ toString(): string;
94
+ /** Create a color from an RGB(A) float array. Ports `ManimColor.from_rgb`. */
95
+ static fromRgb(rgb: Rgb | Rgba, alpha?: number): ManimColor;
96
+ /** Create a color from an RGBA float array. Ports `ManimColor.from_rgba`. */
97
+ static fromRgba(rgba: Rgba): ManimColor;
98
+ /** Create a color from a hex string. Ports `ManimColor.from_hex`. */
99
+ static fromHex(hex: string, alpha?: number): ManimColor;
100
+ /** Create a color from an `[h,s,v]` float array. Ports `ManimColor.from_hsv`. */
101
+ static fromHsv(hsv: Hsv, alpha?: number): ManimColor;
102
+ /**
103
+ * Parse one color, or a list of colors.
104
+ *
105
+ * A numeric array (length 3 or 4) is read as a single RGB(A) color. An array
106
+ * whose elements are themselves colors (strings, numbers-as-ints via nested
107
+ * arrays, or `ManimColor`s) is read as a list. This resolves ManimCE's
108
+ * documented "array of numbers becomes a list of colors" footgun in favor of
109
+ * the single-color reading.
110
+ */
111
+ static parse(color: ParsableManimColor | ParsableManimColor[] | null, alpha?: number): ManimColor | ManimColor[];
112
+ }
113
+ /** RGBA color space. In ManimCE this is an alias of {@link ManimColor}. */
114
+ export declare const RGBA: typeof ManimColor;
115
+ /** RGBA color space type. In ManimCE this is an alias of {@link ManimColor}. */
116
+ export type RGBA = ManimColor;
117
+ /**
118
+ * HSV color space, a {@link ManimColor} subclass.
119
+ *
120
+ * It is constructed from `[h,s,v]` (or `[h,s,v,a]`) floats in 0.0..1.0 and keeps
121
+ * that representation internally, so operators and {@link ManimColor.interpolate}
122
+ * act in HSV space.
123
+ */
124
+ export declare class HSV extends ManimColor {
125
+ private readonly hsva;
126
+ constructor(hsv: Hsv | [number, number, number, number], alpha?: number);
127
+ protected internalRgba(): Rgba;
128
+ protected getSpace(): number[];
129
+ protected constructFromSpace(space: number[]): ManimColor;
130
+ protected fromInternal(rgba: Rgba): ManimColor;
131
+ get h(): number;
132
+ get s(): number;
133
+ get v(): number;
134
+ }
135
+ /**
136
+ * A generator of random colors, deterministic when given a seed.
137
+ *
138
+ * Ports ManimCE's `RandomColorGenerator`. With a `seed`, the same sequence of
139
+ * colors is produced every time (see the module note on the PRNG). Without a
140
+ * seed, `Math.random` is used and the output is non-deterministic.
141
+ */
142
+ export declare class RandomColorGenerator {
143
+ private readonly rng;
144
+ private readonly colors;
145
+ constructor(seed?: number, sampleColors?: readonly ParsableManimColor[]);
146
+ /** Return the next random color from the configured palette. */
147
+ next(): ManimColor;
148
+ }
149
+ /**
150
+ * Add light or shadow to an `rgb` color on a surface, ported from ManimCE's
151
+ * `get_shaded_rgb`.
152
+ *
153
+ * The surface sits at `point`, faces `unitNormal`, and may be lit by
154
+ * `lightSource`. The result is not clamped, matching ManimCE.
155
+ *
156
+ * @param rgb The surface base color (0.0..1.0 floats).
157
+ * @param point The location of the surface.
158
+ * @param unitNormal The unit normal the surface faces.
159
+ * @param lightSource The location of the light source.
160
+ */
161
+ export declare function getShadedRgb(rgb: Rgb, point: readonly number[], unitNormal: readonly number[], lightSource: readonly number[]): Rgb;
162
+ export {};
163
+ //# sourceMappingURL=ManimColor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ManimColor.d.ts","sourceRoot":"","sources":["../../src/utils/ManimColor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH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,EAAE,MAAM,CAAC,EAAE,KAAK,SAAM;cAWjD,YAAY,IAAI,IAAI;cAKpB,QAAQ,IAAI,MAAM,EAAE;cAIpB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU;cAI/C,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,UAAU;IAKvD,IAAI,CAAC,IAAI,MAAM,CAEd;IAED,IAAI,CAAC,IAAI,MAAM,CAEd;IAED,IAAI,CAAC,IAAI,MAAM,CAEd;CACF;AAkBD;;;;;;GAMG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;gBAE1B,IAAI,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,SAAS,kBAAkB,EAAE;IAQvE,gEAAgE;IAChE,IAAI,IAAI,UAAU;CAInB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,WAAW,EAAE,SAAS,MAAM,EAAE,GAC7B,GAAG,CAWL"}
@@ -0,0 +1,95 @@
1
+ import { integerInterpolate, partialBezierPoints, smoothHandlePoints } from '../core/VMobjectCurveMath';
2
+ /**
3
+ * Control points of the portion of a Bézier curve between parameters `a` and `b`.
4
+ * Canonical implementation lives in `VMobjectCurveMath` (Manim CE `partial_bezier_points`).
5
+ */
6
+ export { partialBezierPoints };
7
+ /**
8
+ * Integer-and-residue split of `alpha` over the range `[start, end)`.
9
+ * Canonical implementation lives in `VMobjectCurveMath` (Manim CE `integer_interpolate`).
10
+ */
11
+ export { integerInterpolate };
12
+ /**
13
+ * Smooth cubic-Bézier handles for a sequence of anchors (Manim CE
14
+ * `get_smooth_cubic_bezier_handle_points`).
15
+ *
16
+ * manim-web smooths every spline as an open spline (the `get_smooth_open_cubic_bezier_handle_points`
17
+ * case in Manim CE), so closed loops are not periodic-smooth at the seam. The
18
+ * return value is `{ h1, h2 }`, not the `(H1, H2)` tuple Manim CE returns.
19
+ */
20
+ export { smoothHandlePoints as getSmoothCubicBezierHandlePoints };
21
+ /** Linearly interpolate between two scalars. Returns `(1 - alpha) * start + alpha * end`. */
22
+ export declare function interpolate(start: number, end: number, alpha: number): number;
23
+ /** Linearly interpolate between two points, component-wise. */
24
+ export declare function interpolate(start: number[], end: number[], alpha: number): number[];
25
+ /** Midpoint of two scalars. */
26
+ export declare function mid(start: number, end: number): number;
27
+ /** Midpoint of two points, component-wise. */
28
+ export declare function mid(start: number[], end: number[]): number[];
29
+ /** Inverse interpolation: the `alpha` such that `interpolate(start, end, alpha) === value`. */
30
+ declare function inverseInterpolate(start: number, end: number, value: number): number;
31
+ /** Inverse interpolation between two points, component-wise. */
32
+ declare function inverseInterpolate(start: number[], end: number[], value: number[]): number[];
33
+ /**
34
+ * Map a value from an old range onto a new range, preserving its relative
35
+ * position: `interpolate(newStart, newEnd, inverse_interpolate(oldStart, oldEnd, oldValue))`.
36
+ */
37
+ declare function matchInterpolate(newStart: number, newEnd: number, oldStart: number, oldEnd: number, oldValue: number): number;
38
+ /** {@link matchInterpolate} with a point `oldValue`, mapped component-wise. */
39
+ declare function matchInterpolate(newStart: number, newEnd: number, oldStart: number, oldEnd: number, oldValue: number[]): number[];
40
+ /** Build the evaluator of a Bézier curve defined by scalar control values. */
41
+ export declare function bezier(points: number[]): (t: number) => number;
42
+ /** Build the evaluator of a Bézier curve defined by point control values. */
43
+ export declare function bezier(points: number[][]): (t: number) => number[];
44
+ /**
45
+ * Split a Bézier curve at parameter `t` into two curves of the same degree.
46
+ *
47
+ * @returns `2 * N` control points: the first `N` are the curve over `[0, t]`,
48
+ * the last `N` are the curve over `[t, 1]`.
49
+ */
50
+ declare function splitBezier(points: number[][], t: number): number[][];
51
+ /**
52
+ * Subdivide a Bézier curve into `n_divisions` subcurves of the same degree and
53
+ * equal parameter spans, split at `t = i / n_divisions`.
54
+ *
55
+ * Each subcurve is the portion over `[i / n, (i + 1) / n]`, which is what Manim
56
+ * CE's memoized subdivision matrices compute for curves of degree up to 3 (the
57
+ * only degrees manim-web produces). Manim CE's higher-degree fallback uses a
58
+ * different successive-split schedule; this equal-interval form is the correct
59
+ * subdivision for every degree.
60
+ *
61
+ * @returns `n_divisions * N` control points, the subcurves concatenated in order.
62
+ */
63
+ declare function subdivideBezier(points: number[][], nDivisions: number): number[][];
64
+ /**
65
+ * Subdivide each curve in `bezierTuples` until the total reaches
66
+ * `newNumberOfCurves`, matching Manim CE's `bezier_remap`.
67
+ *
68
+ * @param bezierTuples - Curves as `(currentNumberOfCurves, nppc, dim)`.
69
+ * @param newNumberOfCurves - Target number of curves (>= current).
70
+ */
71
+ declare function bezierRemap(bezierTuples: number[][][], newNumberOfCurves: number): number[][][];
72
+ /**
73
+ * Whether the spline is closed: its first and last points are close enough to
74
+ * be the same, using Manim CE's `rtol = 1e-5`, `atol = 1e-8` over 3 coordinates.
75
+ */
76
+ declare function isClosed(points: number[][]): boolean;
77
+ /**
78
+ * Parameters `t` in `[0, 1]` at which the Bézier curve defined by
79
+ * `controlPoints` passes through `point`. Usually one or zero values; a point
80
+ * at the seam of a closed loop can yield more. Port of Manim CE's
81
+ * `proportions_along_bezier_curve_for_point`.
82
+ *
83
+ * @throws Error when `point` and the control points have different shapes.
84
+ */
85
+ declare function proportionsAlongBezierCurveForPoint(point: number[], controlPoints: number[][], roundTo?: number): number[];
86
+ /**
87
+ * Whether `point` lies on the Bézier curve defined by `controlPoints`
88
+ * (Manim CE `point_lies_on_bezier`). The point lies on the curve when the
89
+ * Bézier polynomial has at least one real root in `[0, 1]`.
90
+ *
91
+ * @throws Error when `point` and the control points have different shapes.
92
+ */
93
+ declare function pointLiesOnBezier(point: number[], controlPoints: number[][], roundTo?: number): boolean;
94
+ export { inverseInterpolate, matchInterpolate, splitBezier, subdivideBezier, bezierRemap, isClosed, proportionsAlongBezier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;GAMG;AACH,iBAAS,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,SAAO,GAAG,OAAO,CAE9F;AAMD,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,WAAW,EACX,QAAQ,EACR,mCAAmC,EACnC,iBAAiB,GAClB,CAAC"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Color conversion utilities ported from ManimCE's `manim/utils/color/core.py`
3
+ * (ManimCE 0.22.0).
4
+ *
5
+ * manim-web represents a color as a `#rrggbb` (or `#rrggbbaa`) hex string, so
6
+ * these helpers adapt ManimCE's `ManimColor`-based functional helpers to that
7
+ * model: inputs that ManimCE types as a color are hex strings here, and
8
+ * functions that ManimCE returns a `ManimColor` from return a hex string.
9
+ *
10
+ * Numeric conventions match ManimCE exactly:
11
+ * - RGB float arrays use the 0.0..1.0 range (`hexToRgb('#FFFFFF')` -> [1, 1, 1]).
12
+ * - Integer RGB arrays use the 0..255 range, truncated toward zero
13
+ * (`Math.trunc(x * 255)`, matching NumPy's `.astype(int)` / Python `int()`).
14
+ * - Hex output truncates channels and uppercases (matching `ManimColor.to_hex`).
15
+ * - HSV conversion mirrors Python's `colorsys` (h, s, v all in 0.0..1.0).
16
+ *
17
+ * The `ManimColor`, `HSV` and `RGBA` classes (the object layer on top of these
18
+ * functions) live in `./ManimColor`.
19
+ */
20
+ type Rgb = [number, number, number];
21
+ type Rgba = [number, number, number, number];
22
+ type Hsv = [number, number, number];
23
+ export { colorGradient } from '../core/VMobjectColorGradient';
24
+ /**
25
+ * Convert an `[r, g, b]` float array (0.0..1.0) to a `#RRGGBB` hex string.
26
+ *
27
+ * Ports `ManimColor.from_rgb(...).to_hex()`. Channels are truncated, not
28
+ * rounded, to match ManimCE.
29
+ */
30
+ export declare function rgbToHex(rgb: Rgb): string;
31
+ /** Convert a color (hex string) to an `[r, g, b]` float array (0.0..1.0). */
32
+ export declare function hexToRgb(hexCode: string): Rgb;
33
+ /** Alias of {@link hexToRgb}; ports ManimCE's `color_to_rgb`. */
34
+ export declare function colorToRgb(color: string): Rgb;
35
+ /**
36
+ * Convert a color to an `[r, g, b, a]` float array (0.0..1.0).
37
+ *
38
+ * Ports `color_to_rgba`: the supplied `alpha` replaces any alpha carried by the
39
+ * color itself.
40
+ */
41
+ export declare function colorToRgba(color: string, alpha?: number): Rgba;
42
+ /** Convert a color to an `[r, g, b]` integer array (0..255). Ports `color_to_int_rgb`. */
43
+ export declare function colorToIntRgb(color: string): Rgb;
44
+ /**
45
+ * Convert a color to an `[r, g, b, a]` integer array (0..255).
46
+ *
47
+ * Ports `color_to_int_rgba`: the supplied `alpha` (0.0..1.0) is scaled to 0..255.
48
+ */
49
+ export declare function colorToIntRgba(color: string, alpha?: number): Rgba;
50
+ /**
51
+ * Convert an `[r, g, b]` float array (0.0..1.0) to a color (hex string).
52
+ *
53
+ * Ports `rgb_to_color`. Unlike ManimCE, the array is always interpreted as
54
+ * floats in 0.0..1.0 (manim-web's internal color model); ManimCE's int-vs-float
55
+ * auto-detection is not reproduced.
56
+ */
57
+ export declare function rgbToColor(rgb: Rgb): string;
58
+ /**
59
+ * Convert an `[r, g, b, a]` float array to a color (hex string).
60
+ *
61
+ * Ports `rgba_to_color`. The alpha is dropped, matching `ManimColor.to_hex`
62
+ * with its default `with_alpha=False`.
63
+ */
64
+ export declare function rgbaToColor(rgba: Rgba): string;
65
+ /** Return the linearly inverted color (1 - channel). Ports `invert_color`. */
66
+ export declare function invertColor(color: string): string;
67
+ /**
68
+ * Interpolate two colors in RGB space and return the result as a hex string.
69
+ *
70
+ * Ports `interpolate_color`: `alpha` of 0.0 yields `color1`, 1.0 yields `color2`.
71
+ */
72
+ export declare function interpolateColor(color1: string, color2: string, alpha: number): string;
73
+ /**
74
+ * Return the per-channel average of the given colors as a hex string.
75
+ *
76
+ * Ports `average_color`. Alpha is ignored; the result is fully opaque.
77
+ */
78
+ export declare function averageColor(...colors: string[]): string;
79
+ /** Return a random color from the Manim palette. Ports `random_color`. */
80
+ export declare function randomColor(): string;
81
+ /**
82
+ * Return a random bright color: a random palette color averaged with white.
83
+ *
84
+ * Ports `random_bright_color` (`0.5 * (rgb + 1)`).
85
+ */
86
+ export declare function randomBrightColor(): string;
87
+ /**
88
+ * Convert an `[h, s, v]` array (0.0..1.0) to an `[r, g, b]` array (0.0..1.0).
89
+ *
90
+ * Faithful port of Python's `colorsys.hsv_to_rgb`.
91
+ */
92
+ export declare function hsvToRgb(hsv: Hsv): Rgb;
93
+ /**
94
+ * Convert an `[r, g, b]` array (0.0..1.0) to an `[h, s, v]` array (0.0..1.0).
95
+ *
96
+ * Faithful port of Python's `colorsys.rgb_to_hsv`.
97
+ */
98
+ export declare function rgbToHsv(rgb: Rgb): Hsv;
99
+ //# sourceMappingURL=color.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/utils/color.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,KAAK,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACpC,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAC7C,KAAK,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAKpC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AA+C9D;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAEzC;AAED,6EAA6E;AAC7E,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAG7C;AAED,iEAAiE;AACjE,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAE7C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,SAAM,GAAG,IAAI,CAG5D;AAED,0FAA0F;AAC1F,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAGhD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,SAAM,GAAG,IAAI,CAG/D;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAE3C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAE9C;AAED,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGjD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAQtF;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAaxD;AAMD,0EAA0E;AAC1E,wBAAgB,WAAW,IAAI,MAAM,CAGpC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAG1C;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAwBtC;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAuBtC"}
@@ -0,0 +1,36 @@
1
+ import { Mobject } from '../core/Mobject';
2
+ import { VGroup } from '../core/VGroup';
3
+ /**
4
+ * Return every family member (self plus all descendants) of each mobject in
5
+ * `mobjectList`, flattened into a single list. Mirrors ManimCE
6
+ * `extract_mobject_family_members`.
7
+ *
8
+ * @param onlyThoseWithPoints - keep only members that own geometry (a
9
+ * `VMobject` with its own points), matching ManimCE `only_those_with_points`.
10
+ */
11
+ export declare function extractMobjectFamilyMembers(mobjectList: Mobject[], onlyThoseWithPoints?: boolean): Mobject[];
12
+ /**
13
+ * Remove everything in `toRemove` from `mobjectList`, but when a removed item
14
+ * is a family member of an item in `mobjectList`, add that item's other family
15
+ * members back in. Mirrors ManimCE
16
+ * `restructure_list_to_exclude_certain_family_members`.
17
+ */
18
+ export declare function restructureListToExcludeCertainFamilyMembers(mobjectList: Mobject[], toRemove: Mobject[]): Mobject[];
19
+ /** Options for {@link indexLabels}. */
20
+ export interface IndexLabelsOptions {
21
+ /** Height of each label in scene units. Default: 0.15 (matches ManimCE). */
22
+ labelHeight?: number;
23
+ }
24
+ /**
25
+ * Return a `VGroup` of `Integer` labels showing the index of each submobject of
26
+ * `mobject`. Useful for inspecting the parts of a complicated mobject. Mirrors
27
+ * ManimCE `index_labels`.
28
+ */
29
+ export declare function indexLabels(mobject: Mobject, options?: IndexLabelsOptions): VGroup;
30
+ /**
31
+ * Build a tree view of `mobject` and its descendants, one line per family
32
+ * member indented by depth. Mirrors ManimCE `print_family`, but returns the
33
+ * string and logs it through the repo logger (never `console`).
34
+ */
35
+ export declare function printFamily(mobject: Mobject, nTabs?: number): string;
36
+ //# sourceMappingURL=debug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/utils/debug.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAIxC;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,OAAO,EAAE,EACtB,mBAAmB,GAAE,OAAe,GACnC,OAAO,EAAE,CASX;AAED;;;;;GAKG;AACH,wBAAgB,4CAA4C,CAC1D,WAAW,EAAE,OAAO,EAAE,EACtB,QAAQ,EAAE,OAAO,EAAE,GAClB,OAAO,EAAE,CAoBX;AAED,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IACjC,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,GAAE,kBAAuB,GAAG,MAAM,CAUtF;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,GAAE,MAAU,GAAG,MAAM,CAYvE"}
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Operations on iterables, ported from ManimCE `manim/utils/iterables.py`.
3
+ *
4
+ * Some helpers are thin wrappers over native `Array` operations. They are
5
+ * ported anyway to keep name-parity with ManimCE's public API:
6
+ * - `concatenateLists` (CE `concatenate_lists`)
7
+ * - `listify` (CE `listify`)
8
+ * - `removeNones` (CE `remove_nones`)
9
+ * - `allElementsAreInstances` (CE `all_elements_are_instances`)
10
+ * - `makeEvenByCycling` (CE `make_even_by_cycling`)
11
+ *
12
+ * `powerset` is not part of ManimCE 0.22.0 `iterables.py`; it is added here as
13
+ * a genuinely useful combinatorial helper (present in older manim variants).
14
+ *
15
+ * Public names are camelCased to match the rest of manim-web (ManimCE's
16
+ * snake_case originals are noted in each "Mirrors ManimCE" reference).
17
+ */
18
+ /** A key function that maps an element to a value used for equality checks. */
19
+ type KeyFn<T> = (item: T) => unknown;
20
+ /**
21
+ * Return the sequence split cyclically into `n`-length tuples.
22
+ *
23
+ * Mirrors ManimCE `adjacent_n_tuples`.
24
+ *
25
+ * @example
26
+ * adjacentNTuples([1, 2, 3, 4], 2); // [[1,2],[2,3],[3,4],[4,1]]
27
+ * adjacentNTuples([1, 2, 3, 4], 3); // [[1,2,3],[2,3,4],[3,4,1],[4,1,2]]
28
+ */
29
+ export declare function adjacentNTuples<T>(objects: readonly T[], n: number): T[][];
30
+ /**
31
+ * Alias for `adjacentNTuples(objects, 2)`. Mirrors ManimCE `adjacent_pairs`.
32
+ *
33
+ * @example
34
+ * adjacentPairs([1, 2, 3]); // [[1,2],[2,3],[3,1]]
35
+ */
36
+ export declare function adjacentPairs<T>(objects: readonly T[]): T[][];
37
+ /**
38
+ * Remove duplicate elements while preserving order, keeping the LAST
39
+ * occurrence of each element. Used instead of `[...new Set(l)]` when the
40
+ * last-occurrence ordering matters (mirrors ManimCE `remove_list_redundancies`).
41
+ *
42
+ * @example
43
+ * removeListRedundancies([1, 2, 1, 3, 2]); // [1, 3, 2]
44
+ */
45
+ export declare function removeListRedundancies<T>(lst: readonly T[]): T[];
46
+ /**
47
+ * Return the elements of `l1` that are not present in `l2`.
48
+ *
49
+ * An optional `key` function determines which elements count as equal.
50
+ * Mirrors ManimCE `list_difference_update`.
51
+ *
52
+ * @example
53
+ * listDifferenceUpdate([1, 2, 3, 4, 1], [2, 4]); // [1, 3, 1]
54
+ */
55
+ export declare function listDifferenceUpdate<T, U>(l1: readonly T[], l2: readonly U[], key?: KeyFn<T | U>): T[];
56
+ /**
57
+ * Return a new list of the elements of `l1` not present in `l2`, followed by
58
+ * every element of `l2`. Order is preserved. Mirrors ManimCE `list_update`.
59
+ *
60
+ * @example
61
+ * listUpdate([1, 2, 3], [2, 4, 4]); // [1, 3, 2, 4, 4]
62
+ */
63
+ export declare function listUpdate<T, U>(l1: readonly T[], l2: readonly U[], key?: KeyFn<T | U>): (T | U)[];
64
+ /**
65
+ * Convert a value to an array intelligently. A string becomes a single-element
66
+ * array; any other iterable is spread; anything else is wrapped.
67
+ *
68
+ * ManimCE `tuplify` returns a tuple; JavaScript has no distinct tuple type, so
69
+ * this returns an array.
70
+ *
71
+ * @example
72
+ * tuplify("str"); // ["str"]
73
+ * tuplify([1, 2]); // [1, 2]
74
+ * tuplify(5); // [5]
75
+ */
76
+ export declare function tuplify<T>(obj: T | readonly T[] | string): (T | string)[];
77
+ /**
78
+ * Extend the shorter of two iterables with duplicate values until both have
79
+ * the same length (favours earlier elements). Mirrors ManimCE `make_even`.
80
+ *
81
+ * @example
82
+ * makeEven([1, 2], [3, 4, 5, 6]); // [[1,1,2,2], [3,4,5,6]]
83
+ */
84
+ export declare function makeEven<T, U>(iterable1: readonly T[], iterable2: readonly U[]): [T[], U[]];
85
+ /**
86
+ * Resample a numeric array up to `length` by index duplication (favours earlier
87
+ * elements). Mirrors ManimCE `stretch_array_to_length`.
88
+ *
89
+ * @throws if `length` is shorter than the input (matches ManimCE, which raises).
90
+ * @example
91
+ * stretchArrayToLength([1, 2], 4); // [1, 1, 2, 2]
92
+ */
93
+ export declare function stretchArrayToLength<T>(array: readonly T[], length: number): T[];
94
+ /**
95
+ * Yield every unique element from the given iterables, in order of first
96
+ * appearance. Mirrors ManimCE `uniq_chain` (a lazy generator).
97
+ *
98
+ * @example
99
+ * [...uniqChain([1, 2], [2, 3], [1, 4, 4])]; // [1, 2, 3, 4]
100
+ */
101
+ export declare function uniqChain<T>(...args: Iterable<T>[]): Generator<T, void, undefined>;
102
+ /**
103
+ * Return every subset of `items` (the power set), as an array of arrays.
104
+ * The result has `2 ** items.length` entries.
105
+ *
106
+ * Not in ManimCE 0.22.0; added as a useful combinatorial helper.
107
+ *
108
+ * @example
109
+ * powerset([1, 2]); // [[], [1], [2], [1, 2]]
110
+ */
111
+ export declare function powerset<T>(items: readonly T[]): T[][];
112
+ /**
113
+ * Return `true` when every element of `iterable` is an instance of `Class`.
114
+ * Mirrors ManimCE `all_elements_are_instances`.
115
+ */
116
+ export declare function allElementsAreInstances<T>(iterable: Iterable<unknown>, ctor: abstract new (...args: never[]) => T): boolean;
117
+ /**
118
+ * Combine the given iterables into one flat list (one level deep).
119
+ * Mirrors ManimCE `concatenate_lists`.
120
+ *
121
+ * @example
122
+ * concatenateLists([1, 2], [3, 4], [5]); // [1, 2, 3, 4, 5]
123
+ */
124
+ export declare function concatenateLists<T>(...listOfLists: Iterable<T>[]): T[];
125
+ /**
126
+ * Convert a value to a list intelligently. A string becomes a single-element
127
+ * array; any other iterable is spread; anything else is wrapped.
128
+ *
129
+ * Mirrors ManimCE `listify` (equivalent to `tuplify`, kept for name-parity).
130
+ *
131
+ * @example
132
+ * listify("str"); // ["str"]
133
+ * listify([1, 2]); // [1, 2]
134
+ * listify(5); // [5]
135
+ */
136
+ export declare function listify<T>(obj: T | readonly T[] | string): (T | string)[];
137
+ /**
138
+ * Return the elements of `sequence` that are truthy (drops values where
139
+ * `Boolean(x)` is `false`). Mirrors ManimCE `remove_nones`.
140
+ *
141
+ * @example
142
+ * removeNones(["m", "", "l", 0, 42, false, true]); // ["m", "l", 42, true]
143
+ */
144
+ export declare function removeNones<T>(sequence: Iterable<T>): NonNullable<T>[];
145
+ /**
146
+ * Extend the shorter of two iterables by cycling its values until both have
147
+ * the same length. Mirrors ManimCE `make_even_by_cycling`.
148
+ *
149
+ * @example
150
+ * makeEvenByCycling([1, 2], [3, 4, 5, 6]); // [[1,2,1,2], [3,4,5,6]]
151
+ */
152
+ export declare function makeEvenByCycling<T, U>(iterable1: readonly T[], iterable2: readonly U[]): [T[], U[]];
153
+ /**
154
+ * Determine a deterministic numeric hash, even for mutable objects.
155
+ *
156
+ * ManimCE `hash_obj` relies on Python's `hash`; JavaScript has none, so this
157
+ * builds a canonical string for the value (object keys sorted, sets sorted)
158
+ * and folds it with a 32-bit FNV-1a hash.
159
+ */
160
+ export declare function hashObj(obj: unknown): number;
161
+ export {};
162
+ //# sourceMappingURL=iterables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iterables.d.ts","sourceRoot":"","sources":["../../src/utils/iterables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,+EAA+E;AAC/E,KAAK,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;AAErC;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CAY1E;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,E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AS,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,CASnF;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,CAStD;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EACvC,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,EAC3B,IAAI,EAAE,QAAQ,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,GACzC,OAAO,CAKT;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,GAAG,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAMtE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,EAAE,GAAG,MAAM,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,EAAE,CAMzE;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,CAMtE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,CAAC,EACpC,SAAS,EAAE,SAAS,CAAC,EAAE,EACvB,SAAS,EAAE,SAAS,CAAC,EAAE,GACtB,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CASZ;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAE5C"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Port of ManimCE `manim/utils/paths.py` (0.22.0) public API.
3
+ *
4
+ * A path function maps a set of start points and a set of end points, together
5
+ * with an interpolation parameter `alpha` in `[0, 1]`, to an intermediate set
6
+ * of points. These drive the `pathArc` behavior of Transform animations.
7
+ *
8
+ * Points are `number[][]` (each point `[x, y, z]`). The two input arrays must
9
+ * have equal length. Function declarations use the repository's camelCase
10
+ * convention; the public ManimCE names (snake_case) are exposed through the
11
+ * alias export block at the end of the file.
12
+ */
13
+ /** A transformation path function (ManimCE `PathFuncType`). */
14
+ export type PathFunc = (startPoints: number[][], endPoints: number[][], alpha: number) => number[][];
15
+ /**
16
+ * Simplest path: each point moves in a straight line toward its destination
17
+ * (ManimCE `straight_path`).
18
+ */
19
+ declare function straightPath(): PathFunc;
20
+ /**
21
+ * Each point moves roughly along a circle with its own center
22
+ * (ManimCE `path_along_circles`).
23
+ */
24
+ declare function pathAlongCircles(arcAngle: number, circlesCenters: number[][], axis?: number[]): PathFunc;
25
+ /**
26
+ * Each point moves along a circular arc of angle `arcAngle` about `axis`
27
+ * (ManimCE `path_along_arc`).
28
+ */
29
+ declare function pathAlongArc(arcAngle: number, axis?: number[]): PathFunc;
30
+ /** Each point moves clockwise around a half circle (ManimCE `clockwise_path`). */
31
+ declare function clockwisePath(): PathFunc;
32
+ /**
33
+ * Each point moves counterclockwise around a half circle
34
+ * (ManimCE `counterclockwise_path`).
35
+ */
36
+ declare function counterclockwisePath(): PathFunc;
37
+ export { straightPath, pathAlongArc, pathAlongCircles, clockwisePath, counterclockwisePath };
38
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,+DAA+D;AAC/D,MAAM,MAAM,QAAQ,GAAG,CACrB,WAAW,EAAE,MAAM,EAAE,EAAE,EACvB,SAAS,EAAE,MAAM,EAAE,EAAE,EACrB,KAAK,EAAE,MAAM,KACV,MAAM,EAAE,EAAE,CAAC;AAahB;;;GAGG;AACH,iBAAS,YAAY,IAAI,QAAQ,CAEhC;AAED;;;GAGG;AACH,iBAAS,gBAAgB,CACvB,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EAAE,EAAE,EAC1B,IAAI,GAAE,MAAM,EAAQ,GACnB,QAAQ,CAeV;AAED;;;GAGG;AACH,iBAAS,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,EAAQ,GAAG,QAAQ,CAsBtE;AAED,kFAAkF;AAClF,iBAAS,aAAa,IAAI,QAAQ,CAEjC;AAED;;;GAGG;AACH,iBAAS,oBAAoB,IAAI,QAAQ,CAExC;AAID,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,oBAAoB,EAAE,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Port of ManimCE `manim/utils/simple_functions.py` (0.22.0) public API.
3
+ */
4
+ /**
5
+ * Numerical binary search for the input to `fn`, between `lowerBound` and
6
+ * `upperBound`, whose output is `target` to within `tolerance`
7
+ * (ManimCE `binary_search`). Returns `undefined` if no such input exists in
8
+ * the bounds.
9
+ */
10
+ declare function binarySearch(fn: (x: number) => number, target: number, lowerBound: number, upperBound: number, tolerance?: number): number | undefined;
11
+ /**
12
+ * The binomial coefficient "n choose k" (ManimCE `choose`). Returns 0 when
13
+ * `k < 0` or `k > n`.
14
+ */
15
+ export declare function choose(n: number, k: number): number;
16
+ /**
17
+ * Clip `a` to the interval `[minA, maxA]` (ManimCE `clip`). Returns `a` when it
18
+ * is already inside the interval, otherwise the nearer bound.
19
+ */
20
+ export declare function clip(a: number, minA: number, maxA: number): number;
21
+ /**
22
+ * The logistic function `1 / (1 + e^-x)` (ManimCE `sigmoid`).
23
+ */
24
+ export declare function sigmoid(x: number): number;
25
+ export { binarySearch };
26
+ //# sourceMappingURL=simpleFunctions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simpleFunctions.d.ts","sourceRoot":"","sources":["../../src/utils/simpleFunctions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AACH,iBAAS,YAAY,CACnB,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,EACzB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,SAAS,SAAO,GACf,MAAM,GAAG,SAAS,CAqBpB;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CASnD;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAIlE;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEzC;AAID,OAAO,EAAE,YAAY,EAAE,CAAC"}