def construct(self): names = [ "Johann_Bernoulli2", "Jacob_Bernoulli", "Gottfried_Wilhelm_von_Leibniz", "Newton" ] guys = [ImageMobject(name, invert=False) for name in names] johann = guys[0] johann.scale(0.8) pensive_johann = johann.copy() pensive_johann.scale(0.25) pensive_johann.to_corner(DOWN + LEFT) comparitive_johann = johann.copy() template = Square(side_length=2) comparitive_johann.replace(template) comparitive_johann.shift(UP + LEFT) greater_than = TexMobject(">") greater_than.next_to(comparitive_johann) for guy, name in zip(guys, names)[1:]: guy.replace(template) guy.next_to(greater_than) name_mob = TextMobject(name.replace("_", " ")) name_mob.scale(0.5) name_mob.next_to(guy, DOWN) guy.name_mob = name_mob guy.sort_points(lambda p: np.dot(p, DOWN + RIGHT)) bubble = ThoughtBubble(initial_width=12) bubble.stretch_to_fit_height(6) bubble.ingest_submobjects() bubble.pin_to(pensive_johann) bubble.shift(DOWN) point = Point(johann.get_corner(UP + RIGHT)) upper_point = Point(comparitive_johann.get_corner(UP + RIGHT)) lightbulb = ImageMobject("Lightbulb", invert=False) lightbulb.scale(0.1) lightbulb.sort_points(np.linalg.norm) lightbulb.next_to(upper_point, RIGHT) self.add(johann) self.wait() self.play(Transform(johann, pensive_johann), Transform(point, bubble), run_time=2) self.remove(point) self.add(bubble) weakling = guys[1] self.play(FadeIn(comparitive_johann), ShowCreation(greater_than), FadeIn(weakling)) self.wait(2) for guy in guys[2:]: self.play(DelayByOrder(Transform(weakling, upper_point))) self.play(FadeIn(guy), ShimmerIn(guy.name_mob)) self.wait(3) self.remove(guy.name_mob) weakling = guy self.play(FadeOut(weakling), FadeOut(greater_than)) self.play(ShowCreation(lightbulb)) self.wait() self.play(FadeOut(comparitive_johann), FadeOut(lightbulb)) self.play(ApplyMethod(Mobject(johann, bubble).scale, 10, run_time=3))
def construct(self): self.bubble = ThoughtBubble().ingest_submobjects() self.bubble.scale(1.5) TransformOverIncreasingOrders.construct(self, FlowSnake, 7) self.play(Transform(self.curve, self.bubble)) self.show_infinite_objects() self.pose_question() self.dither()
def construct(self): johann, fermat = [ ImageMobject(name, invert=False) for name in "Johann_Bernoulli2", "Pierre_de_Fermat" ] johann.scale(0.2) johann.to_corner(DOWN + LEFT) bubble = ThoughtBubble(initial_width=12) bubble.stretch_to_fit_height(6) bubble.pin_to(johann) bubble.shift(DOWN) bubble.add_content(fermat) fermat.scale_in_place(0.4) self.add(johann, bubble) self.wait() self.play(FadeIn(fermat)) self.wait()
def construct(self): johann, fermat = [ ImageMobject(name, invert = False) for name in "Johann_Bernoulli2", "Pierre_de_Fermat" ] johann.scale(0.2) johann.to_corner(DOWN+LEFT) bubble = ThoughtBubble(initial_width = 12) bubble.stretch_to_fit_height(6) bubble.pin_to(johann) bubble.shift(DOWN) bubble.add_content(fermat) fermat.scale_in_place(0.4) self.add(johann, bubble) self.dither() self.play(FadeIn(fermat)) self.dither()
def construct(self): names = [ "Johann_Bernoulli2", "Jacob_Bernoulli", "Gottfried_Wilhelm_von_Leibniz", "Newton" ] guys = [ ImageMobject(name, invert = False) for name in names ] johann = guys[0] johann.scale(0.8) pensive_johann = johann.copy() pensive_johann.scale(0.25) pensive_johann.to_corner(DOWN+LEFT) comparitive_johann = johann.copy() template = Square(side_length = 2) comparitive_johann.replace(template) comparitive_johann.shift(UP+LEFT) greater_than = TexMobject(">") greater_than.next_to(comparitive_johann) for guy, name in zip(guys, names)[1:]: guy.replace(template) guy.next_to(greater_than) name_mob = TextMobject(name.replace("_", " ")) name_mob.scale(0.5) name_mob.next_to(guy, DOWN) guy.name_mob = name_mob guy.sort_points(lambda p : np.dot(p, DOWN+RIGHT)) bubble = ThoughtBubble(initial_width = 12) bubble.stretch_to_fit_height(6) bubble.ingest_submobjects() bubble.pin_to(pensive_johann) bubble.shift(DOWN) point = Point(johann.get_corner(UP+RIGHT)) upper_point = Point(comparitive_johann.get_corner(UP+RIGHT)) lightbulb = ImageMobject("Lightbulb", invert = False) lightbulb.scale(0.1) lightbulb.sort_points(np.linalg.norm) lightbulb.next_to(upper_point, RIGHT) self.add(johann) self.dither() self.play( Transform(johann, pensive_johann), Transform(point, bubble), run_time = 2 ) self.remove(point) self.add(bubble) weakling = guys[1] self.play( FadeIn(comparitive_johann), ShowCreation(greater_than), FadeIn(weakling) ) self.dither(2) for guy in guys[2:]: self.play(DelayByOrder(Transform( weakling, upper_point ))) self.play( FadeIn(guy), ShimmerIn(guy.name_mob) ) self.dither(3) self.remove(guy.name_mob) weakling = guy self.play(FadeOut(weakling), FadeOut(greater_than)) self.play(ShowCreation(lightbulb)) self.dither() self.play(FadeOut(comparitive_johann), FadeOut(lightbulb)) self.play(ApplyMethod( Mobject(johann, bubble).scale, 10, run_time = 3 ))
class AboutSpaceFillingCurves(TransformOverIncreasingOrders): @staticmethod def args_to_string(): return "" @staticmethod def string_to_args(arg_str): return () def construct(self): self.bubble = ThoughtBubble().ingest_submobjects() self.bubble.scale(1.5) TransformOverIncreasingOrders.construct(self, FlowSnake, 7) self.play(Transform(self.curve, self.bubble)) self.show_infinite_objects() self.pose_question() self.dither() def show_infinite_objects(self): sigma, summand, equals, result = TexMobject([ "\\sum_{n = 1}^{\\infty}", "\\dfrac{1}{n^2}", "=", "\\dfrac{\pi^2}{6}" ]).split() alt_summand = TexMobject("n").replace(summand) alt_result = TexMobject("-\\dfrac{1}{12}").replace(result) rationals, other_equals, naturals = TexMobject([ "|\\mathds{Q}|", "=", "|\\mathds{N}|" ]).scale(2).split() infinity = TexMobject("\\infty").scale(2) local_mobjects = filter( lambda m : isinstance(m, Mobject), locals().values(), ) for mob in local_mobjects: mob.sort_points(np.linalg.norm) self.play(ShimmerIn(infinity)) self.dither() self.play( ShimmerIn(summand), ShimmerIn(equals), ShimmerIn(result), DelayByOrder(Transform(infinity, sigma)) ) self.dither() self.play( Transform(summand, alt_summand), Transform(result, alt_result), ) self.dither() self.remove(infinity) self.play(*[ CounterclockwiseTransform( Mobject(summand, equals, result, sigma), Mobject(rationals, other_equals, naturals) ) ]) self.dither() self.clear() self.add(self.bubble) def pose_question(self): infinity, rightarrow, N = TexMobject([ "\\infty", "\\rightarrow", "N" ]).scale(2).split() question_mark = TextMobject("?").scale(2) self.add(question_mark) self.dither() self.play(*[ ShimmerIn(mob) for mob in infinity, rightarrow, N ] + [ ApplyMethod(question_mark.next_to, rightarrow, UP), ]) self.dither()