Brace¶
Qualified name: manim.mobject.svg.brace.Brace
- class Brace(mobject, direction=array([0., -1., 0.]), buff=0.2, sharpness=2, stroke_width=0, fill_opacity=1.0, background_stroke_width=0, background_stroke_color=ManimColor('#000000'), **kwargs)[source]¶
Bases:
VMobjectFromSVGPathTakes a mobject and draws a brace adjacent to it.
Passing a direction vector determines the direction from which the brace is drawn. By default it is drawn from below.
- Parameters:
mobject (Mobject) – The mobject adjacent to which the brace is placed.
direction (Vector3DLike) – The direction from which the brace faces the mobject.
buff (float)
sharpness (float)
stroke_width (float)
fill_opacity (float)
background_stroke_width (float)
background_stroke_color (ParsableManimColor)
kwargs (Any)
See also
Examples
Example: BraceExample ¶
from manim import * class BraceExample(Scene): def construct(self): s = Square() self.add(s) for i in np.linspace(0.1,1.0,4): br = Brace(s, sharpness=i) t = Text(f"sharpness= {i}").next_to(br, RIGHT) self.add(t) self.add(br) VGroup(*self.mobjects).arrange(DOWN, buff=0.2)
class BraceExample(Scene): def construct(self): s = Square() self.add(s) for i in np.linspace(0.1,1.0,4): br = Brace(s, sharpness=i) t = Text(f"sharpness= {i}").next_to(br, RIGHT) self.add(t) self.add(br) VGroup(*self.mobjects).arrange(DOWN, buff=0.2)Methods
Returns the direction from the center to the brace tip.
Places the tex at the brace tip.
Places the text at the brace tip.
Returns the point at the brace tip.
Puts the given mobject at the brace tip.
Attributes
alwaysCall a method on a mobject every frame.
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.
- _original__init__(mobject, direction=array([0., -1., 0.]), buff=0.2, sharpness=2, stroke_width=0, fill_opacity=1.0, background_stroke_width=0, background_stroke_color=ManimColor('#000000'), **kwargs)¶
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
mobject (Mobject)
direction (Vector3DLike)
buff (float)
sharpness (float)
stroke_width (float)
fill_opacity (float)
background_stroke_width (float)
background_stroke_color (ParsableManimColor)
kwargs (Any)
- get_tex(*tex, **kwargs)[source]¶
Places the tex at the brace tip.
- Parameters:
tex (str) – The tex to be placed at the brace tip.
kwargs (Any) – Any further keyword arguments are passed to
put_at_tip()which is used to position the tex at the brace tip.
- Return type:
- get_text(*text, **kwargs)[source]¶
Places the text at the brace tip.
- Parameters:
text (str) – The text to be placed at the brace tip.
kwargs (Any) – Any additional keyword arguments are passed to
put_at_tip()which is used to position the text at the brace tip.
- Return type:
- put_at_tip(mob, use_next_to=True, **kwargs)[source]¶
Puts the given mobject at the brace tip.
- Parameters:
mob (Mobject) – The mobject to be placed at the tip.
use_next_to (bool) – If true, then
next_to()is used to place the mobject at the tip.kwargs (Any) – Any additional keyword arguments are passed to
next_to()which is used to put the mobject next to the brace tip.
- Return type:
Self