MArray#

Qualified name: manim\_data\_structures.array.MArray

class manim_data_structures.array.MArray(arr: list = [], index_offset: int = 1, index_start: int = 0, index_hex_display: bool = False, hide_index: bool = False, arr_dir: MArrayDirection = MArrayDirection.RIGHT, switch_index_pos: bool = False, mob_square_args: dict = {}, mob_value_args: dict = {}, mob_index_args: dict = {}, **kwargs)#

Bases: VGroup

A class that represents an array.

Parameters#

arrlist, default: []

Array to represent. Elements must be convertible to str.

index_offsetint, default: 1

Difference between successive indices.

index_startint, default: 0

Starting value of index.

index_hex_displaybool, default: False

Displays indices in hex if True otherwise in decimal.

hide_indexbool, default: False

Specifies whether to display indices or not.

arr_dirm_enum.MArrayDirection, default: m_enum.MArrayDirection.RIGHT

Specifies the growing direction of array.

mob_square_argsdict, default: {}

Arguments for manim.Square that represents the element body of MArrayElement.

mob_value_argsdict, default: {}

Arguments for manim.Text that represents the element value of MArrayElement.

mob_index_argsdict, default: {}

Arguments for manim.Text that represents the element index of MArrayElement.

**kwargs

Forwarded to constructor of the parent.

Attributes#

__arrlist

Array to represent. Elements must be convertible to str.

__mob_arrList[MArrayElement]

Array containing the manim objects.

__index_offsetint

Difference between successive indices.

__index_startint

Starting value of index.

__index_hex_displaybool

Displays indices in hex if True otherwise in decimal.

__hide_indexbool, default: False

Specifies whether to display indices or not.

__arr_dirm_enum.MArrayDirection, default: m_enum.MArrayDirection.RIGHT

Specifies the growing direction of array.

Methods

animate_elem

Invokes the MArrayElement.animate() property of MArrayElement on specified index of __mob_arr.

animate_elem_index

Invokes the manim.Text.animate() property of manim.Text on specified index of __mob_arr.

animate_elem_square

Invokes the manim.Square.animate() property of manim.Square on specified index of __mob_arr.

animate_elem_value

Invokes the manim.Text.animate() property of manim.Text on specified index of __mob_arr.

append_elem

Appends the value to __arr and creates a new MArrayElement and appends it to __mob_arr.

fetch_arr

Fetches __arr.

fetch_mob_arr

Fetches __mob_arr.

update_elem_index

Updates the elements index.

update_elem_value

Updates the elements value.

Inherited Attributes

animate

Used to animate the application of any method of self.

color

depth

The depth of the mobject.

fill_color

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

height

The height of the mobject.

sheen_factor

stroke_color

width

The width of the mobject.

animate_elem(index: int) _AnimationBuilder#

Invokes the MArrayElement.animate() property of MArrayElement on specified index of __mob_arr.

Parameters#

indexint

Index of __mob_arr to animate.

Returns#

_AnimationBuilder

Value returned by MArrayElement.animate() property of MArrayElement.

animate_elem_index(index: int) _AnimationBuilder#

Invokes the manim.Text.animate() property of manim.Text on specified index of __mob_arr.

Parameters#

indexint

Index of __mob_arr to animate.

Returns#

_AnimationBuilder

Value returned by manim.Text.animate() property of manim.Text.

animate_elem_square(index: int) _AnimationBuilder#

Invokes the manim.Square.animate() property of manim.Square on specified index of __mob_arr.

Parameters#

indexint

Index of __mob_arr to animate.

Returns#

_AnimationBuilder

Value returned by manim.Square.animate() property of manim.Square.

animate_elem_value(index: int) _AnimationBuilder#

Invokes the manim.Text.animate() property of manim.Text on specified index of __mob_arr.

Parameters#

indexint

Index of __mob_arr to animate.

Returns#

_AnimationBuilder

Value returned by manim.Text.animate() property of manim.Text.

append_elem(value, mob_square_args: dict = {}, mob_value_args: dict = {}, mob_index_args: dict = {}) MArrayElement#

Appends the value to __arr and creates a new MArrayElement and appends it to __mob_arr.

Parameters#

value

Value to append.

mob_square_argsdict, default: {}

Arguments for manim.Square that represents the element body of MArrayElement.

mob_value_argsdict, default: {}

Arguments for manim.Text that represents the element value of MArrayElement.

mob_index_argsdict, default: {}

Arguments for manim.Text that represents the element index of MArrayElement.

Returns#

MArrayElement

Represents the appended element.

fetch_arr() list#

Fetches __arr.

Returns#

list

Represents the array stored in __arr.

fetch_mob_arr() List[MArrayElement]#

Fetches __mob_arr.

Returns#

List[MArrayElement]

Represents the array stored in __mob_arr.

update_elem_index(index: int, value, mob_index_args: dict = {}) Text#

Updates the elements index.

Parameters#

indexint

Index of __mob_arr to update.

value

New value to be assigned.

mob_index_argsdict, default: {}

Arguments for manim.Text that represents the element index of MArrayElement.

Returns#

manim.Text

Represents the updated element index.

update_elem_value(index: int, value, mob_value_args: dict = {}) Text#

Updates the elements value.

Parameters#

indexint

Index of __mob_arr to update.

value

New value to be assigned.

mob_value_argsdict, default: {}

Arguments for manim.Text that represents the element value of MArrayElement.

Returns#

manim.Text

Represents the updated element value.