MVariable#
Qualified name: manim\_data\_structures.m\_variable.MVariable
- class MVariable(scene, value='', index='', label='', mob_square_args={}, mob_value_args={'text': 10}, mob_index_args={'text': 0}, mob_label_args={'text': 'Var'}, **kwargs)[source]#
Bases:
MArrayElementA class that represents a variable.
- Parameters:
scene (
Scene) – Specifies the scene where the object is to be rendered.value (
Any, default:'') – Specifies the value of the variable.index (
Union[str,int], default:'') – Specifies the index of the variable.label (
str, default:'') – Specifies the label of the variable.mob_square_args (
dict, default:{}) – Arguments forSquarethat represents the variable body.mob_value_args (
dict, default:{'text': 10}) – Arguments forTextthat represents the variable value.mob_index_args (
dict, default:{'text': 0}) – Arguments forTextthat represents the variable index.mob_label_args (
dict, default:{'text': 'Var'}) – Arguments forTextthat represents the variable label.**kwargs – Forwarded to constructor of the parent.
- __value#
The value of the variable.
- Type:
Any
Methods
Fetches the index of the variable.
Fetches the label of the variable.
Fetches the value of the variable.
Updates the index of the variable.
Updates the label of the variable.
Updates the value of the variable.
Inherited Attributes
animateUsed to animate the application of any method of
self.colordepthThe depth of the mobject.
fill_colorIf there are multiple colors (for gradient) this returns the first one
heightThe height of the mobject.
n_points_per_curvesheen_factorstroke_colorwidthThe width of the mobject.
- update_index(index, mob_index_args={}, update_anim=<class 'manim.animation.indication.Indicate'>, update_anim_args={}, play_anim=True, play_anim_args={})[source]#
Updates the index of the variable.
- Parameters:
index (
Union[str,int]) – New index to be assigned to the variable.mob_index_args (
dict, default:{}) – Arguments forTextthat represents the variable index.update_anim (
Animation, default:<class 'manim.animation.indication.Indicate'>) – Animation to be applied to the updatedText.update_anim_args (
dict, default:{}) – Arguments for the updateAnimation.play_anim (
bool, default:True) – Specifies whether to play theAnimation.play_anim_args (
dict, default:{}) – Arguments forScene.play().
- Returns:
Updated
__index.- Return type:
- update_label(label, mob_label_args={}, update_anim=<class 'manim.animation.indication.Indicate'>, update_anim_args={}, play_anim=True, play_anim_args={})[source]#
Updates the label of the variable.
- Parameters:
label (
str) – New label to be assigned to the variable.mob_value_args – Arguments for
Textthat represents the label value.update_anim (
Animation, default:<class 'manim.animation.indication.Indicate'>) – Animation to be applied to the updatedText.update_anim_args (
dict, default:{}) – Arguments for the updateAnimation.play_anim (
bool, default:True) – Specifies whether to play theAnimation.play_anim_args (
dict, default:{}) – Arguments forScene.play().
- Returns:
Updated
__label.- Return type:
- update_value(value, mob_value_args={'text': 24}, update_anim=<class 'manim.animation.indication.Indicate'>, update_anim_args={}, play_anim=True, play_anim_args={})[source]#
Updates the value of the variable.
- Parameters:
value (
Any) – New value to be assigned to the variable.mob_value_args (
dict, default:{'text': 24}) – Arguments forTextthat represents the variable value.update_anim (
Animation, default:<class 'manim.animation.indication.Indicate'>) – Animation to be applied to the updatedText.update_anim_args (
dict, default:{}) – Arguments for the updateAnimation.play_anim (
bool, default:True) – Specifies whether to play theAnimation.play_anim_args (
dict, default:{}) – Arguments forScene.play().
- Returns:
Updated
__value.- Return type: