MArrayElement#

Qualified name: manim\_data\_structures.m\_array.MArrayElement

class MArrayElement(scene, mob_square_args={}, mob_value_args={}, mob_index_args={}, mob_label_args={}, index_pos=array([0., 1., 0.]), index_gap=0.25, label_pos=array([-1., 0., 0.]), label_gap=0.5, next_to_mob=None, next_to_dir=array([1., 0., 0.]), **kwargs)[source]#

Bases: VGroup

A class that represents an array element.

Parameters:
  • scene (Scene) – Specifies the scene where the object is to be rendered.

  • mob_square_args (dict, default: {}) – Arguments for Square that represents the element body.

  • mob_value_args (dict, default: {}) – Arguments for Text that represents the element value.

  • mob_index_args (dict, default: {}) – Arguments for Text that represents the element index.

  • mob_label_args (dict, default: {}) – Arguments for Text that represents the element label.

  • index_pos (ndarray, default: array([0., 1., 0.])) – Specifies the position of __mob_index w.r.t __mob_square

  • index_gap (float, default: 0.25) – Specifies the distance between __mob_index and __mob_square.

  • label_pos (ndarray, default: array([-1.,  0.,  0.])) – Specifies the position of __mob_label w.r.t __mob_square.

  • label_gap (float, default: 0.5) – Specifies the distance between __mob_label and __mob_square.

  • next_to_mob (Optional[MArrayElement], default: None) – Specifies the placement for __mob_square w.r.t another MArrayElement.

  • next_to_dir (ndarray, default: array([1., 0., 0.])) – Specifies the direction of placement for __mob_square w.r.t another MArrayElement.

__scene#

The scene where the object is to be rendered.

Type:

Scene

__mob_square_props#

Arguments for Square that represents the element body.

Type:

dict

__mob_value_props#

Arguments for Text that represents the element value.

Type:

dict

__mob_index_props#

Arguments for Text that represents the element index.

Type:

dict

__mob_label_props#

Arguments for Text that represents the element label.

Type:

dict

__index_pos#

The position of __mob_index w.r.t __mob_square

Type:

np.ndarray

__index_gap#

The distance between __mob_index and __mob_square.

Type:

float

__label_pos#

The position of __mob_label w.r.t __mob_square.

Type:

np.ndarray

__label_gap#

The distance between __mob_label and __mob_square.

Type:

float

__mob_square#

Represents the body of the element.

Type:

Square

__mob_value#

Represents the value of the element.

Type:

Text

__mob_index#

Represents the index of the element.

Type:

Text

__mob_label#

Represents the label of the element.

Type:

Text

Methods

animate_mob_index

Invokes the animate property over index mobject.

animate_mob_label

Invokes the animate property over label mobject.

animate_mob_square

Invokes the animate property over square mobject.

animate_mob_value

Invokes the animate property over value mobject.

fetch_mob

Fetches the mobject based on the specified enum.

fetch_mob_index

Fetches the index mobject.

fetch_mob_label

Fetches the label mobject.

fetch_mob_square

Fetches the square mobject.

fetch_mob_value

Fetches the value mobject.

update_mob_index

Re-intializes the index mobject.

update_mob_label

Re-intializes the label mobject.

update_mob_value

Re-intializes the value mobject.

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.

n_points_per_curve

sheen_factor

stroke_color

width

The width of the mobject.

animate_mob_index()[source]#

Invokes the animate property over index mobject.

Returns:

Animate property of __mob_index.

Return type:

_AnimationBuilder

animate_mob_label()[source]#

Invokes the animate property over label mobject.

Returns:

Animate property of __mob_label.

Return type:

_AnimationBuilder

animate_mob_square()[source]#

Invokes the animate property over square mobject.

Returns:

Animate property of __mob_square.

Return type:

_AnimationBuilder

animate_mob_value()[source]#

Invokes the animate property over value mobject.

Returns:

Animate property of __mob_value.

Return type:

_AnimationBuilder

fetch_mob(mob_target)[source]#

Fetches the mobject based on the specified enum.

Parameters:

mob_target (MArrayElementComp) – Specifies the Mobject to fetch.

Returns:

Mobject of the class.

Return type:

Mobject

fetch_mob_index()[source]#

Fetches the index mobject.

Returns:

__mob_index.

Return type:

Text

fetch_mob_label()[source]#

Fetches the label mobject.

Returns:

__mob_label.

Return type:

Text

fetch_mob_square()[source]#

Fetches the square mobject.

Returns:

__mob_square.

Return type:

Square

fetch_mob_value()[source]#

Fetches the value mobject.

Returns:

__mob_value.

Return type:

Text

update_mob_index(mob_index_args={}, update_anim=<class 'manim.animation.creation.Write'>, update_anim_args={}, play_anim=True, play_anim_args={})[source]#

Re-intializes the index mobject.

Parameters:
  • mob_index_args (dict, default: {}) – Arguments for Text that represents the element index.

  • update_anim (Animation, default: <class 'manim.animation.creation.Write'>) – Animation to be applied to the updated __mob_index.

  • update_anim_args (dict, default: {}) – Arguments for update Animation.

  • play_anim (bool, default: True) – If True, plays the animation(s).

  • play_anim_args (dict, default: {}) – Arguments for Scene.play().

Returns:

Updated __mob_index.

Return type:

Text

update_mob_label(mob_label_args={}, update_anim=<class 'manim.animation.creation.Write'>, update_anim_args={}, play_anim=True, play_anim_args={})[source]#

Re-intializes the label mobject.

Parameters:
  • mob_label_args (dict, default: {}) – Arguments for Text that represents the element label.

  • update_anim (Animation, default: <class 'manim.animation.creation.Write'>) – Animation to be applied to the updated __mob_label.

  • update_anim_args (dict, default: {}) – Arguments for update Animation.

  • play_anim (bool, default: True) – If True, plays the animation(s).

  • play_anim_args (dict, default: {}) – Arguments for Scene.play().

Returns:

Updated __mob_label.

Return type:

Text

update_mob_value(mob_value_args={}, update_anim=<class 'manim.animation.creation.Write'>, update_anim_args={}, play_anim=True, play_anim_args={})[source]#

Re-intializes the value mobject.

Parameters:
  • mob_value_args (dict, default: {}) – Arguments for Text that represents the element value.

  • update_anim (Animation, default: <class 'manim.animation.creation.Write'>) – Animation to be applied to the updated __mob_value.

  • update_anim_args (dict, default: {}) – Arguments for update Animation.

  • play_anim (bool, default: True) – If True, plays the animation(s).

  • play_anim_args (dict, default: {}) – Arguments for Scene.play().

Returns:

Updated __mob_value.

Return type:

Text