def construct(self): europe = ImageMobject("Europe", use_cache = False) self.add(europe) self.freeze_background() mathematicians = [ ("Newton", [-1.75, -0.75, 0]), ("Jacob_Bernoulli",[-0.75, -1.75, 0]), ("Ehrenfried_von_Tschirnhaus",[0.5, -0.5, 0]), ("Gottfried_Wilhelm_von_Leibniz",[0.2, -1.75, 0]), ("Guillaume_de_L'Hopital", [-1.75, -1.25, 0]), ] for name, point in mathematicians: man = ImageMobject(name, invert = False) if name == "Newton": name = "Isaac_Newton" name_mob = TextMobject(name.replace("_", " ")) name_mob.to_corner(UP+LEFT, buff=0.75) self.add(name_mob) man.scale_to_fit_height(4) mobject = Point(man.get_corner(UP+LEFT)) self.play(Transform(mobject, man)) man.scale(0.2) man.shift(point) self.play(Transform(mobject, man)) self.remove(name_mob)
def construct(self): headphones = ImageMobject("Headphones.png") headphones.scale(0.1) headphones.stretch(2, 0) headphones.shift(1.2*UP+0.05*LEFT) headphones.highlight(GREY) randy = Randolph() self.add(randy, headphones) self.dither(2) self.play(ApplyMethod(randy.blink)) self.dither(4)
def construct(self): image = ImageMobject("lion", invert=False) image.scale(0.5) image.shift(2 * LEFT) self.add(image) for vect, num in zip([DOWN, RIGHT], [1, 2]): brace = Brace(image, vect) words_mob = TextMobject("Dimension %d" % num) words_mob.next_to(image, vect, buff=1) self.play(Transform(Point(brace.get_center()), brace), ShimmerIn(words_mob), run_time=2) self.dither()
def construct(self): image = ImageMobject("lion", invert = False) image.scale(0.5) image.shift(2*LEFT) self.add(image) for vect, num in zip([DOWN, RIGHT], [1, 2]): brace = Brace(image, vect) words_mob = TextMobject("Dimension %d"%num) words_mob.next_to(image, vect, buff = 1) self.play( Transform(Point(brace.get_center()), brace), ShimmerIn(words_mob), run_time = 2 ) self.dither()
def four_billion_earths(self): self.create_four_billion_copies( 3, self.get_earth() ) milky_way = ImageMobject("milky_way") milky_way.scale_to_fit_height(3) milky_way.to_edge(LEFT, buff = 0) milky_way.shift(DOWN) n_stars_estimate = TextMobject("100 to 400 \\\\ billion stars") n_stars_estimate.next_to(milky_way, RIGHT) n_stars_estimate.shift(UP) earth, h_line, denom = self.get_fraction( 3, self.get_earth(), self.get_galaxy() ) self.revert_to_original_skipping_status() self.play(FadeIn(milky_way)) self.play(Write(n_stars_estimate)) self.dither() self.play(LaggedStart( Indicate, self.group_of_four_billion_things, rate_func = there_and_back, lag_ratio = 0.2, run_time = 3, )) self.dither() self.play( ReplacementTransform( self.group_of_four_billion_things, VGroup(earth) ), ShowCreation(h_line), FadeIn(denom), self.four_billions[3].restore, FadeOut(milky_way), FadeOut(n_stars_estimate), ) self.dither()
def four_billion_earths(self): self.create_four_billion_copies(3, self.get_earth()) milky_way = ImageMobject("milky_way") milky_way.scale_to_fit_height(3) milky_way.to_edge(LEFT, buff=0) milky_way.shift(DOWN) n_stars_estimate = TextMobject("100 to 400 \\\\ billion stars") n_stars_estimate.next_to(milky_way, RIGHT) n_stars_estimate.shift(UP) earth, h_line, denom = self.get_fraction(3, self.get_earth(), self.get_galaxy()) self.revert_to_original_skipping_status() self.play(FadeIn(milky_way)) self.play(Write(n_stars_estimate)) self.dither() self.play( LaggedStart( Indicate, self.group_of_four_billion_things, rate_func=there_and_back, lag_ratio=0.2, run_time=3, )) self.dither() self.play( ReplacementTransform(self.group_of_four_billion_things, VGroup(earth)), ShowCreation(h_line), FadeIn(denom), self.four_billions[3].restore, FadeOut(milky_way), FadeOut(n_stars_estimate), ) 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): 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()