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.
Files changed (163) hide show
  1. manim/__init__.py +11 -6
  2. manim/__main__.py +62 -19
  3. manim/_config/__init__.py +10 -9
  4. manim/_config/cli_colors.py +26 -9
  5. manim/_config/default.cfg +1 -3
  6. manim/_config/logger_utils.py +23 -13
  7. manim/_config/utils.py +662 -468
  8. manim/animation/animation.py +164 -18
  9. manim/animation/changing.py +34 -23
  10. manim/animation/composition.py +265 -67
  11. manim/animation/creation.py +208 -26
  12. manim/animation/fading.py +16 -18
  13. manim/animation/growing.py +35 -15
  14. manim/animation/indication.py +150 -76
  15. manim/animation/movement.py +56 -22
  16. manim/animation/numbers.py +64 -6
  17. manim/animation/rotation.py +78 -7
  18. manim/animation/specialized.py +6 -7
  19. manim/animation/speedmodifier.py +13 -10
  20. manim/animation/transform.py +14 -11
  21. manim/animation/transform_matching_parts.py +3 -4
  22. manim/animation/updaters/mobject_update_utils.py +152 -30
  23. manim/animation/updaters/update.py +10 -7
  24. manim/camera/camera.py +182 -118
  25. manim/camera/mapping_camera.py +34 -3
  26. manim/camera/moving_camera.py +95 -74
  27. manim/camera/multi_camera.py +23 -15
  28. manim/camera/three_d_camera.py +70 -52
  29. manim/cli/__init__.py +17 -0
  30. manim/cli/cfg/group.py +76 -44
  31. manim/cli/checkhealth/checks.py +192 -0
  32. manim/cli/checkhealth/commands.py +90 -0
  33. manim/cli/default_group.py +158 -25
  34. manim/cli/init/commands.py +33 -25
  35. manim/cli/plugins/commands.py +16 -3
  36. manim/cli/render/commands.py +72 -60
  37. manim/cli/render/ease_of_access_options.py +4 -3
  38. manim/cli/render/global_options.py +59 -17
  39. manim/cli/render/output_options.py +6 -5
  40. manim/cli/render/render_options.py +98 -33
  41. manim/constants.py +109 -59
  42. manim/data_structures.py +31 -0
  43. manim/mobject/frame.py +8 -5
  44. manim/mobject/geometry/__init__.py +1 -0
  45. manim/mobject/geometry/arc.py +277 -135
  46. manim/mobject/geometry/boolean_ops.py +32 -31
  47. manim/mobject/geometry/labeled.py +376 -0
  48. manim/mobject/geometry/line.py +192 -87
  49. manim/mobject/geometry/polygram.py +224 -58
  50. manim/mobject/geometry/shape_matchers.py +61 -25
  51. manim/mobject/geometry/tips.py +122 -48
  52. manim/mobject/graph.py +1027 -419
  53. manim/mobject/graphing/coordinate_systems.py +533 -278
  54. manim/mobject/graphing/functions.py +53 -32
  55. manim/mobject/graphing/number_line.py +123 -65
  56. manim/mobject/graphing/probability.py +88 -62
  57. manim/mobject/graphing/scale.py +33 -19
  58. manim/mobject/logo.py +118 -28
  59. manim/mobject/matrix.py +87 -83
  60. manim/mobject/mobject.py +912 -442
  61. manim/mobject/opengl/dot_cloud.py +16 -5
  62. manim/mobject/opengl/opengl_compatibility.py +4 -2
  63. manim/mobject/opengl/opengl_geometry.py +254 -153
  64. manim/mobject/opengl/opengl_image_mobject.py +3 -1
  65. manim/mobject/opengl/opengl_mobject.py +779 -482
  66. manim/mobject/opengl/opengl_point_cloud_mobject.py +41 -14
  67. manim/mobject/opengl/opengl_surface.py +14 -92
  68. manim/mobject/opengl/opengl_three_dimensions.py +12 -8
  69. manim/mobject/opengl/opengl_vectorized_mobject.py +98 -100
  70. manim/mobject/svg/brace.py +173 -41
  71. manim/mobject/svg/svg_mobject.py +139 -53
  72. manim/mobject/table.py +61 -68
  73. manim/mobject/text/code_mobject.py +193 -539
  74. manim/mobject/text/numbers.py +81 -34
  75. manim/mobject/text/tex_mobject.py +130 -78
  76. manim/mobject/text/text_mobject.py +288 -164
  77. manim/mobject/three_d/polyhedra.py +111 -13
  78. manim/mobject/three_d/three_d_utils.py +17 -8
  79. manim/mobject/three_d/three_dimensions.py +239 -106
  80. manim/mobject/types/image_mobject.py +50 -30
  81. manim/mobject/types/point_cloud_mobject.py +120 -75
  82. manim/mobject/types/vectorized_mobject.py +841 -408
  83. manim/mobject/value_tracker.py +105 -38
  84. manim/mobject/vector_field.py +50 -31
  85. manim/opengl/__init__.py +3 -3
  86. manim/plugins/__init__.py +14 -1
  87. manim/plugins/plugins_flags.py +10 -14
  88. manim/renderer/cairo_renderer.py +65 -50
  89. manim/renderer/opengl_renderer.py +89 -69
  90. manim/renderer/opengl_renderer_window.py +39 -18
  91. manim/renderer/shader.py +123 -87
  92. manim/renderer/shader_wrapper.py +44 -28
  93. manim/renderer/vectorized_mobject_rendering.py +38 -10
  94. manim/scene/moving_camera_scene.py +32 -3
  95. manim/scene/scene.py +507 -242
  96. manim/scene/scene_file_writer.py +371 -220
  97. manim/scene/section.py +20 -16
  98. manim/scene/three_d_scene.py +14 -22
  99. manim/scene/vector_space_scene.py +223 -129
  100. manim/scene/zoomed_scene.py +46 -41
  101. manim/typing.py +990 -0
  102. manim/utils/bezier.py +1823 -371
  103. manim/utils/caching.py +12 -5
  104. manim/utils/color/AS2700.py +236 -0
  105. manim/utils/color/BS381.py +318 -0
  106. manim/utils/color/DVIPSNAMES.py +96 -0
  107. manim/utils/color/SVGNAMES.py +179 -0
  108. manim/utils/color/X11.py +533 -0
  109. manim/utils/color/XKCD.py +952 -0
  110. manim/utils/color/__init__.py +61 -0
  111. manim/utils/color/core.py +1667 -0
  112. manim/utils/color/manim_colors.py +218 -0
  113. manim/utils/commands.py +48 -20
  114. manim/utils/config_ops.py +39 -19
  115. manim/utils/debug.py +8 -7
  116. manim/utils/deprecation.py +86 -39
  117. manim/utils/docbuild/__init__.py +17 -0
  118. manim/utils/docbuild/autoaliasattr_directive.py +236 -0
  119. manim/utils/docbuild/autocolor_directive.py +99 -0
  120. manim/utils/docbuild/manim_directive.py +94 -41
  121. manim/utils/docbuild/module_parsing.py +245 -0
  122. manim/utils/exceptions.py +6 -0
  123. manim/utils/family.py +5 -3
  124. manim/utils/family_ops.py +17 -4
  125. manim/utils/file_ops.py +27 -17
  126. manim/utils/hashing.py +55 -45
  127. manim/utils/images.py +13 -7
  128. manim/utils/ipython_magic.py +13 -7
  129. manim/utils/iterables.py +163 -120
  130. manim/utils/module_ops.py +66 -24
  131. manim/utils/opengl.py +77 -24
  132. manim/utils/parameter_parsing.py +32 -0
  133. manim/utils/paths.py +30 -33
  134. manim/utils/polylabel.py +235 -0
  135. manim/utils/qhull.py +218 -0
  136. manim/utils/rate_functions.py +98 -32
  137. manim/utils/simple_functions.py +25 -33
  138. manim/utils/sounds.py +7 -1
  139. manim/utils/space_ops.py +188 -115
  140. manim/utils/testing/__init__.py +17 -0
  141. manim/utils/testing/_frames_testers.py +13 -8
  142. manim/utils/testing/_show_diff.py +5 -3
  143. manim/utils/testing/_test_class_makers.py +34 -18
  144. manim/utils/testing/frames_comparison.py +37 -19
  145. manim/utils/tex.py +130 -198
  146. manim/utils/tex_file_writing.py +77 -47
  147. manim/utils/tex_templates.py +2 -1
  148. manim/utils/unit.py +6 -5
  149. {manim-0.17.0.dist-info → manim-0.19.1.dist-info}/METADATA +64 -65
  150. manim-0.19.1.dist-info/RECORD +220 -0
  151. {manim-0.17.0.dist-info → manim-0.19.1.dist-info}/WHEEL +1 -1
  152. manim-0.19.1.dist-info/entry_points.txt +3 -0
  153. {manim-0.17.0.dist-info → manim-0.19.1.dist-info/licenses}/LICENSE.community +1 -1
  154. manim/cli/new/group.py +0 -189
  155. manim/communitycolors.py +0 -9
  156. manim/gui/__init__.py +0 -0
  157. manim/gui/gui.py +0 -82
  158. manim/plugins/import_plugins.py +0 -43
  159. manim/utils/color.py +0 -552
  160. manim-0.17.0.dist-info/RECORD +0 -206
  161. manim-0.17.0.dist-info/entry_points.txt +0 -4
  162. /manim/cli/{new → checkhealth}/__init__.py +0 -0
  163. {manim-0.17.0.dist-info → manim-0.19.1.dist-info/licenses}/LICENSE +0 -0
manim/mobject/table.py CHANGED
@@ -65,9 +65,7 @@ __all__ = [
65
65
 
66
66
 
67
67
  import itertools as it
68
- from typing import Callable, Iterable, Sequence
69
-
70
- from colour import Color
68
+ from collections.abc import Callable, Iterable, Sequence
71
69
 
72
70
  from manim.mobject.geometry.line import Line
73
71
  from manim.mobject.geometry.polygram import Polygon
@@ -76,18 +74,54 @@ from manim.mobject.text.numbers import DecimalNumber, Integer
76
74
  from manim.mobject.text.tex_mobject import MathTex
77
75
  from manim.mobject.text.text_mobject import Paragraph
78
76
 
79
- from .. import config
80
77
  from ..animation.animation import Animation
81
78
  from ..animation.composition import AnimationGroup
82
79
  from ..animation.creation import Create, Write
83
80
  from ..animation.fading import FadeIn
84
81
  from ..mobject.types.vectorized_mobject import VGroup, VMobject
85
- from ..utils.color import BLACK, YELLOW
82
+ from ..utils.color import BLACK, YELLOW, ManimColor, ParsableManimColor
86
83
  from .utils import get_vectorized_mobject_class
87
84
 
88
85
 
89
86
  class Table(VGroup):
90
- """A mobject that displays a table on the screen.
87
+ r"""A mobject that displays a table on the screen.
88
+
89
+ Parameters
90
+ ----------
91
+ table
92
+ A 2D array or list of lists. Content of the table has to be a valid input
93
+ for the callable set in ``element_to_mobject``.
94
+ row_labels
95
+ List of :class:`~.VMobject` representing the labels of each row.
96
+ col_labels
97
+ List of :class:`~.VMobject` representing the labels of each column.
98
+ top_left_entry
99
+ The top-left entry of the table, can only be specified if row and
100
+ column labels are given.
101
+ v_buff
102
+ Vertical buffer passed to :meth:`~.Mobject.arrange_in_grid`, by default 0.8.
103
+ h_buff
104
+ Horizontal buffer passed to :meth:`~.Mobject.arrange_in_grid`, by default 1.3.
105
+ include_outer_lines
106
+ ``True`` if the table should include outer lines, by default False.
107
+ add_background_rectangles_to_entries
108
+ ``True`` if background rectangles should be added to entries, by default ``False``.
109
+ entries_background_color
110
+ Background color of entries if ``add_background_rectangles_to_entries`` is ``True``.
111
+ include_background_rectangle
112
+ ``True`` if the table should have a background rectangle, by default ``False``.
113
+ background_rectangle_color
114
+ Background color of table if ``include_background_rectangle`` is ``True``.
115
+ element_to_mobject
116
+ The :class:`~.Mobject` class applied to the table entries. by default :class:`~.Paragraph`. For common choices, see :mod:`~.text_mobject`/:mod:`~.tex_mobject`.
117
+ element_to_mobject_config
118
+ Custom configuration passed to :attr:`element_to_mobject`, by default {}.
119
+ arrange_in_grid_config
120
+ Dict passed to :meth:`~.Mobject.arrange_in_grid`, customizes the arrangement of the table.
121
+ line_config
122
+ Dict passed to :class:`~.Line`, customizes the lines of the table.
123
+ kwargs
124
+ Additional arguments to be passed to :class:`~.VGroup`.
91
125
 
92
126
  Examples
93
127
  --------
@@ -160,9 +194,9 @@ class Table(VGroup):
160
194
  h_buff: float = 1.3,
161
195
  include_outer_lines: bool = False,
162
196
  add_background_rectangles_to_entries: bool = False,
163
- entries_background_color: Color = BLACK,
197
+ entries_background_color: ParsableManimColor = BLACK,
164
198
  include_background_rectangle: bool = False,
165
- background_rectangle_color: Color = BLACK,
199
+ background_rectangle_color: ParsableManimColor = BLACK,
166
200
  element_to_mobject: Callable[
167
201
  [float | str | VMobject],
168
202
  VMobject,
@@ -172,45 +206,6 @@ class Table(VGroup):
172
206
  line_config: dict = {},
173
207
  **kwargs,
174
208
  ):
175
- """
176
- Parameters
177
- ----------
178
- table
179
- A 2D array or list of lists. Content of the table has to be a valid input
180
- for the callable set in ``element_to_mobject``.
181
- row_labels
182
- List of :class:`~.VMobject` representing the labels of each row.
183
- col_labels
184
- List of :class:`~.VMobject` representing the labels of each column.
185
- top_left_entry
186
- The top-left entry of the table, can only be specified if row and
187
- column labels are given.
188
- v_buff
189
- Vertical buffer passed to :meth:`~.Mobject.arrange_in_grid`, by default 0.8.
190
- h_buff
191
- Horizontal buffer passed to :meth:`~.Mobject.arrange_in_grid`, by default 1.3.
192
- include_outer_lines
193
- ``True`` if the table should include outer lines, by default False.
194
- add_background_rectangles_to_entries
195
- ``True`` if background rectangles should be added to entries, by default ``False``.
196
- entries_background_color
197
- Background color of entries if ``add_background_rectangles_to_entries`` is ``True``.
198
- include_background_rectangle
199
- ``True`` if the table should have a background rectangle, by default ``False``.
200
- background_rectangle_color
201
- Background color of table if ``include_background_rectangle`` is ``True``.
202
- element_to_mobject
203
- The :class:`~.Mobject` class applied to the table entries. by default :class:`~.Paragraph`. For common choices, see :mod:`~.text_mobject`/:mod:`~.tex_mobject`.
204
- element_to_mobject_config
205
- Custom configuration passed to :attr:`element_to_mobject`, by default {}.
206
- arrange_in_grid_config
207
- Dict passed to :meth:`~.Mobject.arrange_in_grid`, customizes the arrangement of the table.
208
- line_config
209
- Dict passed to :class:`~.Line`, customizes the lines of the table.
210
- kwargs
211
- Additional arguments to be passed to :class:`~.VGroup`.
212
- """
213
-
214
209
  self.row_labels = row_labels
215
210
  self.col_labels = col_labels
216
211
  self.top_left_entry = top_left_entry
@@ -220,9 +215,9 @@ class Table(VGroup):
220
215
  self.h_buff = h_buff
221
216
  self.include_outer_lines = include_outer_lines
222
217
  self.add_background_rectangles_to_entries = add_background_rectangles_to_entries
223
- self.entries_background_color = entries_background_color
218
+ self.entries_background_color = ManimColor(entries_background_color)
224
219
  self.include_background_rectangle = include_background_rectangle
225
- self.background_rectangle_color = background_rectangle_color
220
+ self.background_rectangle_color = ManimColor(background_rectangle_color)
226
221
  self.element_to_mobject = element_to_mobject
227
222
  self.element_to_mobject_config = element_to_mobject_config
228
223
  self.arrange_in_grid_config = arrange_in_grid_config
@@ -258,7 +253,7 @@ class Table(VGroup):
258
253
  self,
259
254
  table: Iterable[Iterable[float | str | VMobject]],
260
255
  ) -> list:
261
- """Initilaizes the entries of ``table`` as :class:`~.VMobject`.
256
+ """Initializes the entries of ``table`` as :class:`~.VMobject`.
262
257
 
263
258
  Parameters
264
259
  ----------
@@ -506,7 +501,7 @@ class Table(VGroup):
506
501
  """
507
502
  return VGroup(*(VGroup(*row) for row in self.mob_table))
508
503
 
509
- def set_column_colors(self, *colors: Iterable[Color]) -> Table:
504
+ def set_column_colors(self, *colors: Iterable[ParsableManimColor]) -> Table:
510
505
  """Set individual colors for each column of the table.
511
506
 
512
507
  Parameters
@@ -535,7 +530,7 @@ class Table(VGroup):
535
530
  column.set_color(color)
536
531
  return self
537
532
 
538
- def set_row_colors(self, *colors: Iterable[Color]) -> Table:
533
+ def set_row_colors(self, *colors: Iterable[ParsableManimColor]) -> Table:
539
534
  """Set individual colors for each row of the table.
540
535
 
541
536
  Parameters
@@ -687,7 +682,6 @@ class Table(VGroup):
687
682
  item.set_color(random_bright_color())
688
683
  self.add(table)
689
684
  """
690
-
691
685
  return VGroup(*self.row_labels)
692
686
 
693
687
  def get_col_labels(self) -> VGroup:
@@ -716,7 +710,6 @@ class Table(VGroup):
716
710
  item.set_color(random_bright_color())
717
711
  self.add(table)
718
712
  """
719
-
720
713
  return VGroup(*self.col_labels)
721
714
 
722
715
  def get_labels(self) -> VGroup:
@@ -754,10 +747,10 @@ class Table(VGroup):
754
747
  label_group.add(*label)
755
748
  return label_group
756
749
 
757
- def add_background_to_entries(self, color: Color = BLACK) -> Table:
750
+ def add_background_to_entries(self, color: ParsableManimColor = BLACK) -> Table:
758
751
  """Adds a black :class:`~.BackgroundRectangle` to each entry of the table."""
759
752
  for mob in self.get_entries():
760
- mob.add_background_rectangle(color=color)
753
+ mob.add_background_rectangle(color=ManimColor(color))
761
754
  return self
762
755
 
763
756
  def get_cell(self, pos: Sequence[int] = (1, 1), **kwargs) -> Polygon:
@@ -818,7 +811,7 @@ class Table(VGroup):
818
811
  return rec
819
812
 
820
813
  def get_highlighted_cell(
821
- self, pos: Sequence[int] = (1, 1), color: Color = YELLOW, **kwargs
814
+ self, pos: Sequence[int] = (1, 1), color: ParsableManimColor = YELLOW, **kwargs
822
815
  ) -> BackgroundRectangle:
823
816
  """Returns a :class:`~.BackgroundRectangle` of the cell at the given position.
824
817
 
@@ -850,11 +843,11 @@ class Table(VGroup):
850
843
  self.add(table)
851
844
  """
852
845
  cell = self.get_cell(pos)
853
- bg_cell = BackgroundRectangle(cell, color=color, **kwargs)
846
+ bg_cell = BackgroundRectangle(cell, color=ManimColor(color), **kwargs)
854
847
  return bg_cell
855
848
 
856
849
  def add_highlighted_cell(
857
- self, pos: Sequence[int] = (1, 1), color: Color = YELLOW, **kwargs
850
+ self, pos: Sequence[int] = (1, 1), color: ParsableManimColor = YELLOW, **kwargs
858
851
  ) -> Table:
859
852
  """Highlights one cell at a specific position on the table by adding a :class:`~.BackgroundRectangle`.
860
853
 
@@ -884,7 +877,7 @@ class Table(VGroup):
884
877
  table.add_highlighted_cell((2,2), color=GREEN)
885
878
  self.add(table)
886
879
  """
887
- bg_cell = self.get_highlighted_cell(pos, color=color, **kwargs)
880
+ bg_cell = self.get_highlighted_cell(pos, color=ManimColor(color), **kwargs)
888
881
  self.add_to_back(bg_cell)
889
882
  entry = self.get_entries(pos)
890
883
  entry.background_rectangle = bg_cell
@@ -1071,7 +1064,7 @@ class MobjectTable(Table):
1071
1064
 
1072
1065
 
1073
1066
  class IntegerTable(Table):
1074
- """A specialized :class:`~.Table` mobject for use with :class:`~.Integer`.
1067
+ r"""A specialized :class:`~.Table` mobject for use with :class:`~.Integer`.
1075
1068
 
1076
1069
  Examples
1077
1070
  --------
@@ -1085,14 +1078,14 @@ class IntegerTable(Table):
1085
1078
  [[0,30,45,60,90],
1086
1079
  [90,60,45,30,0]],
1087
1080
  col_labels=[
1088
- MathTex("\\\\frac{\\sqrt{0}}{2}"),
1089
- MathTex("\\\\frac{\\sqrt{1}}{2}"),
1090
- MathTex("\\\\frac{\\sqrt{2}}{2}"),
1091
- MathTex("\\\\frac{\\sqrt{3}}{2}"),
1092
- MathTex("\\\\frac{\\sqrt{4}}{2}")],
1093
- row_labels=[MathTex("\\sin"), MathTex("\\cos")],
1081
+ MathTex(r"\frac{\sqrt{0}}{2}"),
1082
+ MathTex(r"\frac{\sqrt{1}}{2}"),
1083
+ MathTex(r"\frac{\sqrt{2}}{2}"),
1084
+ MathTex(r"\frac{\sqrt{3}}{2}"),
1085
+ MathTex(r"\frac{\sqrt{4}}{2}")],
1086
+ row_labels=[MathTex(r"\sin"), MathTex(r"\cos")],
1094
1087
  h_buff=1,
1095
- element_to_mobject_config={"unit": "^{\\circ}"})
1088
+ element_to_mobject_config={"unit": r"^{\circ}"})
1096
1089
  self.add(t0)
1097
1090
  """
1098
1091