MobjectMatrix#
Qualified name: manim.mobject.matrix.MobjectMatrix
- class MobjectMatrix(matrix, element_to_mobject=<function MobjectMatrix.<lambda>>, **kwargs)[source]#
Bases:
MatrixA mobject that displays a matrix of mobject entries on the screen.
Examples
Example: MobjectMatrixExample ¶
from manim import * class MobjectMatrixExample(Scene): def construct(self): a = Circle().scale(0.3) b = Square().scale(0.3) c = MathTex("\pi").scale(2) d = Star().scale(0.3) m0 = MobjectMatrix([[a, b], [c, d]]) self.add(m0)
- Parameters
matrix – A numpy 2d array or list of lists.
v_buff – Vertical distance between elements, by default 0.8.
h_buff – Horizontal distance between elements, by default 1.3.
bracket_h_buff – Distance of the brackets from the matrix, by default
MED_SMALL_BUFF.bracket_v_buff – Height of the brackets, by default
MED_SMALL_BUFF.add_background_rectangles_to_entries –
Trueif should add backgraound rectangles to entries, by defaultFalse.include_background_rectangle –
Trueif should include background rectangle, by defaultFalse.element_to_mobject – The mobject class used to construct the elements, by default
MathTex.element_to_mobject_config – Additional arguments to be passed to the constructor in
element_to_mobject, by default{}.element_alignment_corner – The corner to which elements are aligned, by default
DR.left_bracket – The left bracket type, by default
"[".right_bracket – The right bracket type, by default
"]".stretch_brackets –
Trueif should stretch the brackets to fit the height of matrix contents, by defaultTrue.bracket_config – Additional arguments to be passed to
MathTexwhen constructing the brackets.
Methods
Attributes
animateUsed to animate the application of any method of
self.animation_overridescolordepthThe 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.