MArrayPointer#

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

class MArrayPointer(scene, arr, index=0, label='', arrow_len=1, arrow_gap=0.25, label_gap=0.25, pointer_pos=MArrayDirection.DOWN, mob_arrow_args={}, mob_label_args={}, **kwargs)[source]#

Bases: VGroup

A class that represents a pointer.

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

  • arr (MArray) – Specifies the array to which the pointer is to be attached.

  • index (int, default: 0) – Specifies the index of the element to which the pointer is to be attached.

  • label (str, default: '') – Specifies the value of the pointer label.

  • arrow_len (float, default: 1) – Specifies the length of __mob_arrow.

  • arrow_gap (float, default: 0.25) – Specifies the distance between __mob_arrow and __arr.

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

  • pointer_pos (MArrayDirection, default: <MArrayDirection.DOWN: 1>) – Specifies the position of the pointer w.r.t to __arr.

  • mob_arrow_args (dict, default: {}) – Arguments for Arrow that represents the pointer arrow.

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

  • **kwargs – Forwarded to constructor of the parent.

__scene#

The scene where the object is to be rendered.

Type:

Scene

__arr#

The array to which the pointer is attached to.

Type:

List[MArrayElement]

__index#

The index of the element to which the pointer is attached to.

Type:

int

__label#

The value of the pointer label.

Type:

str

__arrow_len#

The length of __mob_arrow.

Type:

float

__arrow_gap#

The distance between __mob_arrow and __arr.

Type:

float

__label_gap#

The distance between __mob_arrow and __mob_label.

Type:

float

__pointer_pos#

The position of the pointer w.r.t to __arr.

Type:

m_enum.MArrayDirection

__mob_arrow_props#

Arguments for Arrow that represents the pointer arrow.

Type:

dict

__mob_label_props#

Arguments for Text that represents the pointer label.

Type:

dict

__mob_arrow#

Represents the arrow of the element.

Type:

Arrow

__mob_label#

Represents the label of the element.

Type:

Text

__updater_pos#

The updater function that keeps the pointer intact with the array.

Type:

typing.Callable[[], None]

Methods

animate_mob_arrow

Invokes the animate property over arrow mobject.

animate_mob_label

Invokes the animate property over label mobject.

attach_to_elem

Attaches pointer to the specified element.

fetch_index

Fetches the index that the pointer is attached to.

fetch_mob_arrow

Fetches the arrow mobject of the pointer.

fetch_mob_label

Fetches the label mobject of the pointer.

shift_to_elem

Shifts pointer to the specified element.

update_mob_label

Updates the pointer label.

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_arrow()[source]#

Invokes the animate property over arrow mobject.

Returns:

Animate property of __mob_arrow.

Return type:

_AnimationBuilder

animate_mob_label()[source]#

Invokes the animate property over label mobject.

Returns:

Animate property of __mob_label.

Return type:

_AnimationBuilder

attach_to_elem(index)[source]#

Attaches pointer to the specified element.

Parameters:

index (int) – Specifies the index of the element to which the pointer is to be attached.

Return type:

None

fetch_index()[source]#

Fetches the index that the pointer is attached to.

Returns:

__index.

Return type:

int

fetch_mob_arrow()[source]#

Fetches the arrow mobject of the pointer.

Returns:

__mob_arrow.

Return type:

Arrow

fetch_mob_label()[source]#

Fetches the label mobject of the pointer.

Returns:

__mob_label.

Return type:

Text

shift_to_elem(index, play_anim=True, play_anim_args={})[source]#

Shifts pointer to the specified element.

Parameters:
  • index (int) – Specifies the index of the element to which the pointer is to be shifted.

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

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

Returns:

Shift animation.

Return type:

ApplyMethod

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

Updates the pointer label.

Parameters:
  • label (str) – New value to be assigned to the pointer label.

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

  • update_anim (Animation, default: <class 'manim.animation.creation.Write'>) – Animation to be applied to the updated pointer 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