MArraySlidingWindow#
Qualified name: manim\_data\_structures.m\_array.MArraySlidingWindow
- class MArraySlidingWindow(scene, arr, index=0, size=1, label='', label_gap=0.5, label_pos=MArrayDirection.DOWN, mob_window_args={}, mob_label_args={}, **kwargs)[source]#
Bases:
VGroup
A class that represents a sliding window
- Parameters:
scene (
Scene
) – Specifies the scene where the object is to be rendered.arr (
MArray
) – Specifies the array to which the sliding window is to be attached.index (
int
, default:0
) – Specifies the index of the element to which the sliding window is to be attached.size (
int
, default:1
) – Specifies the number of elements the sliding window should enclose.label (
str
, default:''
) – Specifies the value of the sliding window label.label_gap (
float
, default:0.5
) – Specifies the distance between__mob_label
and__mob_window
.label_pos (
MArrayDirection
, default:<MArrayDirection.DOWN: 1>
) – Specifies the position of the pointer w.r.t to__mob_window
.mob_window_args (
dict
, default:{}
) – Arguments forRectangle
that represents the window.mob_label_args (
dict
, default:{}
) – Arguments forText
that represents the window label.**kwargs – Forwarded to constructor of the parent.
- __arr#
The array to which the sliding window is to be attached.
- Type:
- __label_gap#
The distance between
__mob_label
and__mob_window
.- Type:
- __label_pos#
The position of the pointer w.r.t to
__mob_window
.- Type:
- __updater_pos#
The updater function that keeps the sliding window intact with the array.
- Type:
typing.Callable
[[], None]
Methods
Invokes the animate property over label mobject.
Invokes the animate property over window mobject.
Attaches pointer to the specified element.
Fetches the label mobject of the sliding window.
Fetches the window mobject of the sliding window.
Expands or shrinks the window according to the specified size.
Shifts sliding window to the specified element.
Updates the window 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_label()[source]#
Invokes the animate property over label mobject.
- Returns:
Animate property of
__mob_label
.- Return type:
_AnimationBuilder
- animate_mob_window()[source]#
Invokes the animate property over window mobject.
- Returns:
Animate property of
__mob_window
.- Return type:
_AnimationBuilder
- resize_window(size, play_anim=True, play_anim_args={})[source]#
Expands or shrinks the window according to the specified size.
- Parameters:
size (
int
) – Specifies the number of elements the sliding window should enclose.play_anim (
bool
, default:True
) – If True, plays the animation(s).play_anim_args (
dict
, default:{}
) – Arguments forScene.play()
.
- Returns:
Resize animation.
- Return type:
- shift_to_elem(index, play_anim=True, play_anim_args={})[source]#
Shifts sliding window to the specified element.
- Parameters:
index (
int
) – Specifies the index of the element to which the sliding window 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 window label.
- Parameters:
label (
str
) – New value to be assigned to the window label.mob_label_args (
dict
, default:{}
) – Arguments forText
that represents the window label.update_anim (
Animation
, default:<class 'manim.animation.creation.Write'>
) – Animation to be applied to the updated window 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: