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#
- arr
list
, default: [] Array to represent. Elements must be convertible to
str
.- index_offset
int
, default: 1 Difference between successive indices.
- index_start
int
, default: 0 Starting value of index.
- index_hex_display
bool
, default: False Displays indices in hex if True otherwise in decimal.
- hide_index
bool
, default: False Specifies whether to display indices or not.
- arr_dir
m_enum.MArrayDirection
, default:m_enum.MArrayDirection.RIGHT
Specifies the growing direction of array.
- mob_square_args
dict
, default: {} Arguments for
manim.Square
that represents the element body ofMArrayElement
.- mob_value_args
dict
, default: {} Arguments for
manim.Text
that represents the element value ofMArrayElement
.- mob_index_args
dict
, default: {} Arguments for
manim.Text
that represents the element index ofMArrayElement
.- **kwargs
Forwarded to constructor of the parent.
Attributes#
- __arr
list
Array to represent. Elements must be convertible to
str
.- __mob_arrList[
MArrayElement
] Array containing the manim objects.
- __index_offset
int
Difference between successive indices.
- __index_start
int
Starting value of index.
- __index_hex_display
bool
Displays indices in hex if True otherwise in decimal.
- __hide_index
bool
, default: False Specifies whether to display indices or not.
- __arr_dir
m_enum.MArrayDirection
, default:m_enum.MArrayDirection.RIGHT
Specifies the growing direction of array.
Methods
Invokes the
MArrayElement.animate()
property ofMArrayElement
on specified index of__mob_arr
.Invokes the
manim.Text.animate()
property ofmanim.Text
on specified index of__mob_arr
.Invokes the
manim.Square.animate()
property ofmanim.Square
on specified index of__mob_arr
.Invokes the
manim.Text.animate()
property ofmanim.Text
on specified index of__mob_arr
.Appends the value to
__arr
and creates a newMArrayElement
and appends it to__mob_arr
.Fetches
__arr
.Fetches
__mob_arr
.Updates the elements index.
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 ofMArrayElement
on specified index of__mob_arr
.Parameters#
- index
int
Index of
__mob_arr
to animate.
Returns#
_AnimationBuilder
Value returned by
MArrayElement.animate()
property ofMArrayElement
.
- index
- animate_elem_index(index: int) _AnimationBuilder #
Invokes the
manim.Text.animate()
property ofmanim.Text
on specified index of__mob_arr
.Parameters#
- index
int
Index of
__mob_arr
to animate.
Returns#
_AnimationBuilder
Value returned by
manim.Text.animate()
property ofmanim.Text
.
- index
- animate_elem_square(index: int) _AnimationBuilder #
Invokes the
manim.Square.animate()
property ofmanim.Square
on specified index of__mob_arr
.Parameters#
- index
int
Index of
__mob_arr
to animate.
Returns#
_AnimationBuilder
Value returned by
manim.Square.animate()
property ofmanim.Square
.
- index
- animate_elem_value(index: int) _AnimationBuilder #
Invokes the
manim.Text.animate()
property ofmanim.Text
on specified index of__mob_arr
.Parameters#
- index
int
Index of
__mob_arr
to animate.
Returns#
_AnimationBuilder
Value returned by
manim.Text.animate()
property ofmanim.Text
.
- index
- append_elem(value, mob_square_args: dict = {}, mob_value_args: dict = {}, mob_index_args: dict = {}) MArrayElement #
Appends the value to
__arr
and creates a newMArrayElement
and appends it to__mob_arr
.Parameters#
- value
Value to append.
- mob_square_args
dict
, default: {} Arguments for
manim.Square
that represents the element body ofMArrayElement
.- mob_value_args
dict
, default: {} Arguments for
manim.Text
that represents the element value ofMArrayElement
.- mob_index_args
dict
, default: {} Arguments for
manim.Text
that represents the element index ofMArrayElement
.
Returns#
MArrayElement
Represents the appended element.
- fetch_mob_arr() List[MArrayElement] #
Fetches
__mob_arr
.Returns#
- List[
MArrayElement
] Represents the array stored in
__mob_arr
.
- List[
- update_elem_index(index: int, value, mob_index_args: dict = {}) Text #
Updates the elements index.
Parameters#
- index
int
Index of
__mob_arr
to update.- value
New value to be assigned.
- mob_index_args
dict
, default: {} Arguments for
manim.Text
that represents the element index ofMArrayElement
.
Returns#
manim.Text
Represents the updated element index.
- index
- update_elem_value(index: int, value, mob_value_args: dict = {}) Text #
Updates the elements value.
Parameters#
- index
int
Index of
__mob_arr
to update.- value
New value to be assigned.
- mob_value_args
dict
, default: {} Arguments for
manim.Text
that represents the element value ofMArrayElement
.
Returns#
manim.Text
Represents the updated element value.
- index
- arr