manim 0.17.0__py3-none-any.whl → 0.19.1__py3-none-any.whl
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.
- manim/__init__.py +11 -6
- manim/__main__.py +62 -19
- manim/_config/__init__.py +10 -9
- manim/_config/cli_colors.py +26 -9
- manim/_config/default.cfg +1 -3
- manim/_config/logger_utils.py +23 -13
- manim/_config/utils.py +662 -468
- manim/animation/animation.py +164 -18
- manim/animation/changing.py +34 -23
- manim/animation/composition.py +265 -67
- manim/animation/creation.py +208 -26
- manim/animation/fading.py +16 -18
- manim/animation/growing.py +35 -15
- manim/animation/indication.py +150 -76
- manim/animation/movement.py +56 -22
- manim/animation/numbers.py +64 -6
- manim/animation/rotation.py +78 -7
- manim/animation/specialized.py +6 -7
- manim/animation/speedmodifier.py +13 -10
- manim/animation/transform.py +14 -11
- manim/animation/transform_matching_parts.py +3 -4
- manim/animation/updaters/mobject_update_utils.py +152 -30
- manim/animation/updaters/update.py +10 -7
- manim/camera/camera.py +182 -118
- manim/camera/mapping_camera.py +34 -3
- manim/camera/moving_camera.py +95 -74
- manim/camera/multi_camera.py +23 -15
- manim/camera/three_d_camera.py +70 -52
- manim/cli/__init__.py +17 -0
- manim/cli/cfg/group.py +76 -44
- manim/cli/checkhealth/checks.py +192 -0
- manim/cli/checkhealth/commands.py +90 -0
- manim/cli/default_group.py +158 -25
- manim/cli/init/commands.py +33 -25
- manim/cli/plugins/commands.py +16 -3
- manim/cli/render/commands.py +72 -60
- manim/cli/render/ease_of_access_options.py +4 -3
- manim/cli/render/global_options.py +59 -17
- manim/cli/render/output_options.py +6 -5
- manim/cli/render/render_options.py +98 -33
- manim/constants.py +109 -59
- manim/data_structures.py +31 -0
- manim/mobject/frame.py +8 -5
- manim/mobject/geometry/__init__.py +1 -0
- manim/mobject/geometry/arc.py +277 -135
- manim/mobject/geometry/boolean_ops.py +32 -31
- manim/mobject/geometry/labeled.py +376 -0
- manim/mobject/geometry/line.py +192 -87
- manim/mobject/geometry/polygram.py +224 -58
- manim/mobject/geometry/shape_matchers.py +61 -25
- manim/mobject/geometry/tips.py +122 -48
- manim/mobject/graph.py +1027 -419
- manim/mobject/graphing/coordinate_systems.py +533 -278
- manim/mobject/graphing/functions.py +53 -32
- manim/mobject/graphing/number_line.py +123 -65
- manim/mobject/graphing/probability.py +88 -62
- manim/mobject/graphing/scale.py +33 -19
- manim/mobject/logo.py +118 -28
- manim/mobject/matrix.py +87 -83
- manim/mobject/mobject.py +912 -442
- manim/mobject/opengl/dot_cloud.py +16 -5
- manim/mobject/opengl/opengl_compatibility.py +4 -2
- manim/mobject/opengl/opengl_geometry.py +254 -153
- manim/mobject/opengl/opengl_image_mobject.py +3 -1
- manim/mobject/opengl/opengl_mobject.py +779 -482
- manim/mobject/opengl/opengl_point_cloud_mobject.py +41 -14
- manim/mobject/opengl/opengl_surface.py +14 -92
- manim/mobject/opengl/opengl_three_dimensions.py +12 -8
- manim/mobject/opengl/opengl_vectorized_mobject.py +98 -100
- manim/mobject/svg/brace.py +173 -41
- manim/mobject/svg/svg_mobject.py +139 -53
- manim/mobject/table.py +61 -68
- manim/mobject/text/code_mobject.py +193 -539
- manim/mobject/text/numbers.py +81 -34
- manim/mobject/text/tex_mobject.py +130 -78
- manim/mobject/text/text_mobject.py +288 -164
- manim/mobject/three_d/polyhedra.py +111 -13
- manim/mobject/three_d/three_d_utils.py +17 -8
- manim/mobject/three_d/three_dimensions.py +239 -106
- manim/mobject/types/image_mobject.py +50 -30
- manim/mobject/types/point_cloud_mobject.py +120 -75
- manim/mobject/types/vectorized_mobject.py +841 -408
- manim/mobject/value_tracker.py +105 -38
- manim/mobject/vector_field.py +50 -31
- manim/opengl/__init__.py +3 -3
- manim/plugins/__init__.py +14 -1
- manim/plugins/plugins_flags.py +10 -14
- manim/renderer/cairo_renderer.py +65 -50
- manim/renderer/opengl_renderer.py +89 -69
- manim/renderer/opengl_renderer_window.py +39 -18
- manim/renderer/shader.py +123 -87
- manim/renderer/shader_wrapper.py +44 -28
- manim/renderer/vectorized_mobject_rendering.py +38 -10
- manim/scene/moving_camera_scene.py +32 -3
- manim/scene/scene.py +507 -242
- manim/scene/scene_file_writer.py +371 -220
- manim/scene/section.py +20 -16
- manim/scene/three_d_scene.py +14 -22
- manim/scene/vector_space_scene.py +223 -129
- manim/scene/zoomed_scene.py +46 -41
- manim/typing.py +990 -0
- manim/utils/bezier.py +1823 -371
- manim/utils/caching.py +12 -5
- manim/utils/color/AS2700.py +236 -0
- manim/utils/color/BS381.py +318 -0
- manim/utils/color/DVIPSNAMES.py +96 -0
- manim/utils/color/SVGNAMES.py +179 -0
- manim/utils/color/X11.py +533 -0
- manim/utils/color/XKCD.py +952 -0
- manim/utils/color/__init__.py +61 -0
- manim/utils/color/core.py +1667 -0
- manim/utils/color/manim_colors.py +218 -0
- manim/utils/commands.py +48 -20
- manim/utils/config_ops.py +39 -19
- manim/utils/debug.py +8 -7
- manim/utils/deprecation.py +86 -39
- manim/utils/docbuild/__init__.py +17 -0
- manim/utils/docbuild/autoaliasattr_directive.py +236 -0
- manim/utils/docbuild/autocolor_directive.py +99 -0
- manim/utils/docbuild/manim_directive.py +94 -41
- manim/utils/docbuild/module_parsing.py +245 -0
- manim/utils/exceptions.py +6 -0
- manim/utils/family.py +5 -3
- manim/utils/family_ops.py +17 -4
- manim/utils/file_ops.py +27 -17
- manim/utils/hashing.py +55 -45
- manim/utils/images.py +13 -7
- manim/utils/ipython_magic.py +13 -7
- manim/utils/iterables.py +163 -120
- manim/utils/module_ops.py +66 -24
- manim/utils/opengl.py +77 -24
- manim/utils/parameter_parsing.py +32 -0
- manim/utils/paths.py +30 -33
- manim/utils/polylabel.py +235 -0
- manim/utils/qhull.py +218 -0
- manim/utils/rate_functions.py +98 -32
- manim/utils/simple_functions.py +25 -33
- manim/utils/sounds.py +7 -1
- manim/utils/space_ops.py +188 -115
- manim/utils/testing/__init__.py +17 -0
- manim/utils/testing/_frames_testers.py +13 -8
- manim/utils/testing/_show_diff.py +5 -3
- manim/utils/testing/_test_class_makers.py +34 -18
- manim/utils/testing/frames_comparison.py +37 -19
- manim/utils/tex.py +130 -198
- manim/utils/tex_file_writing.py +77 -47
- manim/utils/tex_templates.py +2 -1
- manim/utils/unit.py +6 -5
- {manim-0.17.0.dist-info → manim-0.19.1.dist-info}/METADATA +64 -65
- manim-0.19.1.dist-info/RECORD +220 -0
- {manim-0.17.0.dist-info → manim-0.19.1.dist-info}/WHEEL +1 -1
- manim-0.19.1.dist-info/entry_points.txt +3 -0
- {manim-0.17.0.dist-info → manim-0.19.1.dist-info/licenses}/LICENSE.community +1 -1
- manim/cli/new/group.py +0 -189
- manim/communitycolors.py +0 -9
- manim/gui/__init__.py +0 -0
- manim/gui/gui.py +0 -82
- manim/plugins/import_plugins.py +0 -43
- manim/utils/color.py +0 -552
- manim-0.17.0.dist-info/RECORD +0 -206
- manim-0.17.0.dist-info/entry_points.txt +0 -4
- /manim/cli/{new → checkhealth}/__init__.py +0 -0
- {manim-0.17.0.dist-info → manim-0.19.1.dist-info/licenses}/LICENSE +0 -0
manim/scene/zoomed_scene.py
CHANGED
|
@@ -49,44 +49,49 @@ from __future__ import annotations
|
|
|
49
49
|
|
|
50
50
|
__all__ = ["ZoomedScene"]
|
|
51
51
|
|
|
52
|
+
from typing import TYPE_CHECKING, Any
|
|
52
53
|
|
|
53
54
|
from ..animation.transform import ApplyMethod
|
|
55
|
+
from ..camera.camera import Camera
|
|
54
56
|
from ..camera.moving_camera import MovingCamera
|
|
55
57
|
from ..camera.multi_camera import MultiCamera
|
|
56
58
|
from ..constants import *
|
|
57
59
|
from ..mobject.types.image_mobject import ImageMobjectFromCamera
|
|
60
|
+
from ..renderer.opengl_renderer import OpenGLCamera
|
|
58
61
|
from ..scene.moving_camera_scene import MovingCameraScene
|
|
59
62
|
|
|
63
|
+
if TYPE_CHECKING:
|
|
64
|
+
from manim.typing import Point3DLike, Vector3D
|
|
65
|
+
|
|
60
66
|
# Note, any scenes from old videos using ZoomedScene will almost certainly
|
|
61
67
|
# break, as it was restructured.
|
|
62
68
|
|
|
63
69
|
|
|
64
70
|
class ZoomedScene(MovingCameraScene):
|
|
65
|
-
"""
|
|
66
|
-
This is a Scene with special configurations made for when
|
|
71
|
+
"""This is a Scene with special configurations made for when
|
|
67
72
|
a particular part of the scene must be zoomed in on and displayed
|
|
68
73
|
separately.
|
|
69
74
|
"""
|
|
70
75
|
|
|
71
76
|
def __init__(
|
|
72
77
|
self,
|
|
73
|
-
camera_class=MultiCamera,
|
|
74
|
-
zoomed_display_height=3,
|
|
75
|
-
zoomed_display_width=3,
|
|
76
|
-
zoomed_display_center=None,
|
|
77
|
-
zoomed_display_corner=UP + RIGHT,
|
|
78
|
-
zoomed_display_corner_buff=DEFAULT_MOBJECT_TO_EDGE_BUFFER,
|
|
79
|
-
zoomed_camera_config={
|
|
78
|
+
camera_class: type[Camera] = MultiCamera,
|
|
79
|
+
zoomed_display_height: float = 3,
|
|
80
|
+
zoomed_display_width: float = 3,
|
|
81
|
+
zoomed_display_center: Point3DLike | None = None,
|
|
82
|
+
zoomed_display_corner: Vector3D = UP + RIGHT,
|
|
83
|
+
zoomed_display_corner_buff: float = DEFAULT_MOBJECT_TO_EDGE_BUFFER,
|
|
84
|
+
zoomed_camera_config: dict[str, Any] = {
|
|
80
85
|
"default_frame_stroke_width": 2,
|
|
81
86
|
"background_opacity": 1,
|
|
82
87
|
},
|
|
83
|
-
zoomed_camera_image_mobject_config={},
|
|
84
|
-
zoomed_camera_frame_starting_position=ORIGIN,
|
|
85
|
-
zoom_factor=0.15,
|
|
86
|
-
image_frame_stroke_width=3,
|
|
87
|
-
zoom_activated=False,
|
|
88
|
-
**kwargs,
|
|
89
|
-
):
|
|
88
|
+
zoomed_camera_image_mobject_config: dict[str, Any] = {},
|
|
89
|
+
zoomed_camera_frame_starting_position: Point3DLike = ORIGIN,
|
|
90
|
+
zoom_factor: float = 0.15,
|
|
91
|
+
image_frame_stroke_width: float = 3,
|
|
92
|
+
zoom_activated: bool = False,
|
|
93
|
+
**kwargs: Any,
|
|
94
|
+
) -> None:
|
|
90
95
|
self.zoomed_display_height = zoomed_display_height
|
|
91
96
|
self.zoomed_display_width = zoomed_display_width
|
|
92
97
|
self.zoomed_display_center = zoomed_display_center
|
|
@@ -102,9 +107,8 @@ class ZoomedScene(MovingCameraScene):
|
|
|
102
107
|
self.zoom_activated = zoom_activated
|
|
103
108
|
super().__init__(camera_class=camera_class, **kwargs)
|
|
104
109
|
|
|
105
|
-
def setup(self):
|
|
106
|
-
"""
|
|
107
|
-
This method is used internally by Manim to
|
|
110
|
+
def setup(self) -> None:
|
|
111
|
+
"""This method is used internally by Manim to
|
|
108
112
|
setup the scene for proper use.
|
|
109
113
|
"""
|
|
110
114
|
super().setup()
|
|
@@ -132,10 +136,8 @@ class ZoomedScene(MovingCameraScene):
|
|
|
132
136
|
self.zoomed_camera = zoomed_camera
|
|
133
137
|
self.zoomed_display = zoomed_display
|
|
134
138
|
|
|
135
|
-
def activate_zooming(self, animate: bool = False):
|
|
136
|
-
"""
|
|
137
|
-
This method is used to activate the zooming for
|
|
138
|
-
the zoomed_camera.
|
|
139
|
+
def activate_zooming(self, animate: bool = False) -> None:
|
|
140
|
+
"""This method is used to activate the zooming for the zoomed_camera.
|
|
139
141
|
|
|
140
142
|
Parameters
|
|
141
143
|
----------
|
|
@@ -144,7 +146,7 @@ class ZoomedScene(MovingCameraScene):
|
|
|
144
146
|
of the zoomed camera.
|
|
145
147
|
"""
|
|
146
148
|
self.zoom_activated = True
|
|
147
|
-
self.renderer.camera.add_image_mobject_from_camera(self.zoomed_display)
|
|
149
|
+
self.renderer.camera.add_image_mobject_from_camera(self.zoomed_display) # type: ignore[union-attr]
|
|
148
150
|
if animate:
|
|
149
151
|
self.play(self.get_zoom_in_animation())
|
|
150
152
|
self.play(self.get_zoomed_display_pop_out_animation())
|
|
@@ -153,9 +155,8 @@ class ZoomedScene(MovingCameraScene):
|
|
|
153
155
|
self.zoomed_display,
|
|
154
156
|
)
|
|
155
157
|
|
|
156
|
-
def get_zoom_in_animation(self, run_time: float = 2, **kwargs):
|
|
157
|
-
"""
|
|
158
|
-
Returns the animation of camera zooming in.
|
|
158
|
+
def get_zoom_in_animation(self, run_time: float = 2, **kwargs: Any) -> ApplyMethod:
|
|
159
|
+
"""Returns the animation of camera zooming in.
|
|
159
160
|
|
|
160
161
|
Parameters
|
|
161
162
|
----------
|
|
@@ -170,8 +171,11 @@ class ZoomedScene(MovingCameraScene):
|
|
|
170
171
|
The animation of the camera zooming in.
|
|
171
172
|
"""
|
|
172
173
|
frame = self.zoomed_camera.frame
|
|
173
|
-
|
|
174
|
-
|
|
174
|
+
if isinstance(self.camera, OpenGLCamera):
|
|
175
|
+
full_frame_width, full_frame_height = self.camera.frame_shape
|
|
176
|
+
else:
|
|
177
|
+
full_frame_height = self.camera.frame_height
|
|
178
|
+
full_frame_width = self.camera.frame_width
|
|
175
179
|
frame.save_state()
|
|
176
180
|
frame.stretch_to_fit_width(full_frame_width)
|
|
177
181
|
frame.stretch_to_fit_height(full_frame_height)
|
|
@@ -179,11 +183,9 @@ class ZoomedScene(MovingCameraScene):
|
|
|
179
183
|
frame.set_stroke(width=0)
|
|
180
184
|
return ApplyMethod(frame.restore, run_time=run_time, **kwargs)
|
|
181
185
|
|
|
182
|
-
def get_zoomed_display_pop_out_animation(self, **kwargs):
|
|
183
|
-
"""
|
|
184
|
-
|
|
185
|
-
mini-display that shows the content of the zoomed
|
|
186
|
-
camera.
|
|
186
|
+
def get_zoomed_display_pop_out_animation(self, **kwargs: Any) -> ApplyMethod:
|
|
187
|
+
"""This is the animation of the popping out of the mini-display that
|
|
188
|
+
shows the content of the zoomed camera.
|
|
187
189
|
|
|
188
190
|
Returns
|
|
189
191
|
-------
|
|
@@ -195,15 +197,18 @@ class ZoomedScene(MovingCameraScene):
|
|
|
195
197
|
display.replace(self.zoomed_camera.frame, stretch=True)
|
|
196
198
|
return ApplyMethod(display.restore)
|
|
197
199
|
|
|
198
|
-
def get_zoom_factor(self):
|
|
199
|
-
"""
|
|
200
|
-
|
|
201
|
-
Defined as the ratio between the height of the
|
|
202
|
-
|
|
203
|
-
|
|
200
|
+
def get_zoom_factor(self) -> float:
|
|
201
|
+
"""Returns the Zoom factor of the Zoomed camera.
|
|
202
|
+
|
|
203
|
+
Defined as the ratio between the height of the zoomed camera and
|
|
204
|
+
the height of the zoomed mini display.
|
|
205
|
+
|
|
204
206
|
Returns
|
|
205
207
|
-------
|
|
206
208
|
float
|
|
207
209
|
The zoom factor.
|
|
208
210
|
"""
|
|
209
|
-
|
|
211
|
+
zoom_factor: float = (
|
|
212
|
+
self.zoomed_camera.frame.height / self.zoomed_display.height
|
|
213
|
+
)
|
|
214
|
+
return zoom_factor
|