Example #1
0
    def construct(self):
        randy = Randolph().to_corner()
        bubble = randy.get_bubble()
        bubble.content_scale_factor = 0.6
        bubble.add_content(TOP(2, 3, 8).scale(0.7))
        equation = VMobject(
            TOP(2, "x"), 
            TexMobject("\\times"),
            TOP(2, "y"),
            TexMobject("="),
            TOP(2, "x+y")
        )
        equation.arrange_submobjects()
        q_marks = TextMobject("???")
        q_marks.set_color(YELLOW)
        q_marks.next_to(randy, UP)

        self.add(randy)
        self.play(FadeIn(bubble))
        self.wait()
        top = bubble.content
        bubble.add_content(equation)
        self.play(
            FadeOut(top),
            ApplyMethod(randy.change_mode, "sassy"),
            Write(bubble.content),
            Write(q_marks),
            run_time = 1
        )
        self.wait(3)
Example #2
0
    def construct(self):
        words = TextMobject("Change we can believe in")
        change = VMobject(*words.split()[:6])
        top = TOP(radius=0.75)
        top.shift(change.get_right() - top.get_right())

        self.play(Write(words))
        self.play(FadeOut(change), GrowFromCenter(top))
        self.wait(3)
Example #3
0
    def construct(self):
        words = TextMobject("Change we can believe in")
        change = VMobject(*words.split()[:6])
        top = TOP(radius = 0.75)
        top.shift(change.get_right()-top.get_right())

        self.play(Write(words))
        self.play(
            FadeOut(change),
            GrowFromCenter(top)
        )
        self.wait(3)
Example #4
0
    def construct(self):
        equation = VMobject(*[
            TOP(2, None, "x"),
            TexMobject("+"),
            TOP(2, None, "y"),
            TexMobject("="),
            TOP(2, None, "xy")
        ]).arrange()
        old_eq = TexMobject("\\log_2(x) + \\log_2(y) = \\log_2(xy)")
        old_eq.to_edge(UP)

        self.play(FadeIn(equation))
        self.wait(3)
        self.play(FadeIn(old_eq))
        self.wait(2)
Example #5
0
 def get_exp_anim(self, center):
     epii = TexMobject("e^{\\pi i} = -1")
     epii.shift(center)
     top = TOP("e", "\\pi i", "-1", radius=0.75)
     top.shift(center)
     e, pi, i, equals, minus, one = epii.split()
     ##hacky
     loop = e.submobjects[0]
     loop.is_subpath = False
     loop.set_fill(BLACK, 1.0)
     e.submobjects = []
     ##
     start = VMobject(equals, VMobject(e, loop), VMobject(pi, i),
                      VMobject(minus, one))
     return Transform(start, top)
Example #6
0
    def construct(self):
        top = TOP("x", "y", "z", radius = 0.75)
        top.set_color(BLUE)
        alts = VMobject(*list(map(TexMobject, [
            "x^y", "\\log_x(z)", "\\sqrt[y]{z}"
        ])))
        for mob, color in zip(alts.split(), OPERATION_COLORS):
            mob.set_color(color)
        alts.arrange(DOWN)
        greater_than = TexMobject(">")
        top.next_to(greater_than, LEFT)
        alts.next_to(greater_than, RIGHT)

        self.play(Write(VMobject(top, greater_than, alts)))
        self.wait()
Example #7
0
 def get_log_anim(self, center):
     O_log_n = TexMobject(["O(", "\\log(n)", ")"])
     O_log_n.shift(center)
     log_n = O_log_n.split()[1]
     #super hacky
     g = log_n.split()[2]
     for mob in g.submobjects:
         mob.is_subpath = False 
         mob.set_fill(BLACK, 1.0)
         log_n.add(mob)
     g.submobjects = []
     #end hack
     top = TOP(2, None, "n", radius = 0.75)
     top.set_width(log_n.get_width())
     top.shift(log_n.get_center())
     new_O_log_n = O_log_n.copy()
     new_O_log_n.submobjects[1] = top
     return Transform(O_log_n, new_O_log_n)
Example #8
0
 def get_exp_anim(self, center):
     epii = TexMobject("e^{\\pi i} = -1")
     epii.shift(center)
     top = TOP("e", "\\pi i", "-1", radius = 0.75)
     top.shift(center)
     e, pi, i, equals, minus, one = epii.split()
     ##hacky
     loop = e.submobjects[0]
     loop.is_subpath = False
     loop.set_fill(BLACK, 1.0)
     e.submobjects = []
     ##
     start = VMobject(
         equals,
         VMobject(e, loop), 
         VMobject(pi, i),
         VMobject(minus, one)
     )
     return Transform(start, top)
Example #9
0
	def construct(self):
		circle = Circle()
		randy = Randolph().to_corner()
		buddy = randy.get_bubble()
		buddy.content_scale_factor = 0.8
		buddy.add_content(TOP(2,3,4).scale(0.8))		
		self.add(randy)
		self.play(ShowCreation(circle))
		self.wait()
		self.play(FadeIn(buddy))
		self.wait()
Example #10
0
    def construct(self):
        top = TOP()
        start_two = top.put_on_vertex(2, 2)
        end_two = top.put_on_vertex(0, 2)
        x = top.put_on_vertex(1, "x")
        one_over_x = top.put_on_vertex(1, "\\dfrac{1}{x}")
        x.set_color(GREEN)
        one_over_x.set_color(BLUE)
        start_two.set_color(YELLOW)
        end_two.set_color(YELLOW)

        self.add(top, start_two, x)
        self.wait()
        self.play(
            Transform(
                VMobject(start_two, x),
                VMobject(end_two, one_over_x)
            ),
            ApplyMethod(top.rotate, np.pi, UP, path_arc = np.pi/7)
        )
        self.wait()
Example #11
0
    def construct(self):
        top = TOP()
        left_times = top.put_in_vertex(0, TexMobject("\\times"))
        left_dot = top.put_in_vertex(0, Dot())
        right_times = top.put_in_vertex(2, TexMobject("\\times"))
        right_dot = top.put_in_vertex(2, Dot())
        plus = top.put_in_vertex(1, TexMobject("+"))
        oplus = top.put_in_vertex(1, TexMobject("\\oplus"))
        left_times.set_color(YELLOW)
        right_times.set_color(YELLOW)
        plus.set_color(GREEN)
        oplus.set_color(BLUE)

        self.add(top, left_dot, plus, right_times)
        self.wait()
        self.play(
            Transform(VMobject(left_dot, plus, right_times),
                      VMobject(right_dot, oplus, left_times),
                      path_arc=np.pi / 2))
        self.wait()
Example #12
0
    def construct(self):
        top = TOP("x", "y", "z", radius=0.75)
        top.set_color(BLUE)
        alts = VMobject(
            *list(map(TexMobject, ["x^y", "\\log_x(z)", "\\sqrt[y]{z}"])))
        for mob, color in zip(alts.split(), OPERATION_COLORS):
            mob.set_color(color)
        alts.arrange(DOWN)
        greater_than = TexMobject(">")
        top.next_to(greater_than, LEFT)
        alts.next_to(greater_than, RIGHT)

        self.play(Write(VMobject(top, greater_than, alts)))
        self.wait()
Example #13
0
    def construct(self):
        assyms_of_top = VMobject(
            TextMobject("Asymmetries of "),
            TOP("a", "b", "c", radius=0.75).set_color(BLUE)).arrange()
        assyms_of_top.to_edge(UP)
        assyms_of_math = TextMobject("""
            Asymmetries of 
            $\\underbrace{a \\cdot a \\cdots a}_{\\text{$b$ times}} = c$
        """)
        VMobject(*assyms_of_math.split()[13:]).set_color(YELLOW)
        assyms_of_math.next_to(assyms_of_top, DOWN, buff=2)
        rad = TexMobject("\\sqrt{\\quad}").to_edge(LEFT).shift(UP)
        rad.set_color(RED)
        log = TexMobject("\\log").next_to(rad, DOWN)
        log.set_color(RED)

        self.play(FadeIn(assyms_of_top))
        self.wait()
        self.play(FadeIn(assyms_of_math))
        self.wait()
        self.play(Write(VMobject(rad, log)))
        self.wait()
Example #14
0
    def construct(self):
        top = TOP()
        start_two = top.put_on_vertex(2, 2)
        end_two = top.put_on_vertex(0, 2)
        x = top.put_on_vertex(1, "x")
        one_over_x = top.put_on_vertex(1, "\\dfrac{1}{x}")
        x.set_color(GREEN)
        one_over_x.set_color(BLUE)
        start_two.set_color(YELLOW)
        end_two.set_color(YELLOW)

        self.add(top, start_two, x)
        self.wait()
        self.play(
            Transform(VMobject(start_two, x), VMobject(end_two, one_over_x)),
            ApplyMethod(top.rotate, np.pi, UP, path_arc=np.pi / 7))
        self.wait()
Example #15
0
 def get_log_anim(self, center):
     O_log_n = TexMobject(["O(", "\\log(n)", ")"])
     O_log_n.shift(center)
     log_n = O_log_n.split()[1]
     #super hacky
     g = log_n.split()[2]
     for mob in g.submobjects:
         mob.is_subpath = False
         mob.set_fill(BLACK, 1.0)
         log_n.add(mob)
     g.submobjects = []
     #end hack
     top = TOP(2, None, "n", radius=0.75)
     top.set_width(log_n.get_width())
     top.shift(log_n.get_center())
     new_O_log_n = O_log_n.copy()
     new_O_log_n.submobjects[1] = top
     return Transform(O_log_n, new_O_log_n)
Example #16
0
    def construct(self):
        top = TOP()
        left_times  = top.put_in_vertex(0, TexMobject("\\times"))
        left_dot    = top.put_in_vertex(0, Dot())
        right_times = top.put_in_vertex(2, TexMobject("\\times"))
        right_dot   = top.put_in_vertex(2, Dot())
        plus        = top.put_in_vertex(1, TexMobject("+"))
        oplus       = top.put_in_vertex(1, TexMobject("\\oplus"))
        left_times.set_color(YELLOW)        
        right_times.set_color(YELLOW)        
        plus.set_color(GREEN)        
        oplus.set_color(BLUE)

        self.add(top, left_dot, plus, right_times)
        self.wait()
        self.play(
            Transform(
                VMobject(left_dot, plus, right_times),
                VMobject(right_dot, oplus, left_times),
                path_arc = np.pi/2
            )
        )
        self.wait()