def construct(self): dated_events = [ { "date" : 1696, "text": "Johann Bernoulli poses Brachistochrone problem", "picture" : "Johann_Bernoulli2" }, { "date" : 1662, "text" : "Fermat states his principle of least time", "picture" : "Pierre_de_Fermat" } ] speical_dates = [2016] + [ obj["date"] for obj in dated_events ] centuries = range(1600, 2100, 100) timeline = NumberLine( numerical_radius = 300, number_at_center = 1800, unit_length_to_spatial_width = SPACE_WIDTH/100, tick_frequency = 10, numbers_with_elongated_ticks = centuries ) timeline.add_numbers(*centuries) centers = [ Point(timeline.number_to_point(year)) for year in speical_dates ] timeline.add(*centers) timeline.shift(-centers[0].get_center()) self.add(timeline) self.dither() run_times = iter([3, 1]) for point, event in zip(centers[1:], dated_events): self.play(ApplyMethod( timeline.shift, -point.get_center(), run_time = run_times.next() )) picture = ImageMobject(event["picture"], invert = False) picture.scale_to_fit_width(2) picture.to_corner(UP+RIGHT) event_mob = TextMobject(event["text"]) event_mob.shift(2*LEFT+2*UP) date_mob = TexMobject(str(event["date"])) date_mob.scale(0.5) date_mob.shift(0.6*UP) line = Line(event_mob.get_bottom(), 0.2*UP) self.play( ShimmerIn(event_mob), ShowCreation(line), ShimmerIn(date_mob) ) self.play(FadeIn(picture)) self.dither(3) self.play(*map(FadeOut, [event_mob, date_mob, line, picture]))
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 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): 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): 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): image = ImageMobject(os.path.join(RESOURCE_DIR, "dalembert_zoom")) image.scale_to_fit_width(2 * SPACE_WIDTH - 1) image.to_edge(UP, buff=MED_SMALL_BUFF) image.fade(0.15) rect = Rectangle( width=12, height=0.5, stroke_width=0, fill_opacity=0.3, fill_color=GREEN, ) rect.insert_n_anchor_points(20) rect.apply_function( lambda p: np.array([p[0], p[1] - 0.005 * p[0]**2, p[2]])) rect.rotate(0.012 * TAU) rect.move_to(image) rect.shift(0.15 * DOWN) words = TextMobject( "``Let", "$\\pi$", "be the", "circumference", "of a circle whose", "radius = 1''", ) words.highlight_by_tex_to_color_map({ "circumference": YELLOW, "radius": GREEN, }) words.next_to(image, DOWN) pi = words.get_part_by_tex("\\pi").copy() terms, generate_anims1, generate_anims2 = get_circle_drawing_terms( radius=1, positioning_func=lambda circ: circ.next_to(words, DOWN, buff=1.25)) circle, radius, one, decimal = terms unwrapped_perimeter = Line(ORIGIN, TAU * RIGHT) unwrapped_perimeter.match_style(circle) unwrapped_perimeter.next_to(circle, DOWN) brace = Brace(unwrapped_perimeter, UP, buff=SMALL_BUFF) perimeter = TexMobject( "\\pi\\epsilon\\rho\\iota\\mu\\epsilon\\tau\\rho\\text{o}\\varsigma", "\\text{ (perimeter)}", "=") perimeter.next_to(brace, UP, submobject_to_align=perimeter[1], buff=SMALL_BUFF) perimeter[0][0].highlight(GREEN) self.play(FadeInFromDown(image)) self.play(Write(words), GrowFromPoint(rect, rect.point_from_proportion(0.9))) self.wait() self.play(*generate_anims1()) self.play(*generate_anims2()) self.play(terms.shift, UP) self.play(pi.scale, 2, pi.shift, DOWN, pi.highlight, GREEN) self.wait() self.play( GrowFromCenter(brace), circle.set_stroke, YELLOW, 1, ReplacementTransform(circle.copy(), unwrapped_perimeter), decimal.scale, 1.25, decimal.next_to, perimeter[-1].get_right(), RIGHT, ReplacementTransform(pi, perimeter[0][0]), Write(perimeter), ) self.wait()