def construct(self): number_line = NumberLine(x_min=-2, x_max=2) text_1 = TextMobject("Theorem of") \ .next_to(number_line, DOWN) text_2 = TextMobject("Beethoven") \ .next_to(number_line, DOWN) dashed_line = DashedLine( number_line.get_left(), number_line.get_right(), color=YELLOW, ).set_stroke(width=11) self.add(number_line, text_1) self.play( LaggedStart(*[ ShowCreationThenDestruction(dashed_segment) for dashed_segment in dashed_line ], run_time=5), AnimationGroup(Animation(Mobject(), run_time=2.1), ReplacementTransform(text_1, text_2), lag_ratio=1)) self.wait()
def construct(self): number_line = NumberLine(x_min=-2, x_max=2) text = TextMobject("Text") \ .next_to(number_line, DOWN) dashed_line = DashedLine( number_line.get_left(), number_line.get_right(), color=YELLOW, ).set_stroke(width=11) self.add(number_line) self.wait(0.3) self.play( LaggedStart(*[ ShowCreationThenDestruction(dashed_segment) for dashed_segment in dashed_line ], run_time=5), AnimationGroup(Animation(Mobject(), run_time=2.1), Write(text), lag_ratio=1)) self.wait()