def construct(self): t_axis = NumberLine() theta_axis = NumberLine().rotate(np.pi / 2) theta_mob = TexMobject("\\theta(t)") t_mob = TexMobject("t") theta_mob.next_to(theta_axis, RIGHT) theta_mob.to_edge(UP) t_mob.next_to(t_axis, UP) t_mob.to_edge(RIGHT) graph = ParametricFunction( lambda t: 4 * t * RIGHT + 2 * smooth(t) * UP) line = Line(graph.points[0], graph.points[-1], color=WHITE) q_mark = TextMobject("?") q_mark.next_to(Point(graph.get_center()), LEFT) stars = Stars(color=BLACK) stars.scale(0.1).shift(q_mark.get_center()) squiggle = ParametricFunction(lambda t: t * RIGHT + 0.2 * t * (5 - t) * (np.sin(t)**2) * UP, start=0, end=5) self.play(ShowCreation(t_axis), ShowCreation(theta_axis), ShimmerIn(theta_mob), ShimmerIn(t_mob)) self.play(ShimmerIn(q_mark), ShowCreation(graph)) self.wait() self.play(Transform(q_mark, stars), Transform(graph, line)) self.wait() self.play(Transform(graph, squiggle)) self.wait()
def construct(self): t_axis = NumberLine() theta_axis = NumberLine().rotate(np.pi/2) theta_mob = TexMobject("\\theta(t)") t_mob = TexMobject("t") theta_mob.next_to(theta_axis, RIGHT) theta_mob.to_edge(UP) t_mob.next_to(t_axis, UP) t_mob.to_edge(RIGHT) graph = ParametricFunction( lambda t : 4*t*RIGHT + 2*smooth(t)*UP ) line = Line(graph.points[0], graph.points[-1], color = WHITE) q_mark = TextMobject("?") q_mark.next_to(Point(graph.get_center()), LEFT) stars = Stars(color = BLACK) stars.scale(0.1).shift(q_mark.get_center()) squiggle = ParametricFunction( lambda t : t*RIGHT + 0.2*t*(5-t)*(np.sin(t)**2)*UP, start = 0, end = 5 ) self.play( ShowCreation(t_axis), ShowCreation(theta_axis), ShimmerIn(theta_mob), ShimmerIn(t_mob) ) self.play( ShimmerIn(q_mark), ShowCreation(graph) ) self.dither() self.play( Transform(q_mark, stars), Transform(graph, line) ) self.dither() self.play(Transform(graph, squiggle)) self.dither()
def construct(self): word = TextMobject(["Bra", "chis", "to", "chrone"]) original_word = word.copy() dots = [] for part in word.split(): if dots: part.next_to(dots[-1], buff=0.06) dot = TexMobject("\\cdot") dot.next_to(part, buff=0.06) dots.append(dot) dots = Mobject(*dots[:-1]) dots.shift(0.1 * DOWN) Mobject(word, dots).center() overbrace1 = Brace(Mobject(*word.split()[:-1]), UP) overbrace2 = Brace(word.split()[-1], UP) shortest = TextMobject("Shortest") shortest.next_to(overbrace1, UP) shortest.highlight(YELLOW) time = TextMobject("Time") time.next_to(overbrace2, UP) time.highlight(YELLOW) chrono_example = TextMobject(""" As in ``Chronological'' \\\\ or ``Synchronize'' """) chrono_example.scale(0.5) chrono_example.to_edge(RIGHT) chrono_example.shift(2 * UP) chrono_example.highlight(BLUE_D) chrono_arrow = Arrow(word.get_right(), chrono_example.get_bottom(), color=BLUE_D) brachy_example = TextMobject("As in . . . brachydactyly?") brachy_example.scale(0.5) brachy_example.to_edge(LEFT) brachy_example.shift(2 * DOWN) brachy_example.highlight(GREEN) brachy_arrow = Arrow(word.get_left(), brachy_example.get_top(), color=GREEN) pronunciation = TextMobject( ["/br", "e", "kist", "e", "kr$\\bar{o}$n/"]) pronunciation.split()[1].rotate_in_place(np.pi) pronunciation.split()[3].rotate_in_place(np.pi) pronunciation.scale(0.7) pronunciation.shift(DOWN) latin = TextMobject(list("Latin")) greek = TextMobject(list("Greek")) for mob in latin, greek: mob.to_edge(LEFT) question_mark = TextMobject("?").next_to(greek, buff=0.1) stars = Stars().highlight(BLACK) stars.scale(0.5).shift(question_mark.get_center()) self.play(Transform(original_word, word), ShowCreation(dots)) self.play(ShimmerIn(pronunciation)) self.dither() self.play(GrowFromCenter(overbrace1), GrowFromCenter(overbrace2)) self.dither() self.play(ShimmerIn(latin)) self.play(FadeIn(question_mark)) self.play(Transform(latin, greek, path_func=counterclockwise_path())) self.dither() self.play(Transform(question_mark, stars)) self.remove(stars) self.dither() self.play(ShimmerIn(shortest)) self.play(ShimmerIn(time)) for ex, ar in [(chrono_example, chrono_arrow), (brachy_example, brachy_arrow)]: self.play(ShowCreation(ar), ShimmerIn(ex)) self.dither()
def construct(self): word = TextMobject(["Bra", "chis", "to", "chrone"]) original_word = word.copy() dots = [] for part in word.split(): if dots: part.next_to(dots[-1], buff = 0.06) dot = TexMobject("\\cdot") dot.next_to(part, buff = 0.06) dots.append(dot) dots = Mobject(*dots[:-1]) dots.shift(0.1*DOWN) Mobject(word, dots).center() overbrace1 = Brace(Mobject(*word.split()[:-1]), UP) overbrace2 = Brace(word.split()[-1], UP) shortest = TextMobject("Shortest") shortest.next_to(overbrace1, UP) shortest.highlight(YELLOW) time = TextMobject("Time") time.next_to(overbrace2, UP) time.highlight(YELLOW) chrono_example = TextMobject(""" As in ``Chronological'' \\\\ or ``Synchronize'' """) chrono_example.scale(0.5) chrono_example.to_edge(RIGHT) chrono_example.shift(2*UP) chrono_example.highlight(BLUE_D) chrono_arrow = Arrow( word.get_right(), chrono_example.get_bottom(), color = BLUE_D ) brachy_example = TextMobject("As in . . . brachydactyly?") brachy_example.scale(0.5) brachy_example.to_edge(LEFT) brachy_example.shift(2*DOWN) brachy_example.highlight(GREEN) brachy_arrow = Arrow( word.get_left(), brachy_example.get_top(), color = GREEN ) pronunciation = TextMobject(["/br", "e", "kist","e","kr$\\bar{o}$n/"]) pronunciation.split()[1].rotate_in_place(np.pi) pronunciation.split()[3].rotate_in_place(np.pi) pronunciation.scale(0.7) pronunciation.shift(DOWN) latin = TextMobject(list("Latin")) greek = TextMobject(list("Greek")) for mob in latin, greek: mob.to_edge(LEFT) question_mark = TextMobject("?").next_to(greek, buff = 0.1) stars = Stars().highlight(BLACK) stars.scale(0.5).shift(question_mark.get_center()) self.play(Transform(original_word, word), ShowCreation(dots)) self.play(ShimmerIn(pronunciation)) self.dither() self.play( GrowFromCenter(overbrace1), GrowFromCenter(overbrace2) ) self.dither() self.play(ShimmerIn(latin)) self.play(FadeIn(question_mark)) self.play(Transform( latin, greek, path_func = counterclockwise_path() )) self.dither() self.play(Transform(question_mark, stars)) self.remove(stars) self.dither() self.play(ShimmerIn(shortest)) self.play(ShimmerIn(time)) for ex, ar in [(chrono_example, chrono_arrow), (brachy_example, brachy_arrow)]: self.play( ShowCreation(ar), ShimmerIn(ex) ) self.dither()