MCPcopy
hub / github.com/ManimCommunity/manim / Mobject

Class Mobject

manim/mobject/mobject.py:66–3297  ·  view source on GitHub ↗

Mathematical Object: base class for objects that can be displayed on screen. There is a compatibility layer that allows for getting and setting generic attributes with ``get_*`` and ``set_*`` methods. See :meth:`set` for more details. Attributes ---------- submobjects : Lis

Source from the content-addressed store, hash-verified

64
65
66class Mobject:
67 """Mathematical Object: base class for objects that can be displayed on screen.
68
69 There is a compatibility layer that allows for
70 getting and setting generic attributes with ``get_*``
71 and ``set_*`` methods. See :meth:`set` for more details.
72
73 Attributes
74 ----------
75 submobjects : List[:class:`Mobject`]
76 The contained objects.
77 points : :class:`numpy.ndarray`
78 The points of the objects.
79
80 .. seealso::
81
82 :class:`~.VMobject`
83
84 """
85
86 animation_overrides = {}
87
88 @classmethod
89 def __init_subclass__(cls, **kwargs) -> None:
90 super().__init_subclass__(**kwargs)
91
92 cls.animation_overrides: dict[
93 type[Animation],
94 FunctionOverride,
95 ] = {}
96 cls._add_intrinsic_animation_overrides()
97 cls._original__init__ = cls.__init__
98
99 def __init__(
100 self,
101 color: ParsableManimColor | list[ParsableManimColor] = WHITE,
102 name: str | None = None,
103 dim: int = 3,
104 target=None,
105 z_index: float = 0,
106 ) -> None:
107 self.name = self.__class__.__name__ if name is None else name
108 self.dim = dim
109 self.target = target
110 self.z_index = z_index
111 self.point_hash = None
112 self.submobjects = []
113 self.updaters: list[Updater] = []
114 self.updating_suspended = False
115 self.color = ManimColor.parse(color)
116
117 self.reset_points()
118 self.generate_points()
119 self.init_colors()
120
121 def _assert_valid_submobjects(self, submobjects: Iterable[Mobject]) -> Self:
122 """Check that all submobjects are actually instances of
123 :class:`Mobject`, and that none of them is ``self`` (a

Callers 15

test_scene_add_removeFunction · 0.90
test_replaceFunction · 0.90
test_set_colorFunction · 0.90
test_vmobject_addFunction · 0.90
test_vgroup_initFunction · 0.90
test_vgroup_addFunction · 0.90
test_vgroup_add_dunderFunction · 0.90
test_vdict_initFunction · 0.90
test_vdict_addFunction · 0.90
test_mobject_copyFunction · 0.90
test_bracelabel_copyFunction · 0.90
test_familyFunction · 0.90

Calls

no outgoing calls

Tested by 15

test_scene_add_removeFunction · 0.72
test_replaceFunction · 0.72
test_set_colorFunction · 0.72
test_vmobject_addFunction · 0.72
test_vgroup_initFunction · 0.72
test_vgroup_addFunction · 0.72
test_vgroup_add_dunderFunction · 0.72
test_vdict_initFunction · 0.72
test_vdict_addFunction · 0.72
test_mobject_copyFunction · 0.72
test_bracelabel_copyFunction · 0.72
test_familyFunction · 0.72