File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,22 @@ def interpolate_mobject(self, alpha):
140140 def update_submobject_list (self , index ):
141141 self .mobject .submobjects = self .all_submobs [:index ]
142142
143+ class AddTextLetterByLetter (ShowIncreasingSubsets ):
144+ """
145+ Add a Text Object letter by letter on the scene. Use time_per_char to change frequency of appearance of the letters.
146+ """
147+ CONFIG = {
148+ "suspend_mobject_updating" : False ,
149+ "int_func" : np .ceil ,
150+ "rate_func" : linear ,
151+ "time_per_char" : 0.1 ,
152+ }
153+
154+ def __init__ (self , text , ** kwargs ):
155+ digest_config (self , kwargs )
156+
157+ self .run_time = np .max ((0.06 , self .time_per_char )) * len (text ) #Time_per_char must be above 0.06. Otherwise the animation doesn't finish.
158+ super ().__init__ (text , ** kwargs )
143159
144160class ShowSubmobjectsOneByOne (ShowIncreasingSubsets ):
145161 CONFIG = {
You can’t perform that action at this time.
0 commit comments