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 forArrow
that represents the pointer arrow.mob_label_args (
dict
, default:{}
) – Arguments forText
that represents the pointer label.**kwargs – Forwarded to constructor of the parent.
- __arr#
The array to which the pointer is attached to.
- Type:
- __arrow_len#
The length of
__mob_arrow
.- Type:
- __arrow_gap#
The distance between
__mob_arrow
and__arr
.- Type:
- __label_gap#
The distance between
__mob_arrow
and__mob_label
.- Type:
- __updater_pos#
The updater function that keeps the pointer intact with the array.
- Type:
typing.Callable
[[], None]
Methods
Invokes the animate property over arrow mobject.
Invokes the animate property over label mobject.
Attaches pointer to the specified element.
Fetches the index that the pointer is attached to.
Fetches the arrow mobject of the pointer.
Fetches the label mobject of the pointer.
Shifts pointer to the specified element.
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
- 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 forScene.play()
.
- Returns:
Shift animation.
- Return type:
- 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 forText
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 updateAnimation
.play_anim (
bool
, default:True
) – If True, plays the animation(s).play_anim_args (
dict
, default:{}
) – Arguments forScene.play()
.
- Returns:
Updated
__mob_label
.- Return type: