Exemplo n.º 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"), 
            Tex("\\times"),
            TOP(2, "y"),
            Tex("="),
            TOP(2, "x+y")
        )
        equation.arrange()
        q_marks = TexText("???")
        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)
Exemplo n.º 2
0
    def construct(self):
        words = TexText("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)
Exemplo n.º 3
0
 def construct(self):
     equation = VMobject(*[
         TOP(2, None, "x"), 
         Tex("+"),
         TOP(2, None, "y"),
         Tex("="),
         TOP(2, None, "xy")
     ]).arrange()
     old_eq = Tex("\\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)
Exemplo n.º 4
0
 def get_exp_anim(self, center):
     epii = Tex("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)
Exemplo n.º 5
0
    def construct(self):
        top = TOP("x", "y", "z", radius = 0.75)
        top.set_color(BLUE)
        alts = VMobject(*list(map(Tex, [
            "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 = Tex(">")
        top.next_to(greater_than, LEFT)
        alts.next_to(greater_than, RIGHT)

        self.play(Write(VMobject(top, greater_than, alts)))
        self.wait()
Exemplo n.º 6
0
    def construct(self):
        top = TOP()
        left_times  = top.put_in_vertex(0, Tex("\\times"))
        left_dot    = top.put_in_vertex(0, Dot())
        right_times = top.put_in_vertex(2, Tex("\\times"))
        right_dot   = top.put_in_vertex(2, Dot())
        plus        = top.put_in_vertex(1, Tex("+"))
        oplus       = top.put_in_vertex(1, Tex("\\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()
Exemplo n.º 7
0
    def construct(self):
        assyms_of_top = VMobject(
            TexText("Asymmetries of "),
            TOP("a", "b", "c", radius = 0.75).set_color(BLUE)
        ).arrange()
        assyms_of_top.to_edge(UP)
        assyms_of_math = TexText("""
            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 = Tex("\\sqrt{\\quad}").to_edge(LEFT).shift(UP)
        rad.set_color(RED)
        log = Tex("\\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()
Exemplo n.º 8
0
 def get_log_anim(self, center):
     O_log_n = Tex(["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)
Exemplo n.º 9
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()