def construct(self): text = TextMobject("Which path minimizes travel time?") text.to_edge(UP) self.generate_start_and_end_points() point_a = Dot(self.start_point) point_b = Dot(self.end_point) A = TextMobject("A").next_to(point_a, UP) B = TextMobject("B").next_to(point_b, DOWN) paths = self.get_paths() for point, letter in [(point_a, A), (point_b, B)]: self.play( ShowCreation(point), ShimmerIn(letter) ) self.play(ShimmerIn(text)) curr_path = paths[0].copy() curr_path_copy = curr_path.copy().ingest_submobjects() self.play( self.photon_run_along_path(curr_path), ShowCreation(curr_path_copy, rate_func = rush_into) ) self.remove(curr_path_copy) for path in paths[1:] + [paths[0]]: self.play(Transform(curr_path, path, run_time = 4)) self.wait() self.path = curr_path.ingest_submobjects()
def construct(self): text = TextMobject("Which path minimizes travel time?") text.to_edge(UP) self.generate_start_and_end_points() point_a = Dot(self.start_point) point_b = Dot(self.end_point) A = TextMobject("A").next_to(point_a, UP) B = TextMobject("B").next_to(point_b, DOWN) paths = self.get_paths() for point, letter in [(point_a, A), (point_b, B)]: self.play( ShowCreation(point), ShimmerIn(letter) ) self.play(ShimmerIn(text)) curr_path = paths[0].copy() curr_path_copy = curr_path.copy().ingest_submobjects() self.play( self.photon_run_along_path(curr_path), ShowCreation(curr_path_copy, rate_func = rush_into) ) self.remove(curr_path_copy) for path in paths[1:] + [paths[0]]: self.play(Transform(curr_path, path, run_time = 4)) self.dither() self.path = curr_path.ingest_submobjects()
def construct(self): definition = TexMobject([ "\\text{HC}(", "x", ")", "=\\lim_{n \\to \\infty}\\text{PHC}_n(", "x", ")" ]) definition.to_edge(UP) definition.split()[1].highlight(BLUE) definition.split()[-2].highlight(BLUE) intro = TextMobject("Three things need to be proven") prove_that = TextMobject("Prove that HC is $\\dots$") prove_that.scale(0.7) prove_that.to_edge(LEFT) items = TextMobject([ "\\begin{enumerate}", "\\item Well-defined: ", "Points on Pseudo-Hilbert-curves really do converge", "\\item A Curve: ", "HC is continuous", "\\item Space-filling: ", "Each point in the unit square is an output of HC", "\\end{enumerate}", ]).split() items[1].highlight(GREEN) items[3].highlight(YELLOW_C) items[5].highlight(MAROON) Mobject(*items).to_edge(RIGHT) self.add(definition) self.play(ShimmerIn(intro)) self.wait() self.play(Transform(intro, prove_that)) for item in items[1:-1]: self.play(ShimmerIn(item)) self.wait()
def show_angles(self): words = TextMobject(""" Let's see what happens as we change the angle in this seed """) words.to_edge(UP) koch, sharper_koch, duller_koch = curves = [ CurveClass(order=1) for CurveClass in StraightKoch, SharperKoch, DullerKoch ] arcs = [ Arc(2 * (np.pi / 2 - curve.angle), radius=r, start_angle=np.pi + curve.angle).shift( curve.points[curve.get_num_points() / 2]) for curve, r in zip(curves, [0.6, 0.7, 0.4]) ] theta = TexMobject("\\theta") theta.shift(arcs[0].get_center() + 2.5 * DOWN) arrow = Arrow(theta, arcs[0]) self.add(words, koch) self.play(ShowCreation(arcs[0])) self.play(ShowCreation(arrow), ShimmerIn(theta)) self.wait(2) self.remove(theta, arrow) self.play( Transform(koch, duller_koch), Transform(arcs[0], arcs[2]), ) self.play( Transform(koch, sharper_koch), Transform(arcs[0], arcs[1]), ) self.clear()
def construct(self): point_a, point_b = 3 * LEFT, 3 * RIGHT dots = [] for point, char in [(point_a, "A"), (point_b, "B")]: dot = Dot(point) letter = TexMobject(char) letter.next_to(dot, UP + LEFT) dot.add(letter) dots.append(dot) path = ParametricFunction(lambda t: (t / 2 + np.cos(t)) * RIGHT + np.sin(t) * UP, start=-2 * np.pi, end=2 * np.pi) path.scale(6 / (2 * np.pi)) path.shift(point_a - path.points[0]) path.highlight(RED) line = Line(point_a, point_b) words = TextMobject("Shortest path from $A$ to $B$") words.to_edge(UP) self.play(ShimmerIn(words), *map(GrowFromCenter, dots)) self.play(ShowCreation(path)) self.play(Transform(path, line, path_func=path_along_arc(np.pi))) self.wait()
def construct(self): rect = Rectangle(height=4, width=6, color=WHITE) words = TextMobject("Details of proof") words.to_edge(UP) self.play(ShowCreation(rect), ShimmerIn(words)) self.wait()
def construct(self): scale_factor = 0.9 grid = Grid(4, 4, stroke_width=1) curve = HilbertCurve(order=2) for mob in grid, curve: mob.scale(scale_factor) words = TextMobject(""" Sequence of curves is stable $\\leftrightarrow$ existence of limit curve """, size="\\normal") words.scale(1.25) words.to_edge(UP) self.add(curve, grid) self.wait() for n in range(3, 7): if n == 5: self.play(ShimmerIn(words)) new_grid = Grid(2**n, 2**n, stroke_width=1) new_curve = HilbertCurve(order=n) for mob in new_grid, new_curve: mob.scale(scale_factor) self.play(ShowCreation(new_grid), Animation(curve)) self.remove(grid) grid = new_grid self.play(Transform(curve, new_curve)) self.wait()
def construct(self): point_a, point_b = 3*LEFT, 3*RIGHT dots = [] for point, char in [(point_a, "A"), (point_b, "B")]: dot = Dot(point) letter = TexMobject(char) letter.next_to(dot, UP+LEFT) dot.add(letter) dots.append(dot) path = ParametricFunction( lambda t : (t/2 + np.cos(t))*RIGHT + np.sin(t)*UP, start = -2*np.pi, end = 2*np.pi ) path.scale(6/(2*np.pi)) path.shift(point_a - path.points[0]) path.highlight(RED) line = Line(point_a, point_b) words = TextMobject("Shortest path from $A$ to $B$") words.to_edge(UP) self.play( ShimmerIn(words), *map(GrowFromCenter, dots) ) self.play(ShowCreation(path)) self.play(Transform( path, line, path_func = path_along_arc(np.pi) )) self.dither()
def construct(self): scale_factor = 0.9 grid = Grid(4, 4, point_thickness = 1) curve = HilbertCurve(order = 2) for mob in grid, curve: mob.scale(scale_factor) words = TextMobject(""" Sequence of curves is stable $\\leftrightarrow$ existence of limit curve """, size = "\\normal") words.scale(1.25) words.to_edge(UP) self.add(curve, grid) self.dither() for n in range(3, 7): if n == 5: self.play(ShimmerIn(words)) new_grid = Grid(2**n, 2**n, point_thickness = 1) new_curve = HilbertCurve(order = n) for mob in new_grid, new_curve: mob.scale(scale_factor) self.play( ShowCreation(new_grid), Animation(curve) ) self.remove(grid) grid = new_grid self.play(Transform(curve, new_curve)) self.dither()
def construct(self): definition = TexMobject([ "\\text{HC}(", "x", ")", "=\\lim_{n \\to \\infty}\\text{PHC}_n(", "x", ")" ]) definition.to_edge(UP) definition.split()[1].highlight(BLUE) definition.split()[-2].highlight(BLUE) intro = TextMobject("Three things need to be proven") prove_that = TextMobject("Prove that HC is $\\dots$") prove_that.scale(0.7) prove_that.to_edge(LEFT) items = TextMobject([ "\\begin{enumerate}", "\\item Well-defined: ", "Points on Pseudo-Hilbert-curves really do converge", "\\item A Curve: ", "HC is continuous", "\\item Space-filling: ", "Each point in the unit square is an output of HC", "\\end{enumerate}", ]).split() items[1].highlight(GREEN) items[3].highlight(YELLOW_C) items[5].highlight(MAROON) Mobject(*items).to_edge(RIGHT) self.add(definition) self.play(ShimmerIn(intro)) self.dither() self.play(Transform(intro, prove_that)) for item in items[1:-1]: self.play(ShimmerIn(item)) self.dither()
def construct(self): words = TextMobject("Order 2 Pseudo-Hilbert Curve") words.to_edge(UP, buff=0.3) words.highlight(GREEN) grid2 = Grid(2, 2) grid4 = Grid(4, 4, point_thickness=2) # order_1_curve = HilbertCurve(order = 1) # squaggle_curve = order_1_curve.copy().apply_function( # lambda (x, y, z) : (x + np.cos(3*y), y + np.sin(3*x), z) # ) # squaggle_curve.show() mini_curves = [ HilbertCurve(order=1).scale(0.5).shift(1.5 * vect) for vect in [LEFT + DOWN, LEFT + UP, RIGHT + UP, RIGHT + DOWN] ] last_curve = mini_curves[0] naive_curve = Mobject(last_curve) for mini_curve in mini_curves[1:]: line = Line(last_curve.points[-1], mini_curve.points[0]) naive_curve.add(line, mini_curve) last_curve = mini_curve naive_curve.ingest_sub_mobjects() naive_curve.gradient_highlight(RED, GREEN) order_2_curve = HilbertCurve(order=2) self.add(words, grid2) self.dither() self.play(ShowCreation(grid4)) self.play(*[ShowCreation(mini_curve) for mini_curve in mini_curves]) self.dither() self.play(ShowCreation(naive_curve, run_time=5)) self.remove(*mini_curves) self.dither() self.play(Transform(naive_curve, order_2_curve)) self.dither()
def construct(self): words = TextMobject("Order 3 Pseudo-Hilbert Curve") words.highlight(GREEN) words.to_edge(UP) grid4 = Mobject(Grid(2, 2), Grid(4, 4, point_thickness=2)) grid8 = Grid(8, 8, point_thickness=1) order_3_curve = HilbertCurve(order=3) mini_curves = [ HilbertCurve(order=2).scale(0.5).shift(1.5 * vect) for vect in [LEFT + DOWN, LEFT + UP, RIGHT + UP, RIGHT + DOWN] ] self.add(words, grid4) self.dither() self.play(ShowCreation(grid8)) self.dither() self.play(*map(GrowFromCenter, mini_curves)) self.dither() self.clear() self.add(words, grid8, *mini_curves) self.play(*[ ApplyMethod(curve.rotate_in_place, np.pi, axis) for curve, axis in [(mini_curves[0], UP + RIGHT), (mini_curves[3], UP + LEFT)] ]) self.play(ShowCreation(order_3_curve, run_time=5)) self.dither()
def construct(self): text = TextMobject("Light") text.to_edge(UP) self.play(ShimmerIn(text)) self.play(self.photon_run_along_path( Cycloid(), rate_func = None )) self.wait()
def construct(self): text = TextMobject("Light") text.to_edge(UP) self.play(ShimmerIn(text)) self.play(self.photon_run_along_path( Cycloid(), rate_func = None )) self.dither()
def construct(self): curve = HilbertCurve(order=1) words = TextMobject("``Hilbert Curve''") words.to_edge(UP, buff=0.2) self.play(ShimmerIn(words), Transform(curve, HilbertCurve(order=2)), run_time=2) for n in range(3, 8): self.play(Transform(curve, HilbertCurve(order=n)), run_time=5. / n)
def construct(self): rect = Rectangle(height = 4, width = 6, color = WHITE) words = TextMobject("Details of proof") words.to_edge(UP) self.play( ShowCreation(rect), ShimmerIn(words) ) self.dither()
def add_title(self, title, scale_factor=1.5, animate=False): if not isinstance(title, Mobject): title = TextMobject(title).scale(scale_factor) title.to_edge(UP) title.add_background_rectangle() if animate: self.play(Write(title)) self.add_foreground_mobject(title) self.title = title return self
def construct(self): words = TextMobject("Yet another bit of Mark Levi cleverness") words.to_edge(UP) levi = ImageMobject("Mark_Levi", invert=False) levi.scale_to_fit_width(6) levi.show() self.add(levi) self.play(ShimmerIn(words)) self.wait(2)
def add_title(self, title, scale_factor = 1.5, animate = False): if not isinstance(title, Mobject): title = TextMobject(title).scale(scale_factor) title.to_edge(UP) title.add_background_rectangle() if animate: self.play(Write(title)) self.add_foreground_mobject(title) self.title = title return self
def construct(self): words = TextMobject("Yet another bit of Mark Levi cleverness") words.to_edge(UP) levi = ImageMobject("Mark_Levi", invert = False) levi.scale_to_fit_width(6) levi.show() self.add(levi) self.play(ShimmerIn(words)) self.dither(2)
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): freq_line = get_freq_line() self.add(freq_line) self.dither() for tex, vect in zip(["20 Hz", "20{,}000 Hz"], [LEFT, RIGHT]): tex_mob = TextMobject(tex) tex_mob.to_edge(vect) tex_mob.shift(UP) arrow = Arrow(tex_mob, freq_line.get_edge_center(vect)) self.play(ShimmerIn(tex_mob), 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.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 add_title(self): title = TextMobject("Clicky Stuffs") title.scale(1.5) title.to_edge(UP, buff = MED_SMALL_BUFF) randy, morty = Randolph(), Mortimer() for pi, vect in (randy, LEFT), (morty, RIGHT): pi.scale_to_fit_height(title.get_height()) pi.change_mode("thinking") pi.look(DOWN) pi.next_to(title, vect, buff = MED_LARGE_BUFF) self.add_foreground_mobjects(title, randy, morty)
def construct(self): point_a = 3*LEFT+3*UP point_b = 1.5*RIGHT+3*DOWN midpoint = ORIGIN lines, arcs, thetas = [], [], [] counter = it.count(1) for point in point_a, point_b: line = Line(point, midpoint, color = RED_D) angle = np.pi/2-np.abs(np.arctan(line.get_slope())) arc = Arc(angle, radius = 0.5).rotate(np.pi/2) if point is point_b: arc.rotate(np.pi) line.reverse_points() theta = TexMobject("\\theta_%d"%counter.next()) theta.scale(0.5) theta.shift(2*arc.get_center()) arc.shift(midpoint) theta.shift(midpoint) lines.append(line) arcs.append(arc) thetas.append(theta) vert_line = Line(2*UP, 2*DOWN) vert_line.shift(midpoint) path = Mobject(*lines).ingest_submobjects() glass = Region(lambda x, y : y < 0, color = BLUE_E) self.add(glass) equation = TexMobject([ "\\dfrac{\\sin(\\theta_1)}{v_{\\text{air}}}", "=", "\\dfrac{\\sin(\\theta_2)}{v_{\\text{water}}}", ]) equation.to_corner(UP+RIGHT) exp1, equals, exp2 = equation.split() snells_law = TextMobject("Snell's Law:") snells_law.highlight(YELLOW) snells_law.to_edge(UP) self.play(ShimmerIn(snells_law)) self.wait() self.play(ShowCreation(path)) self.play(self.photon_run_along_path(path)) self.wait() self.play(ShowCreation(vert_line)) self.play(*map(ShowCreation, arcs)) self.play(*map(GrowFromCenter, thetas)) self.wait() self.play(ShimmerIn(exp1)) self.wait() self.play(*map(ShimmerIn, [equals, exp2])) self.wait()
def construct(self): point_a = 3*LEFT+3*UP point_b = 1.5*RIGHT+3*DOWN midpoint = ORIGIN lines, arcs, thetas = [], [], [] counter = it.count(1) for point in point_a, point_b: line = Line(point, midpoint, color = RED_D) angle = np.pi/2-np.abs(np.arctan(line.get_slope())) arc = Arc(angle, radius = 0.5).rotate(np.pi/2) if point is point_b: arc.rotate(np.pi) line.reverse_points() theta = TexMobject("\\theta_%d"%counter.next()) theta.scale(0.5) theta.shift(2*arc.get_center()) arc.shift(midpoint) theta.shift(midpoint) lines.append(line) arcs.append(arc) thetas.append(theta) vert_line = Line(2*UP, 2*DOWN) vert_line.shift(midpoint) path = Mobject(*lines).ingest_submobjects() glass = Region(lambda x, y : y < 0, color = BLUE_E) self.add(glass) equation = TexMobject([ "\\dfrac{\\sin(\\theta_1)}{v_{\\text{air}}}", "=", "\\dfrac{\\sin(\\theta_2)}{v_{\\text{water}}}", ]) equation.to_corner(UP+RIGHT) exp1, equals, exp2 = equation.split() snells_law = TextMobject("Snell's Law:") snells_law.highlight(YELLOW) snells_law.to_edge(UP) self.play(ShimmerIn(snells_law)) self.dither() self.play(ShowCreation(path)) self.play(self.photon_run_along_path(path)) self.dither() self.play(ShowCreation(vert_line)) self.play(*map(ShowCreation, arcs)) self.play(*map(GrowFromCenter, thetas)) self.dither() self.play(ShimmerIn(exp1)) self.dither() self.play(*map(ShimmerIn, [equals, exp2])) self.dither()
def construct(self): name = TextMobject("Steven Strogatz") name.to_edge(UP) contributions = TextMobject("Frequent Contributions") contributions.scale(0.5).to_edge(RIGHT).shift(2*UP) books_word = TextMobject("Books") books_word.scale(0.5).to_edge(LEFT).shift(2*UP) radio_lab, sci_fri, cornell, book2, book3, book4 = [ ImageMobject(filename, invert = False, filter_color = WHITE) for filename in [ "radio_lab", "science_friday", "cornell", "strogatz_book2", "strogatz_book3", "strogatz_book4", ] ] book1 = ImageMobject("strogatz_book1", invert = False) nyt = ImageMobject("new_york_times") logos = [radio_lab, nyt, sci_fri] books = [book1, book2, book3, book4] sample_size = Square(side_length = 2) last = contributions for image in logos: image.replace(sample_size) image.next_to(last, DOWN) last = image sci_fri.scale_in_place(0.9) shift_val = 0 sample_size.scale(0.75) for book in books: book.replace(sample_size) book.next_to(books_word, DOWN) book.shift(shift_val*(RIGHT+DOWN)) shift_val += 0.5 sample_size.scale(2) cornell.replace(sample_size) cornell.next_to(name, DOWN) self.add(name) self.play(FadeIn(cornell)) self.play(ShimmerIn(books_word)) for book in books: book.shift(5*LEFT) self.play(ApplyMethod(book.shift, 5*RIGHT)) self.play(ShimmerIn(contributions)) for logo in logos: self.play(FadeIn(logo)) self.dither()
def construct(self): name = TextMobject("Steven Strogatz") name.to_edge(UP) contributions = TextMobject("Frequent Contributions") contributions.scale(0.5).to_edge(RIGHT).shift(2 * UP) books_word = TextMobject("Books") books_word.scale(0.5).to_edge(LEFT).shift(2 * UP) radio_lab, sci_fri, cornell, book2, book3, book4 = [ ImageMobject(filename, invert=False, filter_color=WHITE) for filename in [ "radio_lab", "science_friday", "cornell", "strogatz_book2", "strogatz_book3", "strogatz_book4", ] ] book1 = ImageMobject("strogatz_book1", invert=False) nyt = ImageMobject("new_york_times") logos = [radio_lab, nyt, sci_fri] books = [book1, book2, book3, book4] sample_size = Square(side_length=2) last = contributions for image in logos: image.replace(sample_size) image.next_to(last, DOWN) last = image sci_fri.scale_in_place(0.9) shift_val = 0 sample_size.scale(0.75) for book in books: book.replace(sample_size) book.next_to(books_word, DOWN) book.shift(shift_val * (RIGHT + DOWN)) shift_val += 0.5 sample_size.scale(2) cornell.replace(sample_size) cornell.next_to(name, DOWN) self.add(name) self.play(FadeIn(cornell)) self.play(ShimmerIn(books_word)) for book in books: book.shift(5 * LEFT) self.play(ApplyMethod(book.shift, 5 * RIGHT)) self.play(ShimmerIn(contributions)) for logo in logos: self.play(FadeIn(logo)) self.dither()
def construct(self): horiz_radius = 5 vert_radius = 3 vert_axis = NumberLine(numerical_radius=vert_radius) vert_axis.rotate(np.pi / 2) vert_axis.shift(horiz_radius * LEFT) horiz_axis = NumberLine(numerical_radius=5, numbers_with_elongated_ticks=[]) axes = Mobject(horiz_axis, vert_axis) graph = FunctionGraph(lambda x: 0.4 * (x - 2) * (x + 2) + 3, x_min=-2, x_max=2, density=3 * DEFAULT_POINT_DENSITY_1D) graph.stretch_to_fit_width(2 * horiz_radius) graph.highlight(YELLOW) min_point = Dot(graph.get_bottom()) nature_finds = TextMobject("Nature finds this point") nature_finds.scale(0.5) nature_finds.highlight(GREEN) nature_finds.shift(2 * RIGHT + 3 * UP) arrow = Arrow(nature_finds.get_bottom(), min_point, color=GREEN) side_words_start = TextMobject("Parameter describing") top_words, last_side_words = [ map(TextMobject, pair) for pair in [("Light's travel time", "Potential energy"), ("path", "mechanical state")] ] for word in top_words + last_side_words + [side_words_start]: word.scale(0.7) side_words_start.next_to(horiz_axis, DOWN) side_words_start.to_edge(RIGHT) for words in top_words: words.next_to(vert_axis, UP) words.to_edge(LEFT) for words in last_side_words: words.next_to(side_words_start, DOWN) for words in top_words[1], last_side_words[1]: words.highlight(RED) self.add(axes, top_words[0], side_words_start, last_side_words[0]) self.play(ShowCreation(graph)) self.play(ShimmerIn(nature_finds), ShowCreation(arrow), ShowCreation(min_point)) self.dither() self.play(FadeOut(top_words[0]), FadeOut(last_side_words[0]), GrowFromCenter(top_words[1]), GrowFromCenter(last_side_words[1])) self.dither(3)
def construct(self): morty = Mortimer() morty.next_to(ORIGIN, DOWN) n_patrons = len(self.specific_patrons) special_thanks = TextMobject("Special thanks") special_thanks.highlight(YELLOW) special_thanks.to_edge(UP) patreon_logo = PatreonLogo() patreon_logo.next_to(morty, UP, buff=MED_LARGE_BUFF) patrons = map(TextMobject, self.specific_patrons) patron_groups = [] index = 0 counter = 0 while index < len(patrons): next_index = index + self.patron_group_size group = VGroup(*patrons[index:next_index]) group.arrange_submobjects(DOWN, aligned_edge=LEFT) if counter % 2 == 0: group.to_edge(LEFT) else: group.to_edge(RIGHT) patron_groups.append(group) index = next_index counter += 1 self.play( morty.change_mode, "gracious", DrawBorderThenFill(patreon_logo), ) self.play(Write(special_thanks, run_time=1)) for i, group in enumerate(patron_groups): anims = [ FadeIn( group, run_time=2, submobject_mode="lagged_start", lag_factor=4, ), morty.look_at, group.get_top(), ] if i >= 2: anims.append(FadeOut(patron_groups[i - 2])) self.play(*anims) self.play(morty.look_at, group.get_bottom()) self.play(Blink(morty))
def construct(self): words = TextMobject(""" It might come as a surprise how some well-known fractals can be described with curves. """) words.to_edge(UP) self.setup(Sierpinski) self.add(TextMobject("Speaking of other fractals\\dots")) self.dither(3) self.clear() self.play(ShimmerIn(words)) for x in range(9): self.increase_order()
def construct(self): words = TextMobject(""" It might come as a surprise how some well-known fractals can be described with curves. """) words.to_edge(UP) self.setup(Sierpinski) self.add(TextMobject("Speaking of other fractals\\dots")) self.wait(3) self.clear() self.play(ShimmerIn(words)) for x in range(9): self.increase_order()
def construct(self): curve = HilbertCurve(order = 1) words = TextMobject("``Hilbert Curve''") words.to_edge(UP, buff = 0.2) self.play( ShimmerIn(words), Transform(curve, HilbertCurve(order = 2)), run_time = 2 ) for n in range(3, 8): self.play( Transform(curve, HilbertCurve(order = n)), run_time = 5. /n )
def construct(self): snells = TextMobject("Snell's") snells.shift(-snells.get_left()) snells.to_edge(UP) for vect in [RIGHT, RIGHT, LEFT, DOWN, DOWN, DOWN]: snells.add(snells.copy().next_to(snells, vect)) snells.ingest_submobjects() snells.show() condensed = TextMobject("condensed") self.add(snells) self.dither() self.play(DelayByOrder(Transform(snells, condensed, run_time=2))) self.dither()
def construct(self): freq_line = get_freq_line() self.add(freq_line) self.dither() for tex, vect in zip(["20 Hz", "20{,}000 Hz"], [LEFT, RIGHT]): tex_mob = TextMobject(tex) tex_mob.to_edge(vect) tex_mob.shift(UP) arrow = Arrow(tex_mob, freq_line.get_edge_center(vect)) self.play( ShimmerIn(tex_mob), ShowCreation(arrow) ) self.dither()
def construct(self): mathy, bubble = get_mathy_and_bubble() bubble.write("For a 256x256 pixel array...") words = TextMobject("Order 8 Pseudo-Hilbert Curve") words.highlight(GREEN) words.to_edge(UP, buff=0.3) curve = HilbertCurve(order=8) self.add(mathy, bubble) self.play(ShimmerIn(bubble.content)) self.dither() self.clear() self.add(words) self.play(ShowCreation(curve, run_time=7, rate_func=None)) self.dither()
def label_spaces(self): input_space = TextMobject("Input Space") input_space.to_edge(UP) input_space.shift(LEFT * SPACE_WIDTH / 2) output_space = TextMobject("Output Space") output_space.to_edge(UP) output_space.shift(RIGHT * SPACE_WIDTH / 2) line = Line(UP * SPACE_HEIGHT, DOWN * SPACE_HEIGHT, color=WHITE) self.play( ShimmerIn(input_space), ShimmerIn(output_space), ShowCreation(line), ShowCreation(self.interval), ) self.dither()
def construct(self): left, right = 5*LEFT, 5*RIGHT top_words = TextMobject("The next 15 minutes of your life:") top_words.to_edge(UP) line = Line(left, right, color = BLUE_D) for a in np.arange(0, 4./3, 1./3): vect = interpolate(left, right, a) line.add_line(vect+0.2*DOWN, vect+0.2*UP) left_brace = Brace( Mobject( Point(left), Point(interpolate(left, right, 2./3)) ), DOWN ) right_brace = Brace( Mobject( Point(interpolate(left, right, 2./3)), Point(right) ), UP ) left_brace.words = map(TextMobject, [ "Problem statement", "History", "Johann Bernoulli's cleverness" ]) curr = left_brace right_brace.words = map(TextMobject, [ "Challenge", "Mark Levi's cleverness", ]) for brace in left_brace, right_brace: curr = brace direction = DOWN if brace is left_brace else UP for word in brace.words: word.next_to(curr, direction) curr = word right_brace.words.reverse() self.play(ShimmerIn(top_words)) self.play(ShowCreation(line)) for brace in left_brace, right_brace: self.play(GrowFromCenter(brace)) self.dither() for word in brace.words: self.play(ShimmerIn(word)) self.dither()
def construct(self): morty = Mortimer() morty.next_to(ORIGIN, DOWN) n_patrons = len(self.specific_patrons) special_thanks = TextMobject("Special thanks") special_thanks.highlight(YELLOW) special_thanks.to_edge(UP) patreon_logo = PatreonLogo() patreon_logo.next_to(morty, UP, buff=MED_LARGE_BUFF) patrons = map(TextMobject, self.specific_patrons) num_groups = float(len(patrons)) / self.patron_group_size proportion_range = np.linspace(0, 1, num_groups + 1) indices = (len(patrons) * proportion_range).astype('int') patron_groups = [ VGroup(*patrons[i:j]) for i, j in zip(indices, indices[1:]) ] for i, group in enumerate(patron_groups): group.arrange_submobjects(DOWN, aligned_edge=LEFT) group.scale(self.patron_scale_val) group.to_edge(LEFT if i % 2 == 0 else RIGHT) self.play( morty.change_mode, "gracious", DrawBorderThenFill(patreon_logo), ) self.play(Write(special_thanks, run_time=1)) print len(patron_groups) for i, group in enumerate(patron_groups): anims = [ FadeIn( group, run_time=2, submobject_mode="lagged_start", lag_factor=4, ), morty.look_at, group.get_top(), ] if i >= 2: anims.append(FadeOut(patron_groups[i - 2])) self.play(*anims) self.play(morty.look_at, group.get_bottom()) self.play(Blink(morty))
def construct(self): snells = TextMobject("Snell's") snells.shift(-snells.get_left()) snells.to_edge(UP) for vect in [RIGHT, RIGHT, LEFT, DOWN, DOWN, DOWN]: snells.add(snells.copy().next_to(snells, vect)) snells.ingest_submobjects() snells.show() condensed = TextMobject("condensed") self.add(snells) self.dither() self.play(DelayByOrder( Transform(snells, condensed, run_time = 2) )) self.dither()
def construct(self): morty = Mortimer() morty.next_to(ORIGIN, DOWN) n_patrons = len(self.specific_patrons) special_thanks = TextMobject("Special thanks") special_thanks.highlight(YELLOW) special_thanks.to_edge(UP) patreon_logo = PatreonLogo() patreon_logo.next_to(morty, UP, buff=MED_LARGE_BUFF) left_patrons = VGroup( *map(TextMobject, self.specific_patrons[:n_patrons / 2])) right_patrons = VGroup( *map(TextMobject, self.specific_patrons[n_patrons / 2:])) for patrons in left_patrons, right_patrons: patrons.arrange_submobjects(DOWN, aligned_edge=LEFT, buff=1.5 * MED_SMALL_BUFF) all_patrons = VGroup(left_patrons, right_patrons) all_patrons.scale(0.7) for patrons, vect in (left_patrons, LEFT), (right_patrons, RIGHT): patrons.to_corner(UP + vect, buff=MED_SMALL_BUFF) shift_distance = max(0, 1 - SPACE_HEIGHT - all_patrons.get_bottom()[1]) velocity = shift_distance / 9.0 def get_shift_anim(): return ApplyMethod(all_patrons.shift, velocity * UP, rate_func=None) self.play( morty.change_mode, "gracious", DrawBorderThenFill(patreon_logo), ) self.play(Write(special_thanks, run_time=1)) self.play(Write(left_patrons), morty.look_at, left_patrons) self.play(Write(right_patrons), morty.look_at, right_patrons) self.play(Blink(morty), get_shift_anim()) for patrons in left_patrons, right_patrons: for index in 0, -1: self.play(morty.look_at, patrons[index], get_shift_anim()) self.play(get_shift_anim())
def construct(self): mathy, bubble = get_mathy_and_bubble() bubble.write("For a 256x256 pixel array...") words = TextMobject("Order 8 Pseudo-Hilbert Curve") words.highlight(GREEN) words.to_edge(UP, buff = 0.3) curve = HilbertCurve(order = 8) self.add(mathy, bubble) self.play(ShimmerIn(bubble.content)) self.dither() self.clear() self.add(words) self.play(ShowCreation( curve, run_time = 7, rate_func = None )) self.dither()
def label_spaces(self): input_space = TextMobject("Input Space") input_space.to_edge(UP) input_space.shift(LEFT*SPACE_WIDTH/2) output_space = TextMobject("Output Space") output_space.to_edge(UP) output_space.shift(RIGHT*SPACE_WIDTH/2) line = Line( UP*SPACE_HEIGHT, DOWN*SPACE_HEIGHT, color = WHITE ) self.play( ShimmerIn(input_space), ShimmerIn(output_space), ShowCreation(line), ShowCreation(self.interval), ) self.dither()
def construct(self): words = TextMobject("Order 2 Pseudo-Hilbert Curve") words.to_edge(UP, buff = 0.3) words.highlight(GREEN) grid2 = Grid(2, 2) grid4 = Grid(4, 4, stroke_width = 2) # order_1_curve = HilbertCurve(order = 1) # squaggle_curve = order_1_curve.copy().apply_function( # lambda (x, y, z) : (x + np.cos(3*y), y + np.sin(3*x), z) # ) # squaggle_curve.show() mini_curves = [ HilbertCurve(order = 1).scale(0.5).shift(1.5*vect) for vect in [ LEFT+DOWN, LEFT+UP, RIGHT+UP, RIGHT+DOWN ] ] last_curve = mini_curves[0] naive_curve = Mobject(last_curve) for mini_curve in mini_curves[1:]: line = Line(last_curve.points[-1], mini_curve.points[0]) naive_curve.add(line, mini_curve) last_curve = mini_curve naive_curve.ingest_submobjects() naive_curve.gradient_highlight(RED, GREEN) order_2_curve = HilbertCurve(order = 2) self.add(words, grid2) self.dither() self.play(ShowCreation(grid4)) self.play(*[ ShowCreation(mini_curve) for mini_curve in mini_curves ]) self.dither() self.play(ShowCreation(naive_curve, run_time = 5)) self.remove(*mini_curves) self.dither() self.play(Transform(naive_curve, order_2_curve)) self.dither()
def get_quote(self, max_width = 2*SPACE_WIDTH-1): text_mobject_kwargs = { "alignment" : "", "arg_separator" : self.quote_arg_separator, } if isinstance(self.quote, str): quote = TextMobject("``%s''"%self.quote.strip(), **text_mobject_kwargs) else: words = ["``"] + list(self.quote) + ["''"] quote = TextMobject(*words, **text_mobject_kwargs) ##TODO, make less hacky quote[0].shift(0.2*RIGHT) quote[-1].shift(0.2*LEFT) for term, color in self.highlighted_quote_terms.items(): quote.highlight_by_tex(term, color) quote.to_edge(UP) if quote.get_width() > max_width: quote.scale_to_fit_width(max_width) return quote
def label(self, text, time = 5): mob = TextMobject(text) mob.scale(1.5) mob.to_edge(UP) rectangle = region_from_polygon_vertices(*[ mob.get_corner(vect) + 0.3*vect for vect in [ UP+RIGHT, UP+LEFT, DOWN+LEFT, DOWN+RIGHT ] ]) mob.highlight(self.text_color) rectangle = MobjectFromRegion(rectangle, "#111111") rectangle.point_thickness = 3 self.add(rectangle, mob) self.dither(time) self.remove(mob, rectangle)
def construct(self): words1 = TextMobject(""" But of course, there's no reason we should limit ourselves to filling in squares. """) words2 = TextMobject(""" Here's a simple triangle-filling curve I defined in a style reflective of a Hilbert curve. """) words1.to_edge(UP) words2.scale(0.8).to_edge(UP, buff = 0.2) self.setup(TriangleFillingCurve) self.play(ShimmerIn(words1)) for x in range(3): self.increase_order() self.remove(words1) self.add(words2) for x in range(5): self.increase_order()
def get_quote(self, max_width=2 * SPACE_WIDTH - 1): text_mobject_kwargs = { "alignment": "", "arg_separator": self.quote_arg_separator, } if isinstance(self.quote, str): quote = TextMobject("``%s''" % self.quote.strip(), **text_mobject_kwargs) else: words = ["``"] + list(self.quote) + ["''"] quote = TextMobject(*words, **text_mobject_kwargs) ##TODO, make less hacky quote[0].shift(0.2 * RIGHT) quote[-1].shift(0.2 * LEFT) for term, color in self.highlighted_quote_terms.items(): quote.highlight_by_tex(term, color) quote.to_edge(UP) if quote.get_width() > max_width: quote.scale_to_fit_width(max_width) return quote
def construct(self): words1 = TextMobject(""" But of course, there's no reason we should limit ourselves to filling in squares. """) words2 = TextMobject(""" Here's a simple triangle-filling curve I defined in a style reflective of a Hilbert curve. """) words1.to_edge(UP) words2.scale(0.8).to_edge(UP, buff=0.2) self.setup(TriangleFillingCurve) self.play(ShimmerIn(words1)) for x in range(3): self.increase_order() self.remove(words1) self.add(words2) for x in range(5): self.increase_order()
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): 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): words1 = TextMobject(""" For each one, see if you can figure out what the pattern of construction is. """) words2 = TextMobject(""" This one is the Peano curve. """) words3 = TextMobject(""" It is the original space-filling curve. """) self.setup(PeanoCurve) self.play(ShimmerIn(words1)) self.dither(5) self.remove(words1) self.add(words2.to_edge(UP)) for x in range(3): self.increase_order() self.remove(words2) self.increase_order(ShimmerIn(words3.to_edge(UP))) for x in range(2): self.increase_order()
def construct(self): randy = Randolph() randy.scale(RANDY_SCALE_VAL) randy.shift(-randy.get_bottom()) self.add_cycloid_end_points() points = self.cycloid.points ceiling = points[0, 1] n = len(points) broken_points = [ points[k*n/self.num_pieces:(k+1)*n/self.num_pieces] for k in range(self.num_pieces) ] words = TextMobject(""" What determines the speed\\\\ at each point? """) words.to_edge(UP) self.add(self.cycloid) sliders, vectors = [], [] for points in broken_points: path = Mobject().add_points(points) vect = points[-1] - points[-2] magnitude = np.sqrt(ceiling - points[-1, 1]) vect = magnitude*vect/np.linalg.norm(vect) slider = self.slide(randy, path, ceiling = ceiling) vector = Vector(slider.get_center(), vect) self.add(slider, vector) sliders.append(slider) vectors.append(vector) self.dither() self.play(ShimmerIn(words)) self.dither(3) slider = sliders.pop(1) vector = vectors.pop(1) faders = sliders+vectors+[words] self.play(*map(FadeOut, faders)) self.remove(*faders) self.show_geometry(slider, vector)
def show_angles(self): words = TextMobject(""" Let's see what happens as we change the angle in this seed """) words.to_edge(UP) koch, sharper_koch, duller_koch = curves = [ CurveClass(order = 1) for CurveClass in StraightKoch, SharperKoch, DullerKoch ] arcs = [ Arc( 2*(np.pi/2 - curve.angle), radius = r, start_angle = np.pi+curve.angle ).shift(curve.points[curve.get_num_points()/2]) for curve, r in zip(curves, [0.6, 0.7, 0.4]) ] theta = TexMobject("\\theta") theta.shift(arcs[0].get_center()+2.5*DOWN) arrow = Arrow(theta, arcs[0]) self.add(words, koch) self.play(ShowCreation(arcs[0])) self.play( ShowCreation(arrow), ShimmerIn(theta) ) self.dither(2) self.remove(theta, arrow) self.play( Transform(koch, duller_koch), Transform(arcs[0], arcs[2]), ) self.play( Transform(koch, sharper_koch), Transform(arcs[0], arcs[1]), ) self.clear()
def construct(self): words = TextMobject("Order 3 Pseudo-Hilbert Curve") words.highlight(GREEN) words.to_edge(UP) grid4 = Mobject( Grid(2, 2), Grid(4, 4, stroke_width = 2) ) grid8 = Grid(8, 8, stroke_width = 1) order_3_curve = HilbertCurve(order = 3) mini_curves = [ HilbertCurve(order = 2).scale(0.5).shift(1.5*vect) for vect in [ LEFT+DOWN, LEFT+UP, RIGHT+UP, RIGHT+DOWN ] ] self.add(words, grid4) self.dither() self.play(ShowCreation(grid8)) self.dither() self.play(*map(GrowFromCenter, mini_curves)) self.dither() self.clear() self.add(words, grid8, *mini_curves) self.play(*[ ApplyMethod(curve.rotate_in_place, np.pi, axis) for curve, axis in [ (mini_curves[0], UP+RIGHT), (mini_curves[3], UP+LEFT) ] ]) self.play(ShowCreation(order_3_curve, run_time = 5)) self.dither()
def construct(self): horiz_radius = 5 vert_radius = 3 vert_axis = NumberLine(numerical_radius = vert_radius) vert_axis.rotate(np.pi/2) vert_axis.shift(horiz_radius*LEFT) horiz_axis = NumberLine( numerical_radius = 5, numbers_with_elongated_ticks = [] ) axes = Mobject(horiz_axis, vert_axis) graph = FunctionGraph( lambda x : 0.4*(x-2)*(x+2)+3, x_min = -2, x_max = 2, density = 3*DEFAULT_POINT_DENSITY_1D ) graph.stretch_to_fit_width(2*horiz_radius) graph.highlight(YELLOW) min_point = Dot(graph.get_bottom()) nature_finds = TextMobject("Nature finds this point") nature_finds.scale(0.5) nature_finds.highlight(GREEN) nature_finds.shift(2*RIGHT+3*UP) arrow = Arrow( nature_finds.get_bottom(), min_point, color = GREEN ) side_words_start = TextMobject("Parameter describing") top_words, last_side_words = [ map(TextMobject, pair) for pair in [ ("Light's travel time", "Potential energy"), ("path", "mechanical state") ] ] for word in top_words + last_side_words + [side_words_start]: word.scale(0.7) side_words_start.next_to(horiz_axis, DOWN) side_words_start.to_edge(RIGHT) for words in top_words: words.next_to(vert_axis, UP) words.to_edge(LEFT) for words in last_side_words: words.next_to(side_words_start, DOWN) for words in top_words[1], last_side_words[1]: words.highlight(RED) self.add( axes, top_words[0], side_words_start, last_side_words[0] ) self.play(ShowCreation(graph)) self.play( ShimmerIn(nature_finds), ShowCreation(arrow), ShowCreation(min_point) ) self.dither() self.play( FadeOut(top_words[0]), FadeOut(last_side_words[0]), GrowFromCenter(top_words[1]), GrowFromCenter(last_side_words[1]) ) self.dither(3)
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): optics = TextMobject("Optics") optics.to_edge(UP) self.add(optics) self.has_started = False PhotonThroughLens.construct(self)