manim-web 0.2.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.
- package/LICENSE +21 -0
- package/README.md +109 -0
- package/dist/animation/Animation.d.ts +69 -0
- package/dist/animation/Animation.d.ts.map +1 -0
- package/dist/animation/AnimationGroup.d.ts +48 -0
- package/dist/animation/AnimationGroup.d.ts.map +1 -0
- package/dist/animation/LaggedStart.d.ts +25 -0
- package/dist/animation/LaggedStart.d.ts.map +1 -0
- package/dist/animation/MaintainPositionRelativeTo.d.ts +23 -0
- package/dist/animation/MaintainPositionRelativeTo.d.ts.map +1 -0
- package/dist/animation/Succession.d.ts +19 -0
- package/dist/animation/Succession.d.ts.map +1 -0
- package/dist/animation/Timeline.d.ts +89 -0
- package/dist/animation/Timeline.d.ts.map +1 -0
- package/dist/animation/UpdateFromAlphaFunc.d.ts +32 -0
- package/dist/animation/UpdateFromAlphaFunc.d.ts.map +1 -0
- package/dist/animation/UpdateFromFunc.d.ts +30 -0
- package/dist/animation/UpdateFromFunc.d.ts.map +1 -0
- package/dist/animation/changing/index.d.ts +213 -0
- package/dist/animation/changing/index.d.ts.map +1 -0
- package/dist/animation/composition/LaggedStartMap.d.ts +47 -0
- package/dist/animation/composition/LaggedStartMap.d.ts.map +1 -0
- package/dist/animation/composition/index.d.ts +5 -0
- package/dist/animation/composition/index.d.ts.map +1 -0
- package/dist/animation/creation/Create.d.ts +232 -0
- package/dist/animation/creation/Create.d.ts.map +1 -0
- package/dist/animation/creation/CreationExtensions.d.ts +127 -0
- package/dist/animation/creation/CreationExtensions.d.ts.map +1 -0
- package/dist/animation/creation/TypeWithCursor.d.ts +133 -0
- package/dist/animation/creation/TypeWithCursor.d.ts.map +1 -0
- package/dist/animation/creation/index.d.ts +4 -0
- package/dist/animation/creation/index.d.ts.map +1 -0
- package/dist/animation/fading/FadeIn.d.ts +31 -0
- package/dist/animation/fading/FadeIn.d.ts.map +1 -0
- package/dist/animation/fading/FadeOut.d.ts +32 -0
- package/dist/animation/fading/FadeOut.d.ts.map +1 -0
- package/dist/animation/fading/index.d.ts +3 -0
- package/dist/animation/fading/index.d.ts.map +1 -0
- package/dist/animation/growing/index.d.ts +103 -0
- package/dist/animation/growing/index.d.ts.map +1 -0
- package/dist/animation/index.d.ts +20 -0
- package/dist/animation/index.d.ts.map +1 -0
- package/dist/animation/indication/ApplyWave.d.ts +51 -0
- package/dist/animation/indication/ApplyWave.d.ts.map +1 -0
- package/dist/animation/indication/Blink.d.ts +34 -0
- package/dist/animation/indication/Blink.d.ts.map +1 -0
- package/dist/animation/indication/Circumscribe.d.ts +54 -0
- package/dist/animation/indication/Circumscribe.d.ts.map +1 -0
- package/dist/animation/indication/Flash.d.ts +45 -0
- package/dist/animation/indication/Flash.d.ts.map +1 -0
- package/dist/animation/indication/FocusOn.d.ts +79 -0
- package/dist/animation/indication/FocusOn.d.ts.map +1 -0
- package/dist/animation/indication/Indicate.d.ts +30 -0
- package/dist/animation/indication/Indicate.d.ts.map +1 -0
- package/dist/animation/indication/ShowCreationThenDestruction.d.ts +26 -0
- package/dist/animation/indication/ShowCreationThenDestruction.d.ts.map +1 -0
- package/dist/animation/indication/ShowPassingFlash.d.ts +47 -0
- package/dist/animation/indication/ShowPassingFlash.d.ts.map +1 -0
- package/dist/animation/indication/ShowPassingFlashWithThinningStrokeWidth.d.ts +21 -0
- package/dist/animation/indication/ShowPassingFlashWithThinningStrokeWidth.d.ts.map +1 -0
- package/dist/animation/indication/Wiggle.d.ts +48 -0
- package/dist/animation/indication/Wiggle.d.ts.map +1 -0
- package/dist/animation/indication/WiggleOutThenIn.d.ts +44 -0
- package/dist/animation/indication/WiggleOutThenIn.d.ts.map +1 -0
- package/dist/animation/indication/index.d.ts +20 -0
- package/dist/animation/indication/index.d.ts.map +1 -0
- package/dist/animation/movement/Homotopy.d.ts +204 -0
- package/dist/animation/movement/Homotopy.d.ts.map +1 -0
- package/dist/animation/movement/MoveAlongPath.d.ts +48 -0
- package/dist/animation/movement/MoveAlongPath.d.ts.map +1 -0
- package/dist/animation/movement/Rotate.d.ts +47 -0
- package/dist/animation/movement/Rotate.d.ts.map +1 -0
- package/dist/animation/movement/Scale.d.ts +74 -0
- package/dist/animation/movement/Scale.d.ts.map +1 -0
- package/dist/animation/movement/Shift.d.ts +74 -0
- package/dist/animation/movement/Shift.d.ts.map +1 -0
- package/dist/animation/movement/index.d.ts +6 -0
- package/dist/animation/movement/index.d.ts.map +1 -0
- package/dist/animation/numbers/index.d.ts +152 -0
- package/dist/animation/numbers/index.d.ts.map +1 -0
- package/dist/animation/speed/index.d.ts +114 -0
- package/dist/animation/speed/index.d.ts.map +1 -0
- package/dist/animation/transform/ApplyPointwiseFunction.d.ts +23 -0
- package/dist/animation/transform/ApplyPointwiseFunction.d.ts.map +1 -0
- package/dist/animation/transform/Transform.d.ts +89 -0
- package/dist/animation/transform/Transform.d.ts.map +1 -0
- package/dist/animation/transform/TransformExtensions.d.ts +444 -0
- package/dist/animation/transform/TransformExtensions.d.ts.map +1 -0
- package/dist/animation/transform/TransformMatching.d.ts +138 -0
- package/dist/animation/transform/TransformMatching.d.ts.map +1 -0
- package/dist/animation/transform/index.d.ts +5 -0
- package/dist/animation/transform/index.d.ts.map +1 -0
- package/dist/animation/utility/index.d.ts +171 -0
- package/dist/animation/utility/index.d.ts.map +1 -0
- package/dist/constants/colors.d.ts +72 -0
- package/dist/constants/colors.d.ts.map +1 -0
- package/dist/constants/colors.test.d.ts +2 -0
- package/dist/constants/colors.test.d.ts.map +1 -0
- package/dist/constants/directions.test.d.ts +2 -0
- package/dist/constants/directions.test.d.ts.map +1 -0
- package/dist/constants/index.d.ts +16 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/core/AudioManager.d.ts +203 -0
- package/dist/core/AudioManager.d.ts.map +1 -0
- package/dist/core/Camera.d.ts +172 -0
- package/dist/core/Camera.d.ts.map +1 -0
- package/dist/core/Camera2DFrame.d.ts +31 -0
- package/dist/core/Camera2DFrame.d.ts.map +1 -0
- package/dist/core/CameraExtensions.d.ts +420 -0
- package/dist/core/CameraExtensions.d.ts.map +1 -0
- package/dist/core/CameraFrame.d.ts +178 -0
- package/dist/core/CameraFrame.d.ts.map +1 -0
- package/dist/core/Group.d.ts +139 -0
- package/dist/core/Group.d.ts.map +1 -0
- package/dist/core/InteractiveScene.d.ts +122 -0
- package/dist/core/InteractiveScene.d.ts.map +1 -0
- package/dist/core/Lighting.d.ts +128 -0
- package/dist/core/Lighting.d.ts.map +1 -0
- package/dist/core/Mobject.d.ts +488 -0
- package/dist/core/Mobject.d.ts.map +1 -0
- package/dist/core/Renderer.d.ts +84 -0
- package/dist/core/Renderer.d.ts.map +1 -0
- package/dist/core/Scene.d.ts +353 -0
- package/dist/core/Scene.d.ts.map +1 -0
- package/dist/core/SceneExtensions.d.ts +640 -0
- package/dist/core/SceneExtensions.d.ts.map +1 -0
- package/dist/core/SceneExtensions.test.d.ts +2 -0
- package/dist/core/SceneExtensions.test.d.ts.map +1 -0
- package/dist/core/StateManager.d.ts +193 -0
- package/dist/core/StateManager.d.ts.map +1 -0
- package/dist/core/VDict.d.ts +229 -0
- package/dist/core/VDict.d.ts.map +1 -0
- package/dist/core/VGroup.d.ts +200 -0
- package/dist/core/VGroup.d.ts.map +1 -0
- package/dist/core/VMobject.d.ts +419 -0
- package/dist/core/VMobject.d.ts.map +1 -0
- package/dist/core/index.d.ts +16 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/examples.test.d.ts +2 -0
- package/dist/examples.test.d.ts.map +1 -0
- package/dist/export/GifExporter.d.ts +40 -0
- package/dist/export/GifExporter.d.ts.map +1 -0
- package/dist/export/VideoExporter.d.ts +135 -0
- package/dist/export/VideoExporter.d.ts.map +1 -0
- package/dist/export/index.d.ts +3 -0
- package/dist/export/index.d.ts.map +1 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49064 -0
- package/dist/integrations/index.d.ts +1 -0
- package/dist/integrations/index.d.ts.map +1 -0
- package/dist/integrations/react.d.ts +144 -0
- package/dist/integrations/react.d.ts.map +1 -0
- package/dist/integrations/react.js +570 -0
- package/dist/integrations/vue.d.ts +249 -0
- package/dist/integrations/vue.d.ts.map +1 -0
- package/dist/integrations/vue.js +560 -0
- package/dist/interaction/Clickable.d.ts +71 -0
- package/dist/interaction/Clickable.d.ts.map +1 -0
- package/dist/interaction/Controls.d.ts +174 -0
- package/dist/interaction/Controls.d.ts.map +1 -0
- package/dist/interaction/Draggable.d.ts +88 -0
- package/dist/interaction/Draggable.d.ts.map +1 -0
- package/dist/interaction/Hoverable.d.ts +82 -0
- package/dist/interaction/Hoverable.d.ts.map +1 -0
- package/dist/interaction/OrbitControls.d.ts +139 -0
- package/dist/interaction/OrbitControls.d.ts.map +1 -0
- package/dist/interaction/PlaybackControls.d.ts +113 -0
- package/dist/interaction/PlaybackControls.d.ts.map +1 -0
- package/dist/interaction/SelectionManager.d.ts +125 -0
- package/dist/interaction/SelectionManager.d.ts.map +1 -0
- package/dist/interaction/index.d.ts +12 -0
- package/dist/interaction/index.d.ts.map +1 -0
- package/dist/mobjects/fractals/MandelbrotSet.d.ts +92 -0
- package/dist/mobjects/fractals/MandelbrotSet.d.ts.map +1 -0
- package/dist/mobjects/fractals/NewtonFractal.d.ts +121 -0
- package/dist/mobjects/fractals/NewtonFractal.d.ts.map +1 -0
- package/dist/mobjects/fractals/index.d.ts +3 -0
- package/dist/mobjects/fractals/index.d.ts.map +1 -0
- package/dist/mobjects/frame/index.d.ts +188 -0
- package/dist/mobjects/frame/index.d.ts.map +1 -0
- package/dist/mobjects/geometry/AngleShapes.d.ts +326 -0
- package/dist/mobjects/geometry/AngleShapes.d.ts.map +1 -0
- package/dist/mobjects/geometry/Arc.d.ts +111 -0
- package/dist/mobjects/geometry/Arc.d.ts.map +1 -0
- package/dist/mobjects/geometry/ArcBetweenPoints.d.ts +68 -0
- package/dist/mobjects/geometry/ArcBetweenPoints.d.ts.map +1 -0
- package/dist/mobjects/geometry/ArcShapes.d.ts +659 -0
- package/dist/mobjects/geometry/ArcShapes.d.ts.map +1 -0
- package/dist/mobjects/geometry/Arrow.d.ts +130 -0
- package/dist/mobjects/geometry/Arrow.d.ts.map +1 -0
- package/dist/mobjects/geometry/ArrowTips.d.ts +238 -0
- package/dist/mobjects/geometry/ArrowTips.d.ts.map +1 -0
- package/dist/mobjects/geometry/BooleanOperations.d.ts +163 -0
- package/dist/mobjects/geometry/BooleanOperations.d.ts.map +1 -0
- package/dist/mobjects/geometry/Circle.d.ts +92 -0
- package/dist/mobjects/geometry/Circle.d.ts.map +1 -0
- package/dist/mobjects/geometry/CubicBezier.d.ts +126 -0
- package/dist/mobjects/geometry/CubicBezier.d.ts.map +1 -0
- package/dist/mobjects/geometry/DashedLine.d.ts +109 -0
- package/dist/mobjects/geometry/DashedLine.d.ts.map +1 -0
- package/dist/mobjects/geometry/DashedVMobject.d.ts +96 -0
- package/dist/mobjects/geometry/DashedVMobject.d.ts.map +1 -0
- package/dist/mobjects/geometry/Dot.d.ts +100 -0
- package/dist/mobjects/geometry/Dot.d.ts.map +1 -0
- package/dist/mobjects/geometry/LabeledGeometry.d.ts +372 -0
- package/dist/mobjects/geometry/LabeledGeometry.d.ts.map +1 -0
- package/dist/mobjects/geometry/Line.d.ts +83 -0
- package/dist/mobjects/geometry/Line.d.ts.map +1 -0
- package/dist/mobjects/geometry/Polygon.d.ts +155 -0
- package/dist/mobjects/geometry/Polygon.d.ts.map +1 -0
- package/dist/mobjects/geometry/PolygonExtensions.d.ts +412 -0
- package/dist/mobjects/geometry/PolygonExtensions.d.ts.map +1 -0
- package/dist/mobjects/geometry/Rectangle.d.ts +123 -0
- package/dist/mobjects/geometry/Rectangle.d.ts.map +1 -0
- package/dist/mobjects/geometry/ShapeMatchers.d.ts +252 -0
- package/dist/mobjects/geometry/ShapeMatchers.d.ts.map +1 -0
- package/dist/mobjects/geometry/index.d.ts +25 -0
- package/dist/mobjects/geometry/index.d.ts.map +1 -0
- package/dist/mobjects/graph/index.d.ts +425 -0
- package/dist/mobjects/graph/index.d.ts.map +1 -0
- package/dist/mobjects/graphing/Axes.d.ts +254 -0
- package/dist/mobjects/graphing/Axes.d.ts.map +1 -0
- package/dist/mobjects/graphing/BarChart.d.ts +241 -0
- package/dist/mobjects/graphing/BarChart.d.ts.map +1 -0
- package/dist/mobjects/graphing/ComplexPlane.d.ts +311 -0
- package/dist/mobjects/graphing/ComplexPlane.d.ts.map +1 -0
- package/dist/mobjects/graphing/FunctionGraph.d.ts +123 -0
- package/dist/mobjects/graphing/FunctionGraph.d.ts.map +1 -0
- package/dist/mobjects/graphing/ImplicitFunction.d.ts +131 -0
- package/dist/mobjects/graphing/ImplicitFunction.d.ts.map +1 -0
- package/dist/mobjects/graphing/NumberLine.d.ts +195 -0
- package/dist/mobjects/graphing/NumberLine.d.ts.map +1 -0
- package/dist/mobjects/graphing/NumberPlane.d.ts +91 -0
- package/dist/mobjects/graphing/NumberPlane.d.ts.map +1 -0
- package/dist/mobjects/graphing/ParametricFunction.d.ts +111 -0
- package/dist/mobjects/graphing/ParametricFunction.d.ts.map +1 -0
- package/dist/mobjects/graphing/Vector.d.ts +121 -0
- package/dist/mobjects/graphing/Vector.d.ts.map +1 -0
- package/dist/mobjects/graphing/VectorField.d.ts +321 -0
- package/dist/mobjects/graphing/VectorField.d.ts.map +1 -0
- package/dist/mobjects/graphing/index.d.ts +18 -0
- package/dist/mobjects/graphing/index.d.ts.map +1 -0
- package/dist/mobjects/image/index.d.ts +223 -0
- package/dist/mobjects/image/index.d.ts.map +1 -0
- package/dist/mobjects/matrix/Matrix.d.ts +260 -0
- package/dist/mobjects/matrix/Matrix.d.ts.map +1 -0
- package/dist/mobjects/matrix/index.d.ts +8 -0
- package/dist/mobjects/matrix/index.d.ts.map +1 -0
- package/dist/mobjects/point/index.d.ts +707 -0
- package/dist/mobjects/point/index.d.ts.map +1 -0
- package/dist/mobjects/probability/DiceFace.d.ts +137 -0
- package/dist/mobjects/probability/DiceFace.d.ts.map +1 -0
- package/dist/mobjects/probability/SampleSpace.d.ts +267 -0
- package/dist/mobjects/probability/SampleSpace.d.ts.map +1 -0
- package/dist/mobjects/probability/index.d.ts +9 -0
- package/dist/mobjects/probability/index.d.ts.map +1 -0
- package/dist/mobjects/svg/Brace.d.ts +308 -0
- package/dist/mobjects/svg/Brace.d.ts.map +1 -0
- package/dist/mobjects/svg/SVGMobject.d.ts +64 -0
- package/dist/mobjects/svg/SVGMobject.d.ts.map +1 -0
- package/dist/mobjects/svg/index.d.ts +10 -0
- package/dist/mobjects/svg/index.d.ts.map +1 -0
- package/dist/mobjects/table/Table.d.ts +315 -0
- package/dist/mobjects/table/Table.d.ts.map +1 -0
- package/dist/mobjects/table/index.d.ts +8 -0
- package/dist/mobjects/table/index.d.ts.map +1 -0
- package/dist/mobjects/text/Code.d.ts +244 -0
- package/dist/mobjects/text/Code.d.ts.map +1 -0
- package/dist/mobjects/text/DecimalNumber.d.ts +199 -0
- package/dist/mobjects/text/DecimalNumber.d.ts.map +1 -0
- package/dist/mobjects/text/GlyphVMobject.d.ts +76 -0
- package/dist/mobjects/text/GlyphVMobject.d.ts.map +1 -0
- package/dist/mobjects/text/MarkupText.d.ts +161 -0
- package/dist/mobjects/text/MarkupText.d.ts.map +1 -0
- package/dist/mobjects/text/MathJaxRenderer.d.ts +49 -0
- package/dist/mobjects/text/MathJaxRenderer.d.ts.map +1 -0
- package/dist/mobjects/text/MathTex.d.ts +242 -0
- package/dist/mobjects/text/MathTex.d.ts.map +1 -0
- package/dist/mobjects/text/Paragraph.d.ts +86 -0
- package/dist/mobjects/text/Paragraph.d.ts.map +1 -0
- package/dist/mobjects/text/Tex.d.ts +40 -0
- package/dist/mobjects/text/Tex.d.ts.map +1 -0
- package/dist/mobjects/text/Text.d.ts +171 -0
- package/dist/mobjects/text/Text.d.ts.map +1 -0
- package/dist/mobjects/text/TextExtensions.d.ts +383 -0
- package/dist/mobjects/text/TextExtensions.d.ts.map +1 -0
- package/dist/mobjects/text/TextGlyphGroup.d.ts +48 -0
- package/dist/mobjects/text/TextGlyphGroup.d.ts.map +1 -0
- package/dist/mobjects/text/Variable.d.ts +160 -0
- package/dist/mobjects/text/Variable.d.ts.map +1 -0
- package/dist/mobjects/text/index.d.ts +21 -0
- package/dist/mobjects/text/index.d.ts.map +1 -0
- package/dist/mobjects/text/katex-styles.d.ts +23 -0
- package/dist/mobjects/text/katex-styles.d.ts.map +1 -0
- package/dist/mobjects/text/svgPathParser.d.ts +39 -0
- package/dist/mobjects/text/svgPathParser.d.ts.map +1 -0
- package/dist/mobjects/three-d/Arrow3D.d.ts +136 -0
- package/dist/mobjects/three-d/Arrow3D.d.ts.map +1 -0
- package/dist/mobjects/three-d/Cube.d.ts +186 -0
- package/dist/mobjects/three-d/Cube.d.ts.map +1 -0
- package/dist/mobjects/three-d/Cylinder.d.ts +189 -0
- package/dist/mobjects/three-d/Cylinder.d.ts.map +1 -0
- package/dist/mobjects/three-d/Line3D.d.ts +100 -0
- package/dist/mobjects/three-d/Line3D.d.ts.map +1 -0
- package/dist/mobjects/three-d/ParametricSurface.d.ts +86 -0
- package/dist/mobjects/three-d/ParametricSurface.d.ts.map +1 -0
- package/dist/mobjects/three-d/Polyhedra.d.ts +271 -0
- package/dist/mobjects/three-d/Polyhedra.d.ts.map +1 -0
- package/dist/mobjects/three-d/Sphere.d.ts +100 -0
- package/dist/mobjects/three-d/Sphere.d.ts.map +1 -0
- package/dist/mobjects/three-d/Surface3D.d.ts +156 -0
- package/dist/mobjects/three-d/Surface3D.d.ts.map +1 -0
- package/dist/mobjects/three-d/TexturedSurface.d.ts +208 -0
- package/dist/mobjects/three-d/TexturedSurface.d.ts.map +1 -0
- package/dist/mobjects/three-d/ThreeDAxes.d.ts +172 -0
- package/dist/mobjects/three-d/ThreeDAxes.d.ts.map +1 -0
- package/dist/mobjects/three-d/ThreeDExtensions.d.ts +335 -0
- package/dist/mobjects/three-d/ThreeDExtensions.d.ts.map +1 -0
- package/dist/mobjects/three-d/Torus.d.ts +123 -0
- package/dist/mobjects/three-d/Torus.d.ts.map +1 -0
- package/dist/mobjects/three-d/index.d.ts +19 -0
- package/dist/mobjects/three-d/index.d.ts.map +1 -0
- package/dist/mobjects/value-tracker/ValueTracker.d.ts +248 -0
- package/dist/mobjects/value-tracker/ValueTracker.d.ts.map +1 -0
- package/dist/mobjects/value-tracker/index.d.ts +9 -0
- package/dist/mobjects/value-tracker/index.d.ts.map +1 -0
- package/dist/rate-functions/index.d.ts +81 -0
- package/dist/rate-functions/index.d.ts.map +1 -0
- package/dist/rate-functions/rateFunctions.test.d.ts +2 -0
- package/dist/rate-functions/rateFunctions.test.d.ts.map +1 -0
- package/dist/rendering/BezierRenderer.d.ts +112 -0
- package/dist/rendering/BezierRenderer.d.ts.map +1 -0
- package/dist/rendering/BezierShaderMaterial.d.ts +50 -0
- package/dist/rendering/BezierShaderMaterial.d.ts.map +1 -0
- package/dist/rendering/index.d.ts +10 -0
- package/dist/rendering/index.d.ts.map +1 -0
- package/dist/utils/Performance.d.ts +118 -0
- package/dist/utils/Performance.d.ts.map +1 -0
- package/dist/utils/featureFlags.d.ts +15 -0
- package/dist/utils/featureFlags.d.ts.map +1 -0
- package/dist/utils/hungarian.d.ts +66 -0
- package/dist/utils/hungarian.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +14 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/math.d.ts +52 -0
- package/dist/utils/math.d.ts.map +1 -0
- package/dist/utils/ode.d.ts +135 -0
- package/dist/utils/ode.d.ts.map +1 -0
- package/dist/utils/skeletonize.d.ts +35 -0
- package/dist/utils/skeletonize.d.ts.map +1 -0
- package/dist/utils/triangulate.d.ts +54 -0
- package/dist/utils/triangulate.d.ts.map +1 -0
- package/dist/utils/vectors.d.ts +57 -0
- package/dist/utils/vectors.d.ts.map +1 -0
- package/package.json +122 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { VMobject } from '../../core/VMobject';
|
|
2
|
+
import { Vector3Tuple } from '../../core/Mobject';
|
|
3
|
+
/**
|
|
4
|
+
* DecimalNumber - A text mobject that displays a number and can be animated
|
|
5
|
+
*
|
|
6
|
+
* This module provides number display capabilities with configurable decimal places,
|
|
7
|
+
* sign display, and ellipsis support. Designed to work with ValueTracker for animations.
|
|
8
|
+
*/
|
|
9
|
+
import * as THREE from 'three';
|
|
10
|
+
/**
|
|
11
|
+
* Options for creating a DecimalNumber mobject
|
|
12
|
+
*/
|
|
13
|
+
export interface DecimalNumberOptions {
|
|
14
|
+
/** The numeric value to display. Default: 0 */
|
|
15
|
+
value?: number;
|
|
16
|
+
/** Number of decimal places to show. Default: 2 */
|
|
17
|
+
numDecimalPlaces?: number;
|
|
18
|
+
/** Whether to show ellipsis (...) after the number. Default: false */
|
|
19
|
+
showEllipsis?: boolean;
|
|
20
|
+
/** Whether to show + sign for positive numbers. Default: false */
|
|
21
|
+
includeSign?: boolean;
|
|
22
|
+
/** Group digits with separator (e.g., 1,000). Default: false */
|
|
23
|
+
groupWithCommas?: boolean;
|
|
24
|
+
/** Font size in pixels. Default: 48 */
|
|
25
|
+
fontSize?: number;
|
|
26
|
+
/** Font family. Default: 'monospace' */
|
|
27
|
+
fontFamily?: string;
|
|
28
|
+
/** Font weight. Default: 'normal' */
|
|
29
|
+
fontWeight?: string | number;
|
|
30
|
+
/** Text color as CSS color string. Default: '#ffffff' */
|
|
31
|
+
color?: string;
|
|
32
|
+
/** Fill opacity from 0 to 1. Default: 1 */
|
|
33
|
+
fillOpacity?: number;
|
|
34
|
+
/** Edge to preserve when number width changes. Default: null (center) */
|
|
35
|
+
edgeToFix?: 'left' | 'right' | null;
|
|
36
|
+
/** Unit string to append (e.g., '%', 'm/s'). Default: '' */
|
|
37
|
+
unit?: string;
|
|
38
|
+
/** Buffer between number and unit. Default: 0.05 */
|
|
39
|
+
unitBuff?: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* DecimalNumber - A text mobject that displays a configurable number
|
|
43
|
+
*
|
|
44
|
+
* The number can be animated by calling setValue() with new values,
|
|
45
|
+
* or by using a ValueTracker with an updater function.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* // Create a simple decimal number
|
|
50
|
+
* const num = new DecimalNumber({ value: 3.14159 });
|
|
51
|
+
*
|
|
52
|
+
* // Create with custom formatting
|
|
53
|
+
* const percentage = new DecimalNumber({
|
|
54
|
+
* value: 75.5,
|
|
55
|
+
* numDecimalPlaces: 1,
|
|
56
|
+
* includeSign: true,
|
|
57
|
+
* unit: '%'
|
|
58
|
+
* });
|
|
59
|
+
*
|
|
60
|
+
* // Animate value change
|
|
61
|
+
* num.setValue(42);
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare class DecimalNumber extends VMobject {
|
|
65
|
+
protected _value: number;
|
|
66
|
+
protected _numDecimalPlaces: number;
|
|
67
|
+
protected _showEllipsis: boolean;
|
|
68
|
+
protected _includeSign: boolean;
|
|
69
|
+
protected _groupWithCommas: boolean;
|
|
70
|
+
protected _fontSize: number;
|
|
71
|
+
protected _fontFamily: string;
|
|
72
|
+
protected _fontWeight: string | number;
|
|
73
|
+
protected _edgeToFix: 'left' | 'right' | null;
|
|
74
|
+
protected _unit: string;
|
|
75
|
+
protected _unitBuff: number;
|
|
76
|
+
/** Off-screen canvas for text rendering */
|
|
77
|
+
protected _canvas: HTMLCanvasElement | null;
|
|
78
|
+
protected _ctx: CanvasRenderingContext2D | null;
|
|
79
|
+
/** Three.js texture from canvas */
|
|
80
|
+
protected _texture: THREE.CanvasTexture | null;
|
|
81
|
+
/** Plane mesh for displaying the texture */
|
|
82
|
+
protected _mesh: THREE.Mesh | null;
|
|
83
|
+
/** Cached dimensions in world units */
|
|
84
|
+
protected _worldWidth: number;
|
|
85
|
+
protected _worldHeight: number;
|
|
86
|
+
/** Previous edge position for edge-fixing */
|
|
87
|
+
protected _previousEdgePosition: number | null;
|
|
88
|
+
constructor(options?: DecimalNumberOptions);
|
|
89
|
+
/**
|
|
90
|
+
* Initialize the off-screen canvas
|
|
91
|
+
*/
|
|
92
|
+
protected _initCanvas(): void;
|
|
93
|
+
/**
|
|
94
|
+
* Get the current numeric value
|
|
95
|
+
*/
|
|
96
|
+
getValue(): number;
|
|
97
|
+
/**
|
|
98
|
+
* Set the numeric value and update display
|
|
99
|
+
* @param value - New value to display
|
|
100
|
+
* @returns this for chaining
|
|
101
|
+
*/
|
|
102
|
+
setValue(value: number): this;
|
|
103
|
+
/**
|
|
104
|
+
* Get the X position of the edge being fixed
|
|
105
|
+
*/
|
|
106
|
+
protected _getEdgeX(): number;
|
|
107
|
+
/**
|
|
108
|
+
* Get the number of decimal places
|
|
109
|
+
*/
|
|
110
|
+
getNumDecimalPlaces(): number;
|
|
111
|
+
/**
|
|
112
|
+
* Set the number of decimal places
|
|
113
|
+
* @param places - Number of decimal places
|
|
114
|
+
* @returns this for chaining
|
|
115
|
+
*/
|
|
116
|
+
setNumDecimalPlaces(places: number): this;
|
|
117
|
+
/**
|
|
118
|
+
* Get the font size
|
|
119
|
+
*/
|
|
120
|
+
getFontSize(): number;
|
|
121
|
+
/**
|
|
122
|
+
* Set the font size
|
|
123
|
+
* @param size - Font size in pixels
|
|
124
|
+
* @returns this for chaining
|
|
125
|
+
*/
|
|
126
|
+
setFontSize(size: number): this;
|
|
127
|
+
/**
|
|
128
|
+
* Format the number as a string
|
|
129
|
+
*/
|
|
130
|
+
protected _formatNumber(): string;
|
|
131
|
+
/**
|
|
132
|
+
* Build the CSS font string
|
|
133
|
+
*/
|
|
134
|
+
protected _buildFontString(): string;
|
|
135
|
+
/**
|
|
136
|
+
* Measure text dimensions
|
|
137
|
+
*/
|
|
138
|
+
protected _measureText(): {
|
|
139
|
+
text: string;
|
|
140
|
+
width: number;
|
|
141
|
+
height: number;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Render text to the off-screen canvas
|
|
145
|
+
*/
|
|
146
|
+
protected _renderToCanvas(): void;
|
|
147
|
+
/**
|
|
148
|
+
* Update the mesh geometry to match new dimensions
|
|
149
|
+
*/
|
|
150
|
+
protected _updateMesh(): void;
|
|
151
|
+
/**
|
|
152
|
+
* Create the Three.js backing object
|
|
153
|
+
*/
|
|
154
|
+
protected _createThreeObject(): THREE.Object3D;
|
|
155
|
+
/**
|
|
156
|
+
* Sync material properties to Three.js
|
|
157
|
+
*/
|
|
158
|
+
protected _syncMaterialToThree(): void;
|
|
159
|
+
/**
|
|
160
|
+
* Get the center of this DecimalNumber
|
|
161
|
+
*/
|
|
162
|
+
getCenter(): Vector3Tuple;
|
|
163
|
+
/**
|
|
164
|
+
* Get text width in world units
|
|
165
|
+
*/
|
|
166
|
+
getWidth(): number;
|
|
167
|
+
/**
|
|
168
|
+
* Get text height in world units
|
|
169
|
+
*/
|
|
170
|
+
getHeight(): number;
|
|
171
|
+
/**
|
|
172
|
+
* Create a copy of this DecimalNumber
|
|
173
|
+
*/
|
|
174
|
+
protected _createCopy(): DecimalNumber;
|
|
175
|
+
/**
|
|
176
|
+
* Clean up Three.js and canvas resources
|
|
177
|
+
*/
|
|
178
|
+
dispose(): void;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Integer - A DecimalNumber with zero decimal places
|
|
182
|
+
*
|
|
183
|
+
* Convenience class for displaying integers without decimal points.
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```typescript
|
|
187
|
+
* const count = new Integer({ value: 42 });
|
|
188
|
+
* count.setValue(100);
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
export declare class Integer extends DecimalNumber {
|
|
192
|
+
constructor(options?: Omit<DecimalNumberOptions, 'numDecimalPlaces'>);
|
|
193
|
+
/**
|
|
194
|
+
* Create a copy of this Integer
|
|
195
|
+
*/
|
|
196
|
+
protected _createCopy(): Integer;
|
|
197
|
+
}
|
|
198
|
+
export default DecimalNumber;
|
|
199
|
+
//# sourceMappingURL=DecimalNumber.d.ts.map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IAIrB;;;;OAIG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAQ/B;;OAEG;IACH,SAAS,CAAC,aAAa,IAAI,MAAM;IAkCjC;;OAEG;IACH,SAAS,CAAC,gBAAgB,IAAI,MAAM;IAQpC;;OAEG;IACH,SAAS,CAAC,YAAY,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAsBzE;;OAEG;IACH,SAAS,CAAC,eAAe,IAAI,IAAI;IAkCjC;;OAEG;IACH,SAAS,CAAC,WAAW,IAAI,IAAI;IAW7B;;OAEG;cACgB,kBAAkB,IAAI,KAAK,CAAC,QAAQ;IAiCvD;;OAEG;cACgB,oBAAoB,IAAI,IAAI;IAY/C;;OAEG;IACM,SAAS,IAAI,YAAY;IAIlC;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,SAAS,IAAI,MAAM;IAInB;;OAEG;cACgB,WAAW,IAAI,aAAa;IAmB/C;;OAEG;IACM,OAAO,IAAI,IAAI;CAUzB;AAED;;;;;;;;;;GAUG;AACH,qBAAa,OAAQ,SAAQ,aAAa;gBAC5B,OAAO,GAAE,IAAI,CAAC,oBAAoB,EAAE,kBAAkB,CAAM;IAOxE;;OAEG;cACgB,WAAW,IAAI,OAAO;CAgB1C;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { VMobject } from '../../core/VMobject';
|
|
2
|
+
import { Font, Glyph } from 'opentype.js';
|
|
3
|
+
import { SkeletonizeOptions } from '../../utils/skeletonize';
|
|
4
|
+
export interface GlyphVMobjectOptions {
|
|
5
|
+
/** The opentype.js Glyph object */
|
|
6
|
+
glyph: Glyph;
|
|
7
|
+
/** The font this glyph belongs to (needed for unitsPerEm) */
|
|
8
|
+
font: Font;
|
|
9
|
+
/** Font size in pixels */
|
|
10
|
+
fontSize: number;
|
|
11
|
+
/** X offset in pixels (for character positioning) */
|
|
12
|
+
xOffset?: number;
|
|
13
|
+
/** Y offset in pixels */
|
|
14
|
+
yOffset?: number;
|
|
15
|
+
/** Stroke color */
|
|
16
|
+
color?: string;
|
|
17
|
+
/** Stroke width for outline drawing */
|
|
18
|
+
strokeWidth?: number;
|
|
19
|
+
/**
|
|
20
|
+
* When true, compute the skeleton (medial axis) of the glyph outline
|
|
21
|
+
* so the Write animation can draw along the center-line rather than
|
|
22
|
+
* the perimeter. Default: false.
|
|
23
|
+
*/
|
|
24
|
+
useSkeletonStroke?: boolean;
|
|
25
|
+
/** Options forwarded to the skeletonization algorithm. */
|
|
26
|
+
skeletonOptions?: SkeletonizeOptions;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A VMobject that represents a single glyph's outline as cubic Bezier curves.
|
|
30
|
+
*
|
|
31
|
+
* The glyph's path commands (M, L, Q, C, Z) are converted to the cubic Bezier
|
|
32
|
+
* control point format that VMobject expects:
|
|
33
|
+
* [anchor1, handle1, handle2, anchor2, handle3, handle4, anchor3, ...]
|
|
34
|
+
*
|
|
35
|
+
* Multi-contour glyphs (e.g., "o", "B", "i") produce multiple sub-paths
|
|
36
|
+
* joined by degenerate zero-length segments.
|
|
37
|
+
*/
|
|
38
|
+
export declare class GlyphVMobject extends VMobject {
|
|
39
|
+
private _glyph;
|
|
40
|
+
private _glyphFontSize;
|
|
41
|
+
/** Whether skeleton computation was requested */
|
|
42
|
+
private _useSkeletonStroke;
|
|
43
|
+
/** Options for skeleton computation */
|
|
44
|
+
private _skeletonOptions;
|
|
45
|
+
/** Cached skeleton path (null = not yet computed, empty array = no skeleton) */
|
|
46
|
+
private _skeletonPath;
|
|
47
|
+
/** The raw outline points used to derive the skeleton */
|
|
48
|
+
private _outlinePoints;
|
|
49
|
+
constructor(options: GlyphVMobjectOptions);
|
|
50
|
+
/**
|
|
51
|
+
* Convert glyph path commands to cubic Bezier control points in world space.
|
|
52
|
+
*/
|
|
53
|
+
private _buildPoints;
|
|
54
|
+
/**
|
|
55
|
+
* Get the skeleton (medial-axis) path for this glyph.
|
|
56
|
+
*
|
|
57
|
+
* The skeleton is computed lazily on first call (unless pre-computed
|
|
58
|
+
* at construction via `useSkeletonStroke: true`).
|
|
59
|
+
*
|
|
60
|
+
* @param options Override skeletonization options for this call.
|
|
61
|
+
* @returns Cubic Bezier control points tracing the glyph center-line,
|
|
62
|
+
* or `null` if the glyph has no computable skeleton.
|
|
63
|
+
*/
|
|
64
|
+
getSkeletonPath(options?: SkeletonizeOptions): number[][] | null;
|
|
65
|
+
/**
|
|
66
|
+
* Returns true if this glyph was configured with skeleton stroke mode.
|
|
67
|
+
*/
|
|
68
|
+
get useSkeletonStroke(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Enable or disable skeleton stroke mode.
|
|
71
|
+
* If enabling, the skeleton is computed immediately.
|
|
72
|
+
*/
|
|
73
|
+
set useSkeletonStroke(value: boolean);
|
|
74
|
+
protected _createCopy(): GlyphVMobject;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=GlyphVMobject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlyphVMobject.d.ts","sourceRoot":"","sources":["../../../src/mobjects/text/GlyphVMobject.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAKpF,MAAM,WAAW,oBAAoB;IACnC,mCAAmC;IACnC,KAAK,EAAE,KAAK,CAAC;IACb,6DAA6D;IAC7D,IAAI,EAAE,IAAI,CAAC;IACX,0BAA0B;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,0DAA0D;IAC1D,eAAe,CAAC,EAAE,kBAAkB,CAAC;CACtC;AAED;;;;;;;;;GASG;AACH,qBAAa,aAAc,SAAQ,QAAQ;IACzC,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,cAAc,CAAS;IAE/B,iDAAiD;IACjD,OAAO,CAAC,kBAAkB,CAAU;IACpC,uCAAuC;IACvC,OAAO,CAAC,gBAAgB,CAAqB;IAC7C,gFAAgF;IAChF,OAAO,CAAC,aAAa,CAA2B;IAChD,yDAAyD;IACzD,OAAO,CAAC,cAAc,CAAkB;gBAE5B,OAAO,EAAE,oBAAoB;IA+BzC;;OAEG;IACH,OAAO,CAAC,YAAY;IAoHpB;;;;;;;;;OASG;IACH,eAAe,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,MAAM,EAAE,EAAE,GAAG,IAAI;IAYhE;;OAEG;IACH,IAAI,iBAAiB,IAAI,OAAO,CAE/B;IAED;;;OAGG;IACH,IAAI,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAKnC;cAEkB,WAAW,IAAI,aAAa;CAWhD"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { Text, TextOptions } from './Text';
|
|
2
|
+
/**
|
|
3
|
+
* Options for creating a MarkupText mobject
|
|
4
|
+
*/
|
|
5
|
+
export interface MarkupTextOptions extends TextOptions {
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A styled text segment produced by the Pango markup parser.
|
|
9
|
+
* Each segment is a leaf span of text sharing the same style.
|
|
10
|
+
*/
|
|
11
|
+
export interface StyledTextSegment {
|
|
12
|
+
/** The text content (no markup) */
|
|
13
|
+
text: string;
|
|
14
|
+
/** CSS font-family */
|
|
15
|
+
fontFamily: string | null;
|
|
16
|
+
/** Font size in CSS pixels (before RESOLUTION_SCALE) */
|
|
17
|
+
fontSize: number | null;
|
|
18
|
+
/** Font weight: 'normal', 'bold', or numeric 100-900 */
|
|
19
|
+
fontWeight: string | number | null;
|
|
20
|
+
/** Font style: 'normal' | 'italic' | 'oblique' */
|
|
21
|
+
fontStyle: string | null;
|
|
22
|
+
/** Foreground (fill) color as CSS string */
|
|
23
|
+
color: string | null;
|
|
24
|
+
/** Background color as CSS string (drawn as rect behind text) */
|
|
25
|
+
backgroundColor: string | null;
|
|
26
|
+
/** Draw underline decoration */
|
|
27
|
+
underline: boolean;
|
|
28
|
+
/** Draw strikethrough decoration */
|
|
29
|
+
strikethrough: boolean;
|
|
30
|
+
/** Vertical offset factor for super/subscript. 0 = normal, negative = super, positive = sub */
|
|
31
|
+
baselineShift: number;
|
|
32
|
+
/** Font size scale relative to parent (1 = same). Used for <big>/<small>/<sup>/<sub> */
|
|
33
|
+
relativeScale: number;
|
|
34
|
+
/** CSS font-variant (e.g. 'small-caps') */
|
|
35
|
+
fontVariant: string | null;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* MarkupText - A text mobject with Pango-like XML markup support
|
|
39
|
+
*
|
|
40
|
+
* Supports rich inline formatting via XML tags modelled after Pango markup
|
|
41
|
+
* (the same format used by Python manim's MarkupText).
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* // Bold and italic
|
|
46
|
+
* const text = new MarkupText({
|
|
47
|
+
* text: '<b>Bold</b> and <i>Italic</i> text'
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* // Colored text with span
|
|
51
|
+
* const colored = new MarkupText({
|
|
52
|
+
* text: '<span foreground="red">Red</span> and <span color="#00ff00">Green</span>'
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* // Nested formatting
|
|
56
|
+
* const nested = new MarkupText({
|
|
57
|
+
* text: '<b><i>Bold Italic</i></b> with <u>underline</u>'
|
|
58
|
+
* });
|
|
59
|
+
*
|
|
60
|
+
* // Complex span attributes
|
|
61
|
+
* const complex = new MarkupText({
|
|
62
|
+
* text: '<span font_family="Courier" font_size="24" color="yellow" weight="bold">Custom</span> text'
|
|
63
|
+
* });
|
|
64
|
+
*
|
|
65
|
+
* // Superscript and subscript
|
|
66
|
+
* const math = new MarkupText({
|
|
67
|
+
* text: 'x<sup>2</sup> + y<sub>i</sub>'
|
|
68
|
+
* });
|
|
69
|
+
*
|
|
70
|
+
* // Size variations
|
|
71
|
+
* const sizes = new MarkupText({
|
|
72
|
+
* text: '<big>Big</big> Normal <small>Small</small>'
|
|
73
|
+
* });
|
|
74
|
+
*
|
|
75
|
+
* // Strikethrough
|
|
76
|
+
* const strike = new MarkupText({
|
|
77
|
+
* text: '<s>deleted</s> replaced'
|
|
78
|
+
* });
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* Also supports the legacy Markdown-style syntax (**bold**, *italic*, `code`)
|
|
82
|
+
* for backward compatibility when no XML tags are detected.
|
|
83
|
+
*/
|
|
84
|
+
export declare class MarkupText extends Text {
|
|
85
|
+
/** Parsed styled text segments */
|
|
86
|
+
protected _styledSegments: StyledTextSegment[];
|
|
87
|
+
/** Code / monospace font family */
|
|
88
|
+
protected _codeFontFamily: string;
|
|
89
|
+
constructor(options: MarkupTextOptions);
|
|
90
|
+
/**
|
|
91
|
+
* Set new text content and re-parse markup
|
|
92
|
+
*/
|
|
93
|
+
setText(text: string): this;
|
|
94
|
+
/**
|
|
95
|
+
* Get the code font family
|
|
96
|
+
*/
|
|
97
|
+
getCodeFontFamily(): string;
|
|
98
|
+
/**
|
|
99
|
+
* Set the code font family
|
|
100
|
+
* @param family - CSS font family for code / tt text
|
|
101
|
+
* @returns this for chaining
|
|
102
|
+
*/
|
|
103
|
+
setCodeFontFamily(family: string): this;
|
|
104
|
+
/**
|
|
105
|
+
* Get the parsed styled segments (useful for inspection / testing)
|
|
106
|
+
*/
|
|
107
|
+
getStyledSegments(): readonly StyledTextSegment[];
|
|
108
|
+
/**
|
|
109
|
+
* Parse the markup text into styled segments.
|
|
110
|
+
*
|
|
111
|
+
* If the text contains Pango-like XML tags, use the XML parser.
|
|
112
|
+
* Otherwise fall back to legacy Markdown-style parsing for backward compat.
|
|
113
|
+
*/
|
|
114
|
+
protected _parseMarkup(): void;
|
|
115
|
+
/**
|
|
116
|
+
* Parse Pango-like XML markup
|
|
117
|
+
*/
|
|
118
|
+
protected _parsePangoMarkup(text: string): void;
|
|
119
|
+
/**
|
|
120
|
+
* Legacy Markdown-style parsing (**bold**, *italic*, `code`)
|
|
121
|
+
* for backward compatibility.
|
|
122
|
+
*/
|
|
123
|
+
protected _parseLegacyMarkup(text: string): void;
|
|
124
|
+
/**
|
|
125
|
+
* Create a default (unstyled) segment
|
|
126
|
+
*/
|
|
127
|
+
private _makeDefaultSegment;
|
|
128
|
+
/**
|
|
129
|
+
* Resolve a styled segment's effective font size (in CSS pixels, before RESOLUTION_SCALE).
|
|
130
|
+
*/
|
|
131
|
+
protected _resolveSegmentFontSize(seg: StyledTextSegment): number;
|
|
132
|
+
/**
|
|
133
|
+
* Build a CSS font string for a styled segment.
|
|
134
|
+
*/
|
|
135
|
+
protected _buildStyledFontString(seg: StyledTextSegment): string;
|
|
136
|
+
/**
|
|
137
|
+
* Get plain text without markup for compatibility
|
|
138
|
+
*/
|
|
139
|
+
protected _getPlainText(): string;
|
|
140
|
+
/**
|
|
141
|
+
* Split styled segments by newlines into lines of segments.
|
|
142
|
+
*/
|
|
143
|
+
protected _splitStyledSegmentsByLine(): StyledTextSegment[][];
|
|
144
|
+
/**
|
|
145
|
+
* Measure the pixel width of a line of styled segments (after RESOLUTION_SCALE).
|
|
146
|
+
*/
|
|
147
|
+
protected _measureStyledLineWidth(segments: StyledTextSegment[]): number;
|
|
148
|
+
/**
|
|
149
|
+
* Get the maximum effective font size in a line (for line height calculation).
|
|
150
|
+
*/
|
|
151
|
+
protected _maxFontSizeInLine(segments: StyledTextSegment[]): number;
|
|
152
|
+
protected _measureText(): {
|
|
153
|
+
lines: string[];
|
|
154
|
+
width: number;
|
|
155
|
+
height: number;
|
|
156
|
+
};
|
|
157
|
+
protected _renderToCanvas(): void;
|
|
158
|
+
protected _createCopy(): MarkupText;
|
|
159
|
+
}
|
|
160
|
+
export default MarkupText;
|
|
161
|
+
//# sourceMappingURL=MarkupText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkupText.d.ts","sourceRoot":"","sources":["../../../src/mobjects/text/MarkupText.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,WAAW;CA+BrD;AAMD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB;IACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,wDAAwD;IACxD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,wDAAwD;IACxD,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACnC,kDAAkD;IAClD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,iEAAiE;IACjE,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,gCAAgC;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,aAAa,EAAE,OAAO,CAAC;IACvB,+FAA+F;IAC/F,aAAa,EAAE,MAAM,CAAC;IACtB,wFAAwF;IACxF,aAAa,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AA0fD;;;;;;;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C;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;cAsClE,eAAe,IAAI,IAAI;cAqIvB,WAAW,IAAI,UAAU;CAiB7C;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { VGroup } from '../../core/VGroup';
|
|
2
|
+
export interface MathJaxRenderOptions {
|
|
3
|
+
/** Display mode (block) vs inline mode. Default: true */
|
|
4
|
+
displayMode?: boolean;
|
|
5
|
+
/** Custom LaTeX preamble (e.g. '\\usepackage{amsmath}'). Merged with defaults. */
|
|
6
|
+
preamble?: string;
|
|
7
|
+
/** Custom macros as { name: expansion }. */
|
|
8
|
+
macros?: Record<string, string>;
|
|
9
|
+
/** Color applied to the output (CSS color string). Default: '#ffffff' */
|
|
10
|
+
color?: string;
|
|
11
|
+
/** Font scale relative to surrounding text (em). Default: 1 */
|
|
12
|
+
fontScale?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface MathJaxRenderResult {
|
|
15
|
+
/** The root SVG element produced by MathJax */
|
|
16
|
+
svgElement: SVGElement;
|
|
17
|
+
/** VMobject group with one child per glyph/path */
|
|
18
|
+
vmobjectGroup: VGroup;
|
|
19
|
+
/** Original SVG string (for debugging or caching) */
|
|
20
|
+
svgString: string;
|
|
21
|
+
/** Bounding width in MathJax "ex" units */
|
|
22
|
+
width: number;
|
|
23
|
+
/** Bounding height in MathJax "ex" units */
|
|
24
|
+
height: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Check whether MathJax has already been loaded.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isMathJaxLoaded(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Pre-load MathJax so the first render is fast.
|
|
32
|
+
* Call this early (e.g. on page load) if you know LaTeX will be used.
|
|
33
|
+
*/
|
|
34
|
+
export declare function preloadMathJax(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Render a LaTeX string to SVG using MathJax and convert the result
|
|
37
|
+
* into VMobject paths suitable for manim-js animation.
|
|
38
|
+
*
|
|
39
|
+
* @param texString - The raw LaTeX to render (without delimiters).
|
|
40
|
+
* @param options - Rendering options.
|
|
41
|
+
* @returns A MathJaxRenderResult containing the SVG element and VMobject group.
|
|
42
|
+
*/
|
|
43
|
+
export declare function renderLatexToSVG(texString: string, options?: MathJaxRenderOptions): Promise<MathJaxRenderResult>;
|
|
44
|
+
/**
|
|
45
|
+
* Quick check: can KaTeX render this LaTeX string without throwing?
|
|
46
|
+
* Used by the 'auto' renderer mode to decide whether to fall back to MathJax.
|
|
47
|
+
*/
|
|
48
|
+
export declare function katexCanRender(texString: string, displayMode?: boolean): boolean;
|
|
49
|
+
//# sourceMappingURL=MathJaxRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MathJaxRenderer.d.ts","sourceRoot":"","sources":["../../../src/mobjects/text/MathJaxRenderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAOhD,MAAM,WAAW,oBAAoB;IACnC,yDAAyD;IACzD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,+CAA+C;IAC/C,UAAU,EAAE,UAAU,CAAC;IACvB,mDAAmD;IACnD,aAAa,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;CAChB;AAgGD;;GAEG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED;;;GAGG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAEpD;AAED;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,mBAAmB,CAAC,CAyG9B;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,UAAO,GAAG,OAAO,CAW7E"}
|