manim 0.17.3__py3-none-any.whl → 0.18.0.post0__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.
Potentially problematic release.
This version of manim might be problematic. Click here for more details.
- manim/__init__.py +1 -0
- manim/__main__.py +2 -0
- manim/_config/__init__.py +0 -1
- manim/_config/logger_utils.py +1 -0
- manim/_config/utils.py +14 -5
- manim/animation/changing.py +9 -5
- manim/animation/creation.py +8 -3
- manim/animation/indication.py +4 -4
- manim/animation/speedmodifier.py +2 -4
- manim/animation/updaters/mobject_update_utils.py +134 -16
- manim/camera/camera.py +31 -17
- manim/cli/checkhealth/__init__.py +0 -0
- manim/cli/checkhealth/checks.py +173 -0
- manim/cli/checkhealth/commands.py +81 -0
- manim/cli/render/global_options.py +6 -0
- manim/constants.py +58 -54
- manim/mobject/geometry/__init__.py +1 -0
- manim/mobject/geometry/arc.py +126 -91
- manim/mobject/geometry/boolean_ops.py +6 -10
- manim/mobject/geometry/labeled.py +155 -0
- manim/mobject/geometry/line.py +66 -50
- manim/mobject/geometry/polygram.py +23 -15
- manim/mobject/geometry/shape_matchers.py +24 -15
- manim/mobject/geometry/tips.py +62 -40
- manim/mobject/graph.py +3 -4
- manim/mobject/graphing/coordinate_systems.py +190 -139
- manim/mobject/graphing/number_line.py +5 -2
- manim/mobject/graphing/probability.py +4 -3
- manim/mobject/graphing/scale.py +7 -7
- manim/mobject/logo.py +108 -22
- manim/mobject/matrix.py +33 -37
- manim/mobject/mobject.py +327 -260
- manim/mobject/opengl/opengl_image_mobject.py +1 -1
- manim/mobject/opengl/opengl_mobject.py +18 -12
- manim/mobject/opengl/opengl_point_cloud_mobject.py +1 -1
- manim/mobject/opengl/opengl_surface.py +1 -1
- manim/mobject/opengl/opengl_vectorized_mobject.py +21 -17
- manim/mobject/svg/brace.py +3 -1
- manim/mobject/svg/svg_mobject.py +9 -11
- manim/mobject/table.py +50 -54
- manim/mobject/text/numbers.py +48 -6
- manim/mobject/text/tex_mobject.py +8 -12
- manim/mobject/text/text_mobject.py +32 -24
- manim/mobject/three_d/three_d_utils.py +13 -8
- manim/mobject/three_d/three_dimensions.py +61 -43
- manim/mobject/types/image_mobject.py +5 -4
- manim/mobject/types/point_cloud_mobject.py +8 -6
- manim/mobject/types/vectorized_mobject.py +385 -258
- manim/mobject/vector_field.py +19 -11
- manim/plugins/import_plugins.py +1 -1
- manim/plugins/plugins_flags.py +1 -6
- manim/renderer/shader.py +2 -2
- manim/scene/scene.py +15 -7
- manim/scene/scene_file_writer.py +1 -2
- manim/scene/three_d_scene.py +1 -1
- manim/scene/vector_space_scene.py +17 -7
- manim/typing.py +133 -0
- manim/utils/bezier.py +267 -83
- manim/utils/color/AS2700.py +234 -0
- manim/utils/color/BS381.py +315 -0
- manim/utils/color/X11.py +530 -0
- manim/utils/color/XKCD.py +949 -0
- manim/utils/color/__init__.py +58 -0
- manim/utils/color/core.py +1036 -0
- manim/utils/color/manim_colors.py +220 -0
- manim/utils/docbuild/autocolor_directive.py +92 -0
- manim/utils/docbuild/manim_directive.py +40 -6
- manim/utils/file_ops.py +1 -1
- manim/utils/hashing.py +1 -1
- manim/utils/iterables.py +1 -1
- manim/utils/rate_functions.py +33 -0
- manim/utils/simple_functions.py +0 -18
- manim/utils/space_ops.py +55 -42
- manim/utils/testing/frames_comparison.py +9 -0
- manim/utils/tex.py +2 -0
- manim/utils/tex_file_writing.py +29 -2
- {manim-0.17.3.dist-info → manim-0.18.0.post0.dist-info}/METADATA +14 -14
- {manim-0.17.3.dist-info → manim-0.18.0.post0.dist-info}/RECORD +82 -71
- {manim-0.17.3.dist-info → manim-0.18.0.post0.dist-info}/WHEEL +1 -1
- manim/communitycolors.py +0 -9
- manim/utils/color.py +0 -552
- {manim-0.17.3.dist-info → manim-0.18.0.post0.dist-info}/LICENSE +0 -0
- {manim-0.17.3.dist-info → manim-0.18.0.post0.dist-info}/LICENSE.community +0 -0
- {manim-0.17.3.dist-info → manim-0.18.0.post0.dist-info}/entry_points.txt +0 -0
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
from manim.mobject.opengl.opengl_vectorized_mobject import OpenGLVMobject
|
|
6
|
+
|
|
5
7
|
__all__ = ["NumberLine", "UnitInterval"]
|
|
6
8
|
|
|
7
9
|
|
|
@@ -275,9 +277,10 @@ class NumberLine(Line):
|
|
|
275
277
|
via ``self.ticks``."""
|
|
276
278
|
ticks = VGroup()
|
|
277
279
|
elongated_tick_size = self.tick_size * self.longer_tick_multiple
|
|
280
|
+
elongated_tick_offsets = self.numbers_with_elongated_ticks - self.x_min
|
|
278
281
|
for x in self.get_tick_range():
|
|
279
282
|
size = self.tick_size
|
|
280
|
-
if x
|
|
283
|
+
if np.any(np.isclose(x - self.x_min, elongated_tick_offsets)):
|
|
281
284
|
size = elongated_tick_size
|
|
282
285
|
ticks.add(self.get_tick(x, size))
|
|
283
286
|
self.add(ticks)
|
|
@@ -626,7 +629,7 @@ class NumberLine(Line):
|
|
|
626
629
|
"""
|
|
627
630
|
if label_constructor is None:
|
|
628
631
|
label_constructor = self.label_constructor
|
|
629
|
-
if isinstance(label_tex, VMobject):
|
|
632
|
+
if isinstance(label_tex, (VMobject, OpenGLVMobject)):
|
|
630
633
|
return label_tex
|
|
631
634
|
else:
|
|
632
635
|
return label_constructor(label_tex, **kwargs)
|
|
@@ -8,7 +8,6 @@ __all__ = ["SampleSpace", "BarChart"]
|
|
|
8
8
|
from typing import Iterable, MutableSequence, Sequence
|
|
9
9
|
|
|
10
10
|
import numpy as np
|
|
11
|
-
from colour import Color
|
|
12
11
|
|
|
13
12
|
from manim import config, logger
|
|
14
13
|
from manim.constants import *
|
|
@@ -26,6 +25,7 @@ from manim.utils.color import (
|
|
|
26
25
|
LIGHT_GREY,
|
|
27
26
|
MAROON_B,
|
|
28
27
|
YELLOW,
|
|
28
|
+
ParsableManimColor,
|
|
29
29
|
color_gradient,
|
|
30
30
|
)
|
|
31
31
|
from manim.utils.iterables import tuplify
|
|
@@ -34,7 +34,8 @@ EPSILON = 0.0001
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
class SampleSpace(Rectangle):
|
|
37
|
-
"""
|
|
37
|
+
"""A mobject representing a twodimensional rectangular
|
|
38
|
+
sampling space.
|
|
38
39
|
|
|
39
40
|
Examples
|
|
40
41
|
--------
|
|
@@ -400,7 +401,7 @@ class BarChart(Axes):
|
|
|
400
401
|
|
|
401
402
|
def get_bar_labels(
|
|
402
403
|
self,
|
|
403
|
-
color:
|
|
404
|
+
color: ParsableManimColor | None = None,
|
|
404
405
|
font_size: float = 24,
|
|
405
406
|
buff: float = MED_SMALL_BUFF,
|
|
406
407
|
label_constructor: type[VMobject] = Tex,
|
manim/mobject/graphing/scale.py
CHANGED
|
@@ -14,15 +14,15 @@ if TYPE_CHECKING:
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class _ScaleBase:
|
|
17
|
-
"""Scale baseclass for graphing/functions.
|
|
17
|
+
"""Scale baseclass for graphing/functions.
|
|
18
|
+
|
|
19
|
+
Parameters
|
|
20
|
+
----------
|
|
21
|
+
custom_labels
|
|
22
|
+
Whether to create custom labels when plotted on a :class:`~.NumberLine`.
|
|
23
|
+
"""
|
|
18
24
|
|
|
19
25
|
def __init__(self, custom_labels: bool = False):
|
|
20
|
-
"""
|
|
21
|
-
Parameters
|
|
22
|
-
----------
|
|
23
|
-
custom_labels
|
|
24
|
-
Whether to create custom labels when plotted on a :class:`~.NumberLine`.
|
|
25
|
-
"""
|
|
26
26
|
self.custom_labels = custom_labels
|
|
27
27
|
|
|
28
28
|
def function(self, value: float) -> float:
|
manim/mobject/logo.py
CHANGED
|
@@ -4,19 +4,100 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
__all__ = ["ManimBanner"]
|
|
6
6
|
|
|
7
|
+
import svgelements as se
|
|
8
|
+
|
|
7
9
|
from manim.animation.updaters.update import UpdateFromAlphaFunc
|
|
8
10
|
from manim.mobject.geometry.arc import Circle
|
|
9
11
|
from manim.mobject.geometry.polygram import Square, Triangle
|
|
10
|
-
from manim.mobject.text.tex_mobject import MathTex, Tex
|
|
11
12
|
|
|
13
|
+
from .. import constants as cst
|
|
12
14
|
from ..animation.animation import override_animation
|
|
13
15
|
from ..animation.composition import AnimationGroup, Succession
|
|
14
16
|
from ..animation.creation import Create, SpiralIn
|
|
15
17
|
from ..animation.fading import FadeIn
|
|
16
|
-
from ..
|
|
18
|
+
from ..mobject.svg.svg_mobject import VMobjectFromSVGPath
|
|
17
19
|
from ..mobject.types.vectorized_mobject import VGroup
|
|
18
|
-
from ..utils.rate_functions import ease_in_out_cubic,
|
|
19
|
-
|
|
20
|
+
from ..utils.rate_functions import ease_in_out_cubic, smooth
|
|
21
|
+
|
|
22
|
+
MANIM_SVG_PATHS: list[se.Path] = [
|
|
23
|
+
se.Path( # double stroke letter M
|
|
24
|
+
"M4.64259-2.092154L2.739726-6.625156C2.660025-6.824408 2.650062-6.824408 "
|
|
25
|
+
"2.381071-6.824408H.52802C.348692-6.824408 .199253-6.824408 .199253-6.645"
|
|
26
|
+
"081C.199253-6.475716 .37858-6.475716 .428394-6.475716C.547945-6.475716 ."
|
|
27
|
+
"816936-6.455791 1.036115-6.37609V-1.05604C1.036115-.846824 1.036115-.408"
|
|
28
|
+
"468 .358655-.348692C.169365-.328767 .169365-.18929 .169365-.179328C.1693"
|
|
29
|
+
"65 0 .328767 0 .508095 0H2.052304C2.231631 0 2.381071 0 2.381071-.179328"
|
|
30
|
+
"C2.381071-.268991 2.30137-.33873 2.221669-.348692C1.454545-.408468 1.454"
|
|
31
|
+
"545-.826899 1.454545-1.05604V-6.017435L1.464508-6.027397L3.895392-.20921"
|
|
32
|
+
"5C3.975093-.029888 4.044832 0 4.104608 0C4.224159 0 4.254047-.079701 4.3"
|
|
33
|
+
"03861-.199253L6.744707-6.027397L6.75467-6.017435V-1.05604C6.75467-.84682"
|
|
34
|
+
"4 6.75467-.408468 6.07721-.348692C5.88792-.328767 5.88792-.18929 5.88792"
|
|
35
|
+
"-.179328C5.88792 0 6.047323 0 6.22665 0H8.886675C9.066002 0 9.215442 0 9"
|
|
36
|
+
".215442-.179328C9.215442-.268991 9.135741-.33873 9.05604-.348692C8.28891"
|
|
37
|
+
"7-.408468 8.288917-.826899 8.288917-1.05604V-5.768369C8.288917-5.977584 "
|
|
38
|
+
"8.288917-6.41594 8.966376-6.475716C9.066002-6.485679 9.155666-6.535492 9"
|
|
39
|
+
".155666-6.645081C9.155666-6.824408 9.006227-6.824408 8.826899-6.824408H6"
|
|
40
|
+
".90411C6.645081-6.824408 6.625156-6.824408 6.535492-6.615193L4.64259-2.0"
|
|
41
|
+
"92154ZM4.343711-1.912827C4.423412-1.743462 4.433375-1.733499 4.552927-1."
|
|
42
|
+
"693649L4.11457-.637609H4.094645L1.823163-6.057285C1.77335-6.1868 1.69364"
|
|
43
|
+
"9-6.356164 1.554172-6.475716H2.420922L4.343711-1.912827ZM1.334994-.34869"
|
|
44
|
+
"2H1.165629C1.185554-.37858 1.205479-.408468 1.225405-.428394C1.235367-.4"
|
|
45
|
+
"38356 1.235367-.448319 1.24533-.458281L1.334994-.348692ZM7.103362-6.4757"
|
|
46
|
+
"16H8.159402C7.940224-6.22665 7.940224-5.967621 7.940224-5.788294V-1.0361"
|
|
47
|
+
"15C7.940224-.856787 7.940224-.597758 8.169365-.348692H6.884184C7.103362-"
|
|
48
|
+
".597758 7.103362-.856787 7.103362-1.036115V-6.475716Z"
|
|
49
|
+
),
|
|
50
|
+
se.Path( # letter a
|
|
51
|
+
"M1.464508-4.024907C1.464508-4.234122 1.743462-4.393524 2.092154-4.393524"
|
|
52
|
+
"C2.669988-4.393524 2.929016-4.124533 2.929016-3.516812V-2.789539C1.77335"
|
|
53
|
+
"-2.440847 .249066-2.042341 .249066-.916563C.249066-.308842 .71731 .13947"
|
|
54
|
+
"7 1.354919 .139477C1.92279 .139477 2.381071-.059776 2.929016-.557908C3.0"
|
|
55
|
+
"38605-.049813 3.257783 .139477 3.745953 .139477C4.174346 .139477 4.48318"
|
|
56
|
+
"8-.019925 4.861768-.428394L4.712329-.637609L4.612702-.537983C4.582814-.5"
|
|
57
|
+
"08095 4.552927-.498132 4.503113-.498132C4.363636-.498132 4.293898-.58779"
|
|
58
|
+
"6 4.293898-.747198V-3.347447C4.293898-4.184309 3.536737-4.712329 2.32129"
|
|
59
|
+
"5-4.712329C1.195517-4.712329 .438356-4.204234 .438356-3.457036C.438356-3"
|
|
60
|
+
".048568 .67746-2.799502 1.085928-2.799502C1.484433-2.799502 1.763387-3.0"
|
|
61
|
+
"38605 1.763387-3.377335C1.763387-3.676214 1.464508-3.88543 1.464508-4.02"
|
|
62
|
+
"4907ZM2.919054-.996264C2.650062-.687422 2.450809-.56787 2.211706-.56787C"
|
|
63
|
+
"1.912827-.56787 1.703611-.836862 1.703611-1.235367C1.703611-1.8132 2.122"
|
|
64
|
+
"042-2.231631 2.919054-2.440847V-.996264Z"
|
|
65
|
+
),
|
|
66
|
+
se.Path( # letter n
|
|
67
|
+
"M2.948941-4.044832C3.297634-4.044832 3.466999-3.775841 3.466999-3.217933"
|
|
68
|
+
"V-.806974C3.466999-.438356 3.337484-.278954 2.998755-.239103V0H5.339975V"
|
|
69
|
+
"-.239103C4.951432-.268991 4.851806-.388543 4.851806-.806974V-3.307597C4."
|
|
70
|
+
"851806-4.164384 4.323786-4.712329 3.506849-4.712329C2.909091-4.712329 2."
|
|
71
|
+
"450809-4.433375 2.082192-3.845579V-4.592777H.179328V-4.353674C.617684-4."
|
|
72
|
+
"283935 .707347-4.184309 .707347-3.765878V-.836862C.707347-.418431 .62764"
|
|
73
|
+
"6-.328767 .179328-.239103V0H2.580324V-.239103C2.211706-.288917 2.092154-"
|
|
74
|
+
".438356 2.092154-.806974V-3.466999C2.092154-3.576588 2.530511-4.044832 2"
|
|
75
|
+
".948941-4.044832Z"
|
|
76
|
+
),
|
|
77
|
+
se.Path( # letter i
|
|
78
|
+
"M2.15193-4.592777H.239103V-4.353674C.67746-4.26401 .767123-4.174346 .767"
|
|
79
|
+
"123-3.765878V-.836862C.767123-.428394 .697385-.348692 .239103-.239103V0H"
|
|
80
|
+
"2.6401V-.239103C2.291407-.288917 2.15193-.428394 2.15193-.806974V-4.5927"
|
|
81
|
+
"77ZM1.454545-6.884184C1.026152-6.884184 .67746-6.535492 .67746-6.117061C"
|
|
82
|
+
".67746-5.668742 1.006227-5.339975 1.444583-5.339975S2.221669-5.668742 2."
|
|
83
|
+
"221669-6.107098C2.221669-6.535492 1.882939-6.884184 1.454545-6.884184Z"
|
|
84
|
+
),
|
|
85
|
+
se.Path( # letter m
|
|
86
|
+
"M2.929016-4.044832C3.317559-4.044832 3.466999-3.815691 3.466999-3.217933"
|
|
87
|
+
"V-.806974C3.466999-.398506 3.35741-.268991 2.988792-.239103V0H5.32005V-."
|
|
88
|
+
"239103C4.971357-.278954 4.851806-.428394 4.851806-.806974V-3.466999C4.85"
|
|
89
|
+
"1806-3.576588 5.310087-4.044832 5.69863-4.044832C6.07721-4.044832 6.2266"
|
|
90
|
+
"5-3.805729 6.22665-3.217933V-.806974C6.22665-.388543 6.117061-.268991 5."
|
|
91
|
+
"738481-.239103V0H8.109589V-.239103C7.721046-.259029 7.611457-.37858 7.61"
|
|
92
|
+
"1457-.806974V-3.307597C7.611457-4.164384 7.083437-4.712329 6.266501-4.71"
|
|
93
|
+
"2329C5.69863-4.712329 5.32005-4.483188 4.801993-3.845579C4.503113-4.4732"
|
|
94
|
+
"25 4.154421-4.712329 3.526775-4.712329S2.440847-4.443337 2.062267-3.8455"
|
|
95
|
+
"79V-4.592777H.179328V-4.353674C.617684-4.293898 .707347-4.174346 .707347"
|
|
96
|
+
"-3.765878V-.836862C.707347-.428394 .617684-.318804 .179328-.239103V0H2.5"
|
|
97
|
+
"50436V-.239103C2.201743-.288917 2.092154-.428394 2.092154-.806974V-3.466"
|
|
98
|
+
"999C2.092154-3.58655 2.530511-4.044832 2.929016-4.044832Z"
|
|
99
|
+
),
|
|
100
|
+
]
|
|
20
101
|
|
|
21
102
|
|
|
22
103
|
class ManimBanner(VGroup):
|
|
@@ -67,27 +148,32 @@ class ManimBanner(VGroup):
|
|
|
67
148
|
self.font_color = "#ece6e2" if dark_theme else "#343434"
|
|
68
149
|
self.scale_factor = 1
|
|
69
150
|
|
|
70
|
-
self.M =
|
|
71
|
-
self.M.
|
|
151
|
+
self.M = VMobjectFromSVGPath(MANIM_SVG_PATHS[0]).flip(cst.RIGHT).center()
|
|
152
|
+
self.M.set(stroke_width=0).scale(
|
|
153
|
+
7 * cst.DEFAULT_FONT_SIZE * cst.SCALE_FACTOR_PER_FONT_POINT
|
|
154
|
+
)
|
|
155
|
+
self.M.set_fill(color=self.font_color, opacity=1).shift(
|
|
156
|
+
2.25 * cst.LEFT + 1.5 * cst.UP
|
|
157
|
+
)
|
|
72
158
|
|
|
73
|
-
self.circle = Circle(color=logo_green, fill_opacity=1).shift(LEFT)
|
|
74
|
-
self.square = Square(color=logo_blue, fill_opacity=1).shift(UP)
|
|
75
|
-
self.triangle = Triangle(color=logo_red, fill_opacity=1).shift(RIGHT)
|
|
159
|
+
self.circle = Circle(color=logo_green, fill_opacity=1).shift(cst.LEFT)
|
|
160
|
+
self.square = Square(color=logo_blue, fill_opacity=1).shift(cst.UP)
|
|
161
|
+
self.triangle = Triangle(color=logo_red, fill_opacity=1).shift(cst.RIGHT)
|
|
76
162
|
self.shapes = VGroup(self.triangle, self.square, self.circle)
|
|
77
163
|
self.add(self.shapes, self.M)
|
|
78
|
-
self.move_to(ORIGIN)
|
|
164
|
+
self.move_to(cst.ORIGIN)
|
|
79
165
|
|
|
80
166
|
anim = VGroup()
|
|
81
|
-
for
|
|
82
|
-
tex =
|
|
83
|
-
|
|
84
|
-
|
|
167
|
+
for ind, path in enumerate(MANIM_SVG_PATHS[1:]):
|
|
168
|
+
tex = VMobjectFromSVGPath(path).flip(cst.RIGHT).center()
|
|
169
|
+
tex.set(stroke_width=0).scale(
|
|
170
|
+
cst.DEFAULT_FONT_SIZE * cst.SCALE_FACTOR_PER_FONT_POINT
|
|
85
171
|
)
|
|
86
|
-
if
|
|
172
|
+
if ind > 0:
|
|
87
173
|
tex.next_to(anim, buff=0.01)
|
|
88
|
-
tex.align_to(self.M, DOWN)
|
|
174
|
+
tex.align_to(self.M, cst.DOWN)
|
|
89
175
|
anim.add(tex)
|
|
90
|
-
anim.
|
|
176
|
+
anim.set_fill(color=self.font_color, opacity=1)
|
|
91
177
|
anim.height = m_height_over_anim_height * self.M.height
|
|
92
178
|
|
|
93
179
|
# Note: "anim" is only shown in the expanded state
|
|
@@ -181,7 +267,7 @@ class ManimBanner(VGroup):
|
|
|
181
267
|
m_shape_offset = 6.25 * self.scale_factor
|
|
182
268
|
shape_sliding_overshoot = self.scale_factor * 0.8
|
|
183
269
|
m_anim_buff = 0.06
|
|
184
|
-
self.anim.next_to(self.M, buff=m_anim_buff).align_to(self.M, DOWN)
|
|
270
|
+
self.anim.next_to(self.M, buff=m_anim_buff).align_to(self.M, cst.DOWN)
|
|
185
271
|
self.anim.set_opacity(0)
|
|
186
272
|
self.shapes.save_state()
|
|
187
273
|
m_clone = self.anim[-1].copy()
|
|
@@ -193,7 +279,7 @@ class ManimBanner(VGroup):
|
|
|
193
279
|
|
|
194
280
|
def shift(vector):
|
|
195
281
|
self.shapes.restore()
|
|
196
|
-
left_group.align_to(self.M.saved_state, LEFT)
|
|
282
|
+
left_group.align_to(self.M.saved_state, cst.LEFT)
|
|
197
283
|
if direction == "right":
|
|
198
284
|
self.shapes.shift(vector)
|
|
199
285
|
elif direction == "center":
|
|
@@ -203,13 +289,13 @@ class ManimBanner(VGroup):
|
|
|
203
289
|
left_group.shift(-vector)
|
|
204
290
|
|
|
205
291
|
def slide_and_uncover(mob, alpha):
|
|
206
|
-
shift(alpha * (m_shape_offset + shape_sliding_overshoot) * RIGHT)
|
|
292
|
+
shift(alpha * (m_shape_offset + shape_sliding_overshoot) * cst.RIGHT)
|
|
207
293
|
|
|
208
294
|
# Add letters when they are covered
|
|
209
295
|
for letter in mob.anim:
|
|
210
296
|
if mob.square.get_center()[0] > letter.get_center()[0]:
|
|
211
297
|
letter.set_opacity(1)
|
|
212
|
-
self.
|
|
298
|
+
self.add_to_back(letter)
|
|
213
299
|
|
|
214
300
|
# Finish animation
|
|
215
301
|
if alpha == 1:
|
|
@@ -225,7 +311,7 @@ class ManimBanner(VGroup):
|
|
|
225
311
|
m_clone.move_to(mob.anim[-1])
|
|
226
312
|
mob.anim.set_opacity(1)
|
|
227
313
|
|
|
228
|
-
shift(alpha * shape_sliding_overshoot * LEFT)
|
|
314
|
+
shift(alpha * shape_sliding_overshoot * cst.LEFT)
|
|
229
315
|
|
|
230
316
|
if alpha == 1:
|
|
231
317
|
mob.remove(m_clone)
|
manim/mobject/matrix.py
CHANGED
|
@@ -74,6 +74,39 @@ def matrix_to_mobject(matrix):
|
|
|
74
74
|
class Matrix(VMobject, metaclass=ConvertToOpenGL):
|
|
75
75
|
"""A mobject that displays a matrix on the screen.
|
|
76
76
|
|
|
77
|
+
Parameters
|
|
78
|
+
----------
|
|
79
|
+
matrix
|
|
80
|
+
A numpy 2d array or list of lists.
|
|
81
|
+
v_buff
|
|
82
|
+
Vertical distance between elements, by default 0.8.
|
|
83
|
+
h_buff
|
|
84
|
+
Horizontal distance between elements, by default 1.3.
|
|
85
|
+
bracket_h_buff
|
|
86
|
+
Distance of the brackets from the matrix, by default ``MED_SMALL_BUFF``.
|
|
87
|
+
bracket_v_buff
|
|
88
|
+
Height of the brackets, by default ``MED_SMALL_BUFF``.
|
|
89
|
+
add_background_rectangles_to_entries
|
|
90
|
+
``True`` if should add backgraound rectangles to entries, by default ``False``.
|
|
91
|
+
include_background_rectangle
|
|
92
|
+
``True`` if should include background rectangle, by default ``False``.
|
|
93
|
+
element_to_mobject
|
|
94
|
+
The mobject class used to construct the elements, by default :class:`~.MathTex`.
|
|
95
|
+
element_to_mobject_config
|
|
96
|
+
Additional arguments to be passed to the constructor in ``element_to_mobject``,
|
|
97
|
+
by default ``{}``.
|
|
98
|
+
element_alignment_corner
|
|
99
|
+
The corner to which elements are aligned, by default ``DR``.
|
|
100
|
+
left_bracket
|
|
101
|
+
The left bracket type, by default ``"["``.
|
|
102
|
+
right_bracket
|
|
103
|
+
The right bracket type, by default ``"]"``.
|
|
104
|
+
stretch_brackets
|
|
105
|
+
``True`` if should stretch the brackets to fit the height of matrix contents, by default ``True``.
|
|
106
|
+
bracket_config
|
|
107
|
+
Additional arguments to be passed to :class:`~.MathTex` when constructing
|
|
108
|
+
the brackets.
|
|
109
|
+
|
|
77
110
|
Examples
|
|
78
111
|
--------
|
|
79
112
|
The first example shows a variety of uses of this module while the second example
|
|
@@ -146,43 +179,6 @@ class Matrix(VMobject, metaclass=ConvertToOpenGL):
|
|
|
146
179
|
bracket_config: dict = {},
|
|
147
180
|
**kwargs,
|
|
148
181
|
):
|
|
149
|
-
"""
|
|
150
|
-
|
|
151
|
-
Parameters
|
|
152
|
-
----------
|
|
153
|
-
matrix
|
|
154
|
-
A numpy 2d array or list of lists.
|
|
155
|
-
v_buff
|
|
156
|
-
Vertical distance between elements, by default 0.8.
|
|
157
|
-
h_buff
|
|
158
|
-
Horizontal distance between elements, by default 1.3.
|
|
159
|
-
bracket_h_buff
|
|
160
|
-
Distance of the brackets from the matrix, by default ``MED_SMALL_BUFF``.
|
|
161
|
-
bracket_v_buff
|
|
162
|
-
Height of the brackets, by default ``MED_SMALL_BUFF``.
|
|
163
|
-
add_background_rectangles_to_entries
|
|
164
|
-
``True`` if should add backgraound rectangles to entries, by default ``False``.
|
|
165
|
-
include_background_rectangle
|
|
166
|
-
``True`` if should include background rectangle, by default ``False``.
|
|
167
|
-
element_to_mobject
|
|
168
|
-
The mobject class used to construct the elements, by default :class:`~.MathTex`.
|
|
169
|
-
element_to_mobject_config
|
|
170
|
-
Additional arguments to be passed to the constructor in ``element_to_mobject``,
|
|
171
|
-
by default ``{}``.
|
|
172
|
-
element_alignment_corner
|
|
173
|
-
The corner to which elements are aligned, by default ``DR``.
|
|
174
|
-
left_bracket
|
|
175
|
-
The left bracket type, by default ``"["``.
|
|
176
|
-
right_bracket
|
|
177
|
-
The right bracket type, by default ``"]"``.
|
|
178
|
-
stretch_brackets
|
|
179
|
-
``True`` if should stretch the brackets to fit the height of matrix contents, by default ``True``.
|
|
180
|
-
bracket_config
|
|
181
|
-
Additional arguments to be passed to :class:`~.MathTex` when constructing
|
|
182
|
-
the brackets.
|
|
183
|
-
|
|
184
|
-
"""
|
|
185
|
-
|
|
186
182
|
self.v_buff = v_buff
|
|
187
183
|
self.h_buff = h_buff
|
|
188
184
|
self.bracket_h_buff = bracket_h_buff
|