def construct(self): words = TextMobject([ "Fermat's principle:", """ If a beam of light travels from point $A$ to $B$, it does so along the fastest path possible. """ ]) words.split()[0].highlight(BLUE) everything = MobjectFromRegion(Region()) everything.scale(0.9) angles = np.apply_along_axis(angle_of_vector, 1, everything.points) norms = np.apply_along_axis(np.linalg.norm, 1, everything.points) norms -= np.min(norms) norms /= np.max(norms) alphas = 0.25 + 0.75 * norms * (1 + np.sin(12 * angles)) / 2 everything.rgbs = alphas.repeat(3).reshape((len(alphas), 3)) Mobject(everything, words).show() everything.sort_points(np.linalg.norm) self.add(words) self.play(DelayByOrder(FadeIn(everything, run_time=3)), Animation(words)) self.play(ApplyMethod(everything.highlight, WHITE), ) self.dither()
def construct(self): words = TextMobject([ "One does not simply define the limit \\\\ \ of a sequence of", "curves", "\\dots" ]) top_words = TextMobject(["curves", "are functions"]).to_edge(UP) curves1 = words.split()[1] curves2 = top_words.split()[0] words.ingest_submobjects() number = TexMobject("0.27") pair = TexMobject("(0.53, 0.02)") pair.next_to(number, buff=2) arrow = Arrow(number, pair) Mobject(number, arrow, pair).center().shift(UP) number_line = UnitInterval() number_line.stretch_to_fit_width(5) number_line.to_edge(LEFT).shift(DOWN) grid = Grid(4, 4).scale(0.4) grid.next_to(number_line, buff=2) low_arrow = Arrow(number_line, grid) self.play(ShimmerIn(words)) self.dither() self.play(FadeOut(words), ApplyMethod(curves1.replace, curves2), ShimmerIn(top_words.split()[1])) self.dither() self.play(FadeIn(number)) self.play(ShowCreation(arrow)) self.play(FadeIn(pair)) self.dither() self.play(ShowCreation(number_line)) self.play(ShowCreation(low_arrow)) self.play(ShowCreation(grid)) self.dither()
def construct(self): logo = ImageMobject("LogoGeneration", invert = False) name_mob = TextMobject("3Blue1Brown").center() name_mob.highlight("grey") name_mob.shift(2*DOWN) self.add(name_mob, logo) new_text = TextMobject(["with ", "Steven Strogatz"]) new_text.next_to(name_mob, DOWN) self.play(*[ ShimmerIn(part) for part in new_text.split() ]) self.dither() with_word, steve = new_text.split() steve_copy = steve.copy().center().to_edge(UP) # logo.sort_points(lambda p : -np.linalg.norm(p)) sort_by_color(logo) self.play( Transform(steve, steve_copy), DelayByOrder(Transform(logo, Point())), FadeOut(with_word), FadeOut(name_mob), run_time = 3 )
def construct(self): words = TextMobject([ "Fermat's principle:", """ If a beam of light travels from point $A$ to $B$, it does so along the fastest path possible. """ ]) words.split()[0].highlight(BLUE) everything = MobjectFromRegion(Region()) everything.scale(0.9) angles = np.apply_along_axis( angle_of_vector, 1, everything.points ) norms = np.apply_along_axis( np.linalg.norm, 1, everything.points ) norms -= np.min(norms) norms /= np.max(norms) alphas = 0.25 + 0.75 * norms * (1 + np.sin(12*angles))/2 everything.rgbs = alphas.repeat(3).reshape((len(alphas), 3)) Mobject(everything, words).show() everything.sort_points(np.linalg.norm) self.add(words) self.play( DelayByOrder(FadeIn(everything, run_time = 3)), Animation(words) ) self.play( ApplyMethod(everything.highlight, WHITE), ) self.dither()
def construct(self): one_solution = TextMobject(["One ", "solution"]) two_insights = TextMobject(["Two ", " insights"]) two, insights = two_insights.split() johann = ImageMobject("Johann_Bernoulli2", invert=False) mark = ImageMobject("Mark_Levi", invert=False) for mob in johann, mark: mob.scale(0.4) johann.next_to(insights, LEFT) mark.next_to(johann, RIGHT) name = TextMobject("Mark Levi").to_edge(UP) self.play(*map(ShimmerIn, one_solution.split())) self.dither() for pair in zip(one_solution.split(), two_insights.split()): self.play(Transform(*pair, path_func=path_along_arc(np.pi))) self.dither() self.clear() self.add(two, insights) for word, man in [(two, johann), (insights, mark)]: self.play(Transform(word, Point(word.get_left())), GrowFromCenter(man)) self.dither() self.clear() self.play(ApplyMethod(mark.center)) self.play(ShimmerIn(name)) self.dither()
def construct(self): one_solution = TextMobject(["One ", "solution"]) two_insights = TextMobject(["Two ", " insights"]) two, insights = two_insights.split() johann = ImageMobject("Johann_Bernoulli2", invert = False) mark = ImageMobject("Mark_Levi", invert = False) for mob in johann, mark: mob.scale(0.4) johann.next_to(insights, LEFT) mark.next_to(johann, RIGHT) name = TextMobject("Mark Levi").to_edge(UP) self.play(*map(ShimmerIn, one_solution.split())) self.dither() for pair in zip(one_solution.split(), two_insights.split()): self.play(Transform(*pair, path_func = path_along_arc(np.pi))) self.dither() self.clear() self.add(two, insights) for word, man in [(two, johann), (insights, mark)]: self.play( Transform(word, Point(word.get_left())), GrowFromCenter(man) ) self.dither() self.clear() self.play(ApplyMethod(mark.center)) self.play(ShimmerIn(name)) self.dither()
def construct(self): words = TextMobject([ "A function must be", "\\emph{continuous}", "if it is to represent a curve." ]) words.split()[1].highlight(YELLOW_C) self.add(words) self.dither()
def construct(self): words = TextMobject(["Which path ", "would \\emph{light} take", "?"]) words.split()[1].highlight(YELLOW) words.to_corner(UP + RIGHT) self.add_cycloid_end_points() anims = [ self.photon_run_along_path(path, rate_func=smooth) for path in self.get_paths() ] self.play(anims[0], ShimmerIn(words)) for anim in anims[1:]: self.play(anim)
def snells_law_at_every_point(self, cycloid, chopped_cycloid): square = Square(side_length = 0.2, color = WHITE) words = TextMobject(["Snell's law ", "everywhere"]) snells, rest = words.split() colon = TextMobject(":") words.next_to(square) words.shift(0.3*UP) combo = Mobject(square, words) combo.get_center = lambda : square.get_center() new_snells = snells.copy().center().to_edge(UP, buff = 1.5) colon.next_to(new_snells) colon.shift(0.05*DOWN) self.play(MoveAlongPath( combo, cycloid, run_time = 5 )) self.play(MoveAlongPath( combo, chopped_cycloid, run_time = 4 )) dot = Dot(combo.get_center()) self.play(Transform(square, dot)) self.play( Transform(snells, new_snells), Transform(rest, colon) ) self.dither() return colon
def construct(self): words = TextMobject([ "This could be the end\\dots", "but\\dots" ]) for part in words.split(): self.play(ShimmerIn(part)) self.dither()
def construct(self): words = TextMobject( ["Which path ", "would \\emph{light} take", "?"] ) words.split()[1].highlight(YELLOW) words.to_corner(UP+RIGHT) self.add_cycloid_end_points() anims = [ self.photon_run_along_path( path, rate_func = smooth ) for path in self.get_paths() ] self.play(anims[0], ShimmerIn(words)) for anim in anims[1:]: self.play(anim)
def construct(self): logo = ImageMobject("LogoGeneration", invert=False) name_mob = TextMobject("3Blue1Brown").center() name_mob.highlight("grey") name_mob.shift(2 * DOWN) self.add(name_mob, logo) new_text = TextMobject(["with ", "Steven Strogatz"]) new_text.next_to(name_mob, DOWN) self.play(*[ShimmerIn(part) for part in new_text.split()]) self.dither() with_word, steve = new_text.split() steve_copy = steve.copy().center().to_edge(UP) # logo.sort_points(lambda p : -np.linalg.norm(p)) sort_by_color(logo) self.play(Transform(steve, steve_copy), DelayByOrder(Transform(logo, Point())), FadeOut(with_word), FadeOut(name_mob), run_time=3)
def construct(self): val = 0.3 text = TextMobject([ "PHC", "$_n", "(", "%3.1f"%val, ")$", " has a ", "limit point ", "as $n \\to \\infty$" ]) func_parts = text.copy().split()[:5] Mobject(*func_parts).center().to_edge(UP) num_str, val_str = func_parts[1], func_parts[3] curve = UnitInterval() curve.sort_points(lambda p : p[0]) dot = Dot().shift(curve.number_to_point(val)) arrow = Arrow(val_str, dot, buff = 0.1) curve.add_numbers(0, 1) self.play(ShowCreation(curve)) self.play( ShimmerIn(val_str), ShowCreation(arrow), ShowCreation(dot) ) self.dither() self.play( FadeOut(arrow), *[ FadeIn(func_parts[i]) for i in 0, 1, 2, 4 ] ) for num in range(2,9): new_curve = HilbertCurve(order = num) new_curve.scale(0.8) new_dot = Dot(new_curve.points[int(val*new_curve.get_num_points())]) new_num_str = TexMobject(str(num)).replace(num_str) self.play( Transform(curve, new_curve), Transform(dot, new_dot), Transform(num_str, new_num_str) ) self.dither() text.to_edge(UP) text_parts = text.split() for index in 1, -1: text_parts[index].highlight() starters = Mobject(*func_parts + [ Point(mob.get_center(), point_thickness=1) for mob in text_parts[5:] ]) self.play(Transform(starters, text)) arrow = Arrow(text_parts[-2].get_bottom(), dot, buff = 0.1) self.play(ShowCreation(arrow)) self.dither()
def construct(self): val = 0.3 text = TextMobject([ "PHC", "$_n", "(", "%3.1f"%val, ")$", " has a ", "limit point ", "as $n \\to \\infty$" ]) func_parts = text.copy().split()[:5] Mobject(*func_parts).center().to_edge(UP) num_str, val_str = func_parts[1], func_parts[3] curve = UnitInterval() curve.sort_points(lambda p : p[0]) dot = Dot().shift(curve.number_to_point(val)) arrow = Arrow(val_str, dot, buff = 0.1) curve.add_numbers(0, 1) self.play(ShowCreation(curve)) self.play( ShimmerIn(val_str), ShowCreation(arrow), ShowCreation(dot) ) self.wait() self.play( FadeOut(arrow), *[ FadeIn(func_parts[i]) for i in 0, 1, 2, 4 ] ) for num in range(2,9): new_curve = HilbertCurve(order = num) new_curve.scale(0.8) new_dot = Dot(new_curve.points[int(val*new_curve.get_num_points())]) new_num_str = TexMobject(str(num)).replace(num_str) self.play( Transform(curve, new_curve), Transform(dot, new_dot), Transform(num_str, new_num_str) ) self.wait() text.to_edge(UP) text_parts = text.split() for index in 1, -1: text_parts[index].highlight() starters = Mobject(*func_parts + [ Point(mob.get_center(), stroke_width=1) for mob in text_parts[5:] ]) self.play(Transform(starters, text)) arrow = Arrow(text_parts[-2].get_bottom(), dot, buff = 0.1) self.play(ShowCreation(arrow)) self.wait()
def construct(self): words = TextMobject( ["One does not simply define the limit \\\\ \ of a sequence of","curves","\\dots"] ) top_words = TextMobject([ "curves", "are functions" ]).to_edge(UP) curves1 = words.split()[1] curves2 = top_words.split()[0] words.ingest_sub_mobjects() number = TexMobject("0.27") pair = TexMobject("(0.53, 0.02)") pair.next_to(number, buff = 2) arrow = Arrow(number, pair) Mobject(number, arrow, pair).center().shift(UP) number_line = UnitInterval() number_line.stretch_to_fit_width(5) number_line.to_edge(LEFT).shift(DOWN) grid = Grid(4, 4).scale(0.4) grid.next_to(number_line, buff = 2) low_arrow = Arrow(number_line, grid) self.play(ShimmerIn(words)) self.dither() self.play( FadeOut(words), ApplyMethod(curves1.replace, curves2), ShimmerIn(top_words.split()[1]) ) self.dither() self.play(FadeIn(number)) self.play(ShowCreation(arrow)) self.play(FadeIn(pair)) self.dither() self.play(ShowCreation(number_line)) self.play(ShowCreation(low_arrow)) self.play(ShowCreation(grid)) self.dither()
def __init__(self, word, **kwargs): self.path = Cycloid(end_theta=np.pi) word_mob = TextMobject(list(word)) end_word = word_mob.copy() end_word.shift(-end_word.get_bottom()) end_word.shift(self.path.get_corner(DOWN + RIGHT)) end_word.shift(3 * RIGHT) self.end_letters = end_word.split() for letter in word_mob.split(): letter.center() letter.angle = 0 unit_interval = np.arange(0, 1, 1. / len(word)) self.start_times = 0.5 * (1 - (unit_interval)) Animation.__init__(self, word_mob, **kwargs)
def __init__(self, word, **kwargs): self.path = Cycloid(end_theta = np.pi) word_mob = TextMobject(list(word)) end_word = word_mob.copy() end_word.shift(-end_word.get_bottom()) end_word.shift(self.path.get_corner(DOWN+RIGHT)) end_word.shift(3*RIGHT) self.end_letters = end_word.split() for letter in word_mob.split(): letter.center() letter.angle = 0 unit_interval = np.arange(0, 1, 1./len(word)) self.start_times = 0.5*(1-(unit_interval)) Animation.__init__(self, word_mob, **kwargs)
def snells_law_at_every_point(self, cycloid, chopped_cycloid): square = Square(side_length=0.2, color=WHITE) words = TextMobject(["Snell's law ", "everywhere"]) snells, rest = words.split() colon = TextMobject(":") words.next_to(square) words.shift(0.3 * UP) combo = Mobject(square, words) combo.get_center = lambda: square.get_center() new_snells = snells.copy().center().to_edge(UP, buff=1.5) colon.next_to(new_snells) colon.shift(0.05 * DOWN) self.play(MoveAlongPath(combo, cycloid, run_time=5)) self.play(MoveAlongPath(combo, chopped_cycloid, run_time=4)) dot = Dot(combo.get_center()) self.play(Transform(square, dot)) self.play(Transform(snells, new_snells), Transform(rest, colon)) self.dither() return colon
def construct(self): text = TextMobject([ "PHC", "_n", "(", "x", ")$", " has a limit point ", "as $n \\to \\infty$", "\\\\ for all $x$" ]) parts = text.split() parts[-1].next_to(Mobject(*parts[:-1]), DOWN) parts[-1].highlight(BLUE) parts[3].highlight(BLUE) parts[1].highlight() parts[-2].highlight() text.to_edge(UP) curve = UnitInterval() curve.sort_points(lambda p : p[0]) vals = np.arange(0.1, 1, 0.1) dots = Mobject(*[ Dot(curve.number_to_point(val)) for val in vals ]) curve.add_numbers(0, 1) starter_dots = dots.copy().ingest_submobjects() starter_dots.shift(2*UP) self.add(curve, text) self.wait() self.play(DelayByOrder(ApplyMethod(starter_dots.shift, 2*DOWN))) self.wait() self.remove(starter_dots) self.add(dots) for num in range(1, 10): new_curve = HilbertCurve(order = num) new_curve.scale(0.8) new_dots = Mobject(*[ Dot(new_curve.points[int(val*new_curve.get_num_points())]) for val in vals ]) self.play( Transform(curve, new_curve), Transform(dots, new_dots), )
def construct(self): text = TextMobject([ "PHC", "_n", "(", "x", ")$", " has a limit point ", "as $n \\to \\infty$", "\\\\ for all $x$" ]) parts = text.split() parts[-1].next_to(Mobject(*parts[:-1]), DOWN) parts[-1].highlight(BLUE) parts[3].highlight(BLUE) parts[1].highlight() parts[-2].highlight() text.to_edge(UP) curve = UnitInterval() curve.sort_points(lambda p : p[0]) vals = np.arange(0.1, 1, 0.1) dots = Mobject(*[ Dot(curve.number_to_point(val)) for val in vals ]) curve.add_numbers(0, 1) starter_dots = dots.copy().ingest_sub_mobjects() starter_dots.shift(2*UP) self.add(curve, text) self.dither() self.play(DelayByOrder(ApplyMethod(starter_dots.shift, 2*DOWN))) self.dither() self.remove(starter_dots) self.add(dots) for num in range(1, 10): new_curve = HilbertCurve(order = num) new_curve.scale(0.8) new_dots = Mobject(*[ Dot(new_curve.points[int(val*new_curve.get_num_points())]) for val in vals ]) self.play( Transform(curve, new_curve), Transform(dots, new_dots), )
def construct(self): clock = Circle(radius = 2, color = WHITE) clock.add(Dot(ORIGIN)) ticks = Mobject(*[ Line(1.8*vect, 2*vect, color = GREY) for vect in compass_directions(12) ]) clock.add(ticks) hour_hand = Line(ORIGIN, UP) minute_hand = Line(ORIGIN, 1.5*UP) clock.add(hour_hand, minute_hand) clock.to_corner(UP+RIGHT) hour_hand.get_center = lambda : clock.get_center() minute_hand.get_center = lambda : clock.get_center() solution = ImageMobject( "Newton_brachistochrone_solution2", use_cache = False ) solution.stroke_width = 3 solution.highlight(GREY) solution.scale_to_fit_width(5) solution.to_corner(UP+RIGHT) newton = ImageMobject("Old_Newton", invert = False) newton.scale(0.8) phil_trans = TextMobject("Philosophical Transactions") rect = Rectangle(height = 6, width = 4.5, color = WHITE) rect.to_corner(UP+RIGHT) rect.shift(DOWN) phil_trans.scale_to_fit_width(0.8*rect.get_width()) phil_trans.next_to(Point(rect.get_top()), DOWN) new_solution = solution.copy() new_solution.scale_to_fit_width(phil_trans.get_width()) new_solution.next_to(phil_trans, DOWN, buff = 1) not_newton = TextMobject("-Totally not by Newton") not_newton.scale_to_fit_width(2.5) not_newton.next_to(new_solution, DOWN, aligned_edge = RIGHT) phil_trans.add(rect) newton_complaint = TextMobject([ "``I do not love to be", " \\emph{dunned} ", "and teased by foreigners''" ], size = "\\small") newton_complaint.to_edge(UP, buff = 0.2) dunned = newton_complaint.split()[1] dunned.highlight() dunned_def = TextMobject("(old timey term for making \\\\ demands on someone)") dunned_def.scale(0.7) dunned_def.next_to(phil_trans, LEFT) dunned_def.shift(2*UP) dunned_arrow = Arrow(dunned_def, dunned) johann = ImageMobject("Johann_Bernoulli2", invert = False) johann.scale(0.4) johann.to_edge(LEFT) johann.shift(DOWN) johann_quote = TextMobject("``I recognize the lion by his claw''") johann_quote.next_to(johann, UP, aligned_edge = LEFT) self.play(ApplyMethod(newton.to_edge, LEFT)) self.play(ShowCreation(clock)) kwargs = { "axis" : OUT, "rate_func" : smooth } self.play( Rotating(hour_hand, radians = -2*np.pi, **kwargs), Rotating(minute_hand, radians = -12*2*np.pi, **kwargs), run_time = 5 ) self.dither() self.clear() self.add(newton) clock.ingest_submobjects() self.play(Transform(clock, solution)) self.remove(clock) self.add(solution) self.dither() self.play( FadeIn(phil_trans), Transform(solution, new_solution) ) self.dither() self.play(ShimmerIn(not_newton)) phil_trans.add(solution, not_newton) self.dither() self.play(*map(ShimmerIn, newton_complaint.split())) self.dither() self.play( ShimmerIn(dunned_def), ShowCreation(dunned_arrow) ) self.dither() self.remove(dunned_def, dunned_arrow) self.play(FadeOut(newton_complaint)) self.remove(newton_complaint) self.play( FadeOut(newton), GrowFromCenter(johann) ) self.remove(newton) self.dither() self.play(ShimmerIn(johann_quote)) self.dither()
def construct(self): clock = Circle(radius=2, color=WHITE) clock.add(Dot(ORIGIN)) ticks = Mobject(*[ Line(1.8 * vect, 2 * vect, color=GREY) for vect in compass_directions(12) ]) clock.add(ticks) hour_hand = Line(ORIGIN, UP) minute_hand = Line(ORIGIN, 1.5 * UP) clock.add(hour_hand, minute_hand) clock.to_corner(UP + RIGHT) hour_hand.get_center = lambda: clock.get_center() minute_hand.get_center = lambda: clock.get_center() solution = ImageMobject("Newton_brachistochrone_solution2", use_cache=False) solution.stroke_width = 3 solution.highlight(GREY) solution.scale_to_fit_width(5) solution.to_corner(UP + RIGHT) newton = ImageMobject("Old_Newton", invert=False) newton.scale(0.8) phil_trans = TextMobject("Philosophical Transactions") rect = Rectangle(height=6, width=4.5, color=WHITE) rect.to_corner(UP + RIGHT) rect.shift(DOWN) phil_trans.scale_to_fit_width(0.8 * rect.get_width()) phil_trans.next_to(Point(rect.get_top()), DOWN) new_solution = solution.copy() new_solution.scale_to_fit_width(phil_trans.get_width()) new_solution.next_to(phil_trans, DOWN, buff=1) not_newton = TextMobject("-Totally not by Newton") not_newton.scale_to_fit_width(2.5) not_newton.next_to(new_solution, DOWN, aligned_edge=RIGHT) phil_trans.add(rect) newton_complaint = TextMobject([ "``I do not love to be", " \\emph{dunned} ", "and teased by foreigners''" ], size="\\small") newton_complaint.to_edge(UP, buff=0.2) dunned = newton_complaint.split()[1] dunned.highlight() dunned_def = TextMobject( "(old timey term for making \\\\ demands on someone)") dunned_def.scale(0.7) dunned_def.next_to(phil_trans, LEFT) dunned_def.shift(2 * UP) dunned_arrow = Arrow(dunned_def, dunned) johann = ImageMobject("Johann_Bernoulli2", invert=False) johann.scale(0.4) johann.to_edge(LEFT) johann.shift(DOWN) johann_quote = TextMobject("``I recognize the lion by his claw''") johann_quote.next_to(johann, UP, aligned_edge=LEFT) self.play(ApplyMethod(newton.to_edge, LEFT)) self.play(ShowCreation(clock)) kwargs = {"axis": OUT, "rate_func": smooth} self.play(Rotating(hour_hand, radians=-2 * np.pi, **kwargs), Rotating(minute_hand, radians=-12 * 2 * np.pi, **kwargs), run_time=5) self.wait() self.clear() self.add(newton) clock.ingest_submobjects() self.play(Transform(clock, solution)) self.remove(clock) self.add(solution) self.wait() self.play(FadeIn(phil_trans), Transform(solution, new_solution)) self.wait() self.play(ShimmerIn(not_newton)) phil_trans.add(solution, not_newton) self.wait() self.play(*map(ShimmerIn, newton_complaint.split())) self.wait() self.play(ShimmerIn(dunned_def), ShowCreation(dunned_arrow)) self.wait() self.remove(dunned_def, dunned_arrow) self.play(FadeOut(newton_complaint)) self.remove(newton_complaint) self.play(FadeOut(newton), GrowFromCenter(johann)) self.remove(newton) self.wait() self.play(ShimmerIn(johann_quote)) self.wait()
def construct(self): words = TextMobject(["This could be the end\\dots", "but\\dots"]) for part in words.split(): self.play(ShimmerIn(part)) 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()