You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"""Similar to :class:`~.AddTextLetterByLetter` , but with an additional cursor mobject at the end.
677
+
678
+
Parameters
679
+
----------
680
+
time_per_char
681
+
Frequency of appearance of the letters.
682
+
cursor
683
+
:class:`~.Mobject` shown after the last added letter.
684
+
buff
685
+
Controls how far away the cursor is to the right of the last added letter.
686
+
keep_cursor_y
687
+
If ``True``, the cursor's y-coordinate is set to the center of the ``Text`` and remains the same throughout the animation. Otherwise, it is set to the center of the last added letter.
688
+
leave_cursor_on
689
+
Whether to show the cursor after the animation.
690
+
kwargs
691
+
Additional arguments to be passed to the :class:`~.AddTextLetterByLetter` constructor.
692
+
693
+
.. tip::
694
+
This is currently only possible for class:`~.Text` and not for class:`~.MathTex`.
695
+
696
+
Examples
697
+
--------
698
+
699
+
.. manim:: TypingAnimation
700
+
701
+
class TypingAnimation(Scene):
702
+
def construct(self):
703
+
text = Text("Typing", color=PURPLE).scale(1.5).to_edge(LEFT)
704
+
cursor = Rectangle(
705
+
color = GREY_A,
706
+
fill_color = GREY_A,
707
+
fill_opacity = 1.0,
708
+
height = 1.1,
709
+
width = 0.5,
710
+
).move_to(text[0]) # Position the cursor
711
+
712
+
self.play(Blink(cursor, how_many_times=2))
713
+
self.play(AddTextLetterByLetterWithCursor(text, cursor, leave_cursor_on=False)) # Turning off the cursor is important
"""Similar to :class:`~.RemoveTextLetterByLetter` , but with an additional cursor mobject at the end.
798
+
799
+
Parameters
800
+
----------
801
+
time_per_char
802
+
Frequency of appearance of the letters.
803
+
cursor
804
+
:class:`~.Mobject` shown after the last added letter.
805
+
buff
806
+
Controls how far away the cursor is to the right of the last added letter.
807
+
keep_cursor_y
808
+
If ``True``, the cursor's y-coordinate is set to the center of the ``Text`` and remains the same throughout the animation. Otherwise, it is set to the center of the last added letter.
809
+
leave_cursor_on
810
+
Whether to show the cursor after the animation.
811
+
kwargs
812
+
Additional arguments to be passed to the :class:`~.AddTextLetterByLetter` constructor.
813
+
814
+
.. tip::
815
+
This is currently only possible for class:`~.Text` and not for class:`~.MathTex`.
816
+
817
+
Examples
818
+
--------
819
+
820
+
.. manim:: TypingAnimation
821
+
822
+
class TypingAnimation(Scene):
823
+
def construct(self):
824
+
text = Text("Typing", color=PURPLE).scale(1.5).to_edge(LEFT)
825
+
cursor = Rectangle(
826
+
color = GREY_A,
827
+
fill_color = GREY_A,
828
+
fill_opacity = 1.0,
829
+
height = 1.1,
830
+
width = 0.5,
831
+
).move_to(text[0]) # Position the cursor
832
+
833
+
self.play(Blink(cursor, how_many_times=2))
834
+
self.play(AddTextLetterByLetterWithCursor(text, cursor, leave_cursor_on=False)) # Turning off the cursor is important
0 commit comments