Skip to content

Commit e11fbf1

Browse files
committed
Added an example of the BraceText mobject.
1 parent aba9b44 commit e11fbf1

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

manim/mobject/svg/brace.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,49 @@ def change_brace_label(self, obj, *text, **kwargs):
281281

282282

283283
class BraceText(BraceLabel):
284+
"""Create a brace with a text label attached.
285+
286+
Parameters
287+
----------
288+
obj
289+
The mobject adjacent to which the brace is placed.
290+
text
291+
The label text.
292+
brace_direction
293+
The direction of the brace. By default ``DOWN``.
294+
label_constructor
295+
A class or function used to construct a mobject representing
296+
the label. By default :class:`~.Text`.
297+
font_size
298+
The font size of the label, passed to the ``label_constructor``.
299+
buff
300+
The buffer between the mobject and the brace.
301+
brace_config
302+
Arguments to be passed to :class:`.Brace`.
303+
kwargs
304+
Additional arguments to be passed to :class:`~.VMobject`.
305+
306+
307+
Examples
308+
--------
309+
.. manim:: BraceTextExample
310+
:save_last_frame:
311+
312+
class BraceTextExample(Scene):
313+
def construct(self):
314+
s1 = Square().move_to(2*LEFT)
315+
self.add(s1)
316+
br1 = BraceText(s1, "Label")
317+
self.add(br1)
318+
319+
s2 = Square().move_to(2*RIGHT)
320+
self.add(s2)
321+
br2 = BraceText(s2, "Label")
322+
323+
br2.change_label("new")
324+
self.add(br2)
325+
self.wait(0.1)
326+
"""
284327
def __init__(self, obj, text, label_constructor=Text, **kwargs):
285328
super().__init__(obj, text, label_constructor=label_constructor, **kwargs)
286329

0 commit comments

Comments
 (0)