Markable

class manim_eng._base.markable.Markable(**kwargs: Any)

Bases: VMobject

Base class for objects that can have marks attached.

Parameters:

**kwargs (Any) – Keyword arguments to pass on to manim.VMobject.

Attributes

Markable.animate

Used to animate the application of any method of self.

Markable.animation_overrides

Markable.color

Markable.depth

The depth of the mobject.

Markable.fill_color

If there are multiple colors (for gradient) this returns the first one

Markable.height

The height of the mobject.

Markable.n_points_per_curve

Markable.sheen_factor

Markable.stroke_color

Markable.width

The width of the mobject.

add(*mobjects: Mobject) Self

Add mobjects as submobjects.

The mobjects are added to submobjects.

Subclasses of mobject may implement + and += dunder methods.

Parameters:

mobjects – The mobjects to add.

Returns:

self

Return type:

Mobject

Raises:
  • ValueError – When a mobject tries to add itself.

  • TypeError – When trying to add an object that is not an instance of Mobject.

Notes

A mobject cannot contain itself, and it cannot contain a submobject more than once. If the parent mobject is displayed, the newly-added submobjects will also be displayed (i.e. they are automatically added to the parent Scene).

Examples

>>> outer = Mobject()
>>> inner = Mobject()
>>> outer = outer.add(inner)

Duplicates are not added again:

>>> outer = outer.add(inner)
>>> len(outer.submobjects)
1

Only Mobjects can be added:

>>> outer.add(3)
Traceback (most recent call last):
...
TypeError: Only values of type Mobject can be added as submobjects of Mobject, but the value 3 (at index 0) is of type int.

Adding an object to itself raises an error:

>>> outer.add(outer)
Traceback (most recent call last):
...
ValueError: Cannot add Mobject as a submobject of itself (at index 0).

A given mobject cannot be added as a submobject twice to some parent:

>>> parent = Mobject(name="parent")
>>> child = Mobject(name="child")
>>> parent.add(child, child)
[...] WARNING  ...
parent
>>> parent.submobjects
[child]
add_to_back(*mobjects: Mobject) Self

Add all passed mobjects to the back of the submobjects.

If submobjects already contains the given mobjects, they just get moved to the back instead.

Parameters:

mobjects – The mobjects to add.

Returns:

self

Return type:

Mobject

Note

Technically, this is done by adding (or moving) the mobjects to the head of submobjects. The head of this list is rendered first, which places the corresponding mobjects behind the subsequent list members.

Raises:
  • ValueError – When a mobject tries to add itself.

  • TypeError – When trying to add an object that is not an instance of Mobject.

Notes

A mobject cannot contain itself, and it cannot contain a submobject more than once. If the parent mobject is displayed, the newly-added submobjects will also be displayed (i.e. they are automatically added to the parent Scene).

See also

remove(), add()

remove(*mobjects: Mobject) Self

Remove submobjects.

The mobjects are removed from submobjects, if they exist.

Subclasses of mobject may implement - and -= dunder methods.

Parameters:

mobjects – The mobjects to remove.

Returns:

self

Return type:

Mobject

See also

add()

rotate(*args: Any, **kwargs: Any) Self

Rotates the Mobject about a certain point.