示例#1
0
    def construct(self):
        words = TextMobject([
            "One does not simply define the limit \\\\ \
            of a sequence of", "curves", "\\dots"
        ])
        top_words = TextMobject(["curves", "are functions"]).to_edge(UP)
        curves1 = words.split()[1]
        curves2 = top_words.split()[0]
        words.ingest_submobjects()
        number = TexMobject("0.27")
        pair = TexMobject("(0.53, 0.02)")
        pair.next_to(number, buff=2)
        arrow = Arrow(number, pair)
        Mobject(number, arrow, pair).center().shift(UP)
        number_line = UnitInterval()
        number_line.stretch_to_fit_width(5)
        number_line.to_edge(LEFT).shift(DOWN)
        grid = Grid(4, 4).scale(0.4)
        grid.next_to(number_line, buff=2)
        low_arrow = Arrow(number_line, grid)

        self.play(ShimmerIn(words))
        self.dither()
        self.play(FadeOut(words), ApplyMethod(curves1.replace, curves2),
                  ShimmerIn(top_words.split()[1]))
        self.dither()
        self.play(FadeIn(number))
        self.play(ShowCreation(arrow))
        self.play(FadeIn(pair))
        self.dither()
        self.play(ShowCreation(number_line))
        self.play(ShowCreation(low_arrow))
        self.play(ShowCreation(grid))
        self.dither()
示例#2
0
    def setup_axes(self, animate=False):
        ##TODO, once eoc is done, refactor this to be less redundant.
        x_num_range = float(self.x_max - self.x_min)
        self.space_unit_to_x = self.x_axis_width / x_num_range
        self.x_labeled_nums = self.x_labeled_nums or []
        if self.x_leftmost_tick is None:
            self.x_leftmost_tick = self.x_min
        x_axis = NumberLine(x_min=self.x_min,
                            x_max=self.x_max,
                            unit_size=self.space_unit_to_x,
                            tick_frequency=self.x_tick_frequency,
                            leftmost_tick=self.x_leftmost_tick,
                            numbers_with_elongated_ticks=self.x_labeled_nums,
                            color=self.axes_color)
        x_axis.shift(self.graph_origin - x_axis.number_to_point(0))
        if len(self.x_labeled_nums) > 0:
            if self.exclude_zero_label:
                self.x_labeled_nums = filter(lambda x: x != 0,
                                             self.x_labeled_nums)
            x_axis.add_numbers(*self.x_labeled_nums)
        x_label = TextMobject(self.x_axis_label)
        x_label.next_to(x_axis.get_tick_marks(), UP + RIGHT, buff=SMALL_BUFF)
        x_label.shift_onto_screen()
        x_axis.add(x_label)
        self.x_axis_label_mob = x_label

        y_num_range = float(self.y_max - self.y_min)
        self.space_unit_to_y = self.y_axis_height / y_num_range
        self.y_labeled_nums = self.y_labeled_nums or []
        if self.y_bottom_tick is None:
            self.y_bottom_tick = self.y_min
        y_axis = NumberLine(x_min=self.y_min,
                            x_max=self.y_max,
                            unit_size=self.space_unit_to_y,
                            tick_frequency=self.y_tick_frequency,
                            leftmost_tick=self.y_bottom_tick,
                            numbers_with_elongated_ticks=self.y_labeled_nums,
                            color=self.axes_color)
        y_axis.shift(self.graph_origin - y_axis.number_to_point(0))
        y_axis.rotate(np.pi / 2, about_point=y_axis.number_to_point(0))
        if len(self.y_labeled_nums) > 0:
            if self.exclude_zero_label:
                self.y_labeled_nums = filter(lambda y: y != 0,
                                             self.y_labeled_nums)
            y_axis.add_numbers(*self.y_labeled_nums)
            for mob in y_axis.numbers:
                mob.next_to(mob.get_center(), LEFT, MED_SMALL_BUFF)
                mob.shift(self.y_axis_numbers_nudge)
        y_label = TextMobject(self.y_axis_label)
        y_label.next_to(y_axis.get_tick_marks(), UP + RIGHT, buff=SMALL_BUFF)
        y_label.shift_onto_screen()
        y_axis.add(y_label)
        self.y_axis_label_mob = y_label

        if animate:
            self.play(Write(VGroup(x_axis, y_axis)))
        else:
            self.add(x_axis, y_axis)
        self.x_axis, self.y_axis = self.axes = VGroup(x_axis, y_axis)
        self.default_graph_colors = it.cycle(self.default_graph_colors)
示例#3
0
    def construct(self):
        CycloidScene.construct(self)

        equation = TexMobject(
            ["\\dfrac{\\sin(\\theta)}{\\sqrt{y}}", "= \\text{constant}"])
        sin_sqrt, const = equation.split()
        new_eq = equation.copy()
        new_eq.to_edge(UP, buff=1.3)
        cycloid_word = TextMobject("Cycloid")
        arrow = Arrow(2 * UP, cycloid_word)
        arrow.reverse_points()
        q_mark = TextMobject("?")

        self.play(*map(ShimmerIn, equation.split()))
        self.dither()
        self.play(ApplyMethod(equation.shift, 2.2 * UP), ShowCreation(arrow))
        q_mark.next_to(sin_sqrt)
        self.play(ShimmerIn(cycloid_word))
        self.dither()
        self.grow_parts()
        self.draw_cycloid()
        self.dither()
        extra_terms = [const, arrow, cycloid_word]
        self.play(*[Transform(mob, q_mark) for mob in extra_terms])
        self.remove(*extra_terms)
        self.roll_back()
        q_marks, arrows = self.get_q_marks_and_arrows(sin_sqrt)
        self.draw_cycloid(3, ShowCreation(q_marks), ShowCreation(arrows))
        self.dither()
示例#4
0
    def construct(self):
        one_solution = TextMobject(["One ", "solution"])
        two_insights = TextMobject(["Two ", " insights"])
        two, insights = two_insights.split()
        johann = ImageMobject("Johann_Bernoulli2", invert=False)
        mark = ImageMobject("Mark_Levi", invert=False)
        for mob in johann, mark:
            mob.scale(0.4)
        johann.next_to(insights, LEFT)
        mark.next_to(johann, RIGHT)
        name = TextMobject("Mark Levi").to_edge(UP)

        self.play(*map(ShimmerIn, one_solution.split()))
        self.dither()
        for pair in zip(one_solution.split(), two_insights.split()):
            self.play(Transform(*pair, path_func=path_along_arc(np.pi)))
        self.dither()
        self.clear()
        self.add(two, insights)
        for word, man in [(two, johann), (insights, mark)]:
            self.play(Transform(word, Point(word.get_left())),
                      GrowFromCenter(man))
            self.dither()
        self.clear()
        self.play(ApplyMethod(mark.center))
        self.play(ShimmerIn(name))
        self.dither()
示例#5
0
    def finite_analog(self, left_mob, arrow, right_mob):
        self.clear()
        self.add(left_mob, arrow, right_mob)
        ex = TextMobject("\\times")
        ex.highlight(RED)
        # ex.shift(arrow.get_center())
        middle = TexMobject("\\sum_{n=0}^N 2^n \\equiv -1 \\mod 2^{N+1}")
        finite_analog = TextMobject("Finite analog")
        finite_analog.scale(0.8)
        brace = Brace(middle, UP)
        finite_analog.next_to(brace, UP)
        new_left = left_mob.copy().to_edge(LEFT)
        new_right = right_mob.copy().to_edge(RIGHT)
        left_arrow, right_arrow = [
            Arrow(mob1.get_right()[0] * RIGHT,
                  mob2.get_left()[0] * RIGHT,
                  buff=0)
            for mob1, mob2 in [(new_left, middle), (middle, new_right)]
        ]
        for mob in ex, middle:
            mob.sort_points(np.linalg.norm)

        self.play(GrowFromCenter(ex))
        self.wait()
        self.play(Transform(left_mob, new_left),
                  Transform(arrow.copy(), left_arrow),
                  DelayByOrder(Transform(ex, middle)),
                  Transform(arrow, right_arrow),
                  Transform(right_mob, new_right))
        self.play(GrowFromCenter(brace), ShimmerIn(finite_analog))
        self.wait()
        self.equivalence(left_mob, left_arrow,
                         Mobject(middle, brace, finite_analog))
示例#6
0
    def construct(self):
        definition = TexMobject([
            "\\text{HC}(", "x", ")",
            "=\\lim_{n \\to \\infty}\\text{PHC}_n(", "x", ")"
        ])
        definition.to_edge(UP)
        definition.split()[1].highlight(BLUE)
        definition.split()[-2].highlight(BLUE)
        intro = TextMobject("Three things need to be proven")
        prove_that = TextMobject("Prove that HC is $\\dots$")
        prove_that.scale(0.7)
        prove_that.to_edge(LEFT)
        items = TextMobject([
            "\\begin{enumerate}",
            "\\item Well-defined: ",
            "Points on Pseudo-Hilbert-curves really do converge",
            "\\item A Curve: ",
            "HC is continuous",
            "\\item Space-filling: ",
            "Each point in the unit square is an output of HC",
            "\\end{enumerate}",
        ]).split()
        items[1].highlight(GREEN)
        items[3].highlight(YELLOW_C)
        items[5].highlight(MAROON)
        Mobject(*items).to_edge(RIGHT)

        self.add(definition)
        self.play(ShimmerIn(intro))
        self.wait()
        self.play(Transform(intro, prove_that))
        for item in items[1:-1]:
            self.play(ShimmerIn(item))
            self.wait()
示例#7
0
    def construct(self):
        glass = Region(lambda x, y : y < 0, color = BLUE_E)
        self.generate_start_and_end_points()
        straight = Line(self.start_point, self.end_point)
        slow = TextMobject("Slow")
        slow.rotate(np.arctan(straight.get_slope()))
        slow.shift(straight.points[int(0.7*straight.get_num_points())])
        slow.shift(0.5*DOWN)
        too_long = TextMobject("Too long")
        too_long.shift(UP)
        air = TextMobject("Air").shift(2*UP)
        water = TextMobject("Water").shift(2*DOWN)

        self.add(glass)
        self.play(GrowFromCenter(air))
        self.play(GrowFromCenter(water))
        self.wait()
        self.remove(air, water)
        ShowMultiplePathsScene.construct(self)
        self.play(
            Transform(self.path, straight)
        )
        self.wait()
        self.play(GrowFromCenter(slow))
        self.wait()
        self.remove(slow)
        self.leftmost.ingest_submobjects()
        self.play(Transform(self.path, self.leftmost, run_time = 3))
        self.wait()
        self.play(ShimmerIn(too_long))
        self.wait()
示例#8
0
    def construct(self):
        text = TextMobject("Which path minimizes travel time?")
        text.to_edge(UP)
        self.generate_start_and_end_points()
        point_a = Dot(self.start_point)
        point_b = Dot(self.end_point)
        A = TextMobject("A").next_to(point_a, UP)
        B = TextMobject("B").next_to(point_b, DOWN)
        paths = self.get_paths()

        for point, letter in [(point_a, A), (point_b, B)]:
            self.play(
                ShowCreation(point),
                ShimmerIn(letter)
            )
        self.play(ShimmerIn(text))
        curr_path = paths[0].copy()
        curr_path_copy = curr_path.copy().ingest_submobjects()
        self.play(
            self.photon_run_along_path(curr_path),
            ShowCreation(curr_path_copy, rate_func = rush_into)
        )
        self.remove(curr_path_copy)
        for path in paths[1:] + [paths[0]]:
            self.play(Transform(curr_path, path, run_time = 4))
        self.wait()
        self.path = curr_path.ingest_submobjects()
示例#9
0
    def construct(self):
        words, s = TextMobject(["Pseudo-Hilbert Curve", "s"]).split()
        pre_words = TextMobject("Order 1")
        pre_words.next_to(words, LEFT, buff = 0.5)
        s.next_to(words, RIGHT, buff = 0.05, aligned_edge = DOWN)
        cluster = Mobject(pre_words, words, s)
        cluster.center()
        cluster.scale(0.7)
        cluster.to_edge(UP, buff = 0.3)
        cluster.highlight(GREEN)
        grid1 = Grid(1, 1)
        grid2 = Grid(2, 2)
        curve = HilbertCurve(order = 1)

        self.add(words, s)
        self.dither()
        self.play(Transform(
            s, pre_words, 
            path_func = path_along_arc(-np.pi/3)
        ))
        self.dither()
        self.play(ShowCreation(grid1))
        self.dither()
        self.play(ShowCreation(grid2))
        self.dither()
        kwargs = {
            "run_time" : 5,
            "rate_func" : None
        }
        self.play(ShowCreation(curve, **kwargs))
        self.dither()
示例#10
0
    def construct(self):
        grids = [
            Grid(
                2**order, 2**order,
                stroke_width = 1
            ).shift(0.3*DOWN)
            for order in 6, 7
        ]
        grid = grids[0]
        side_brace = Brace(grid, LEFT)
        top_brace = Brace(grid, UP)
        top_words = TextMobject("256")
        new_top_words = TextMobject("512")
        side_words = top_words.copy()
        new_side_words = new_top_words.copy()
        for words in top_words, new_top_words:
            words.next_to(top_brace, UP, buff = 0.1)
        for words in side_words, new_side_words:
            words.next_to(side_brace, LEFT)

        self.add(grid)
        self.play(
            GrowFromCenter(side_brace),
            GrowFromCenter(top_brace),
            ShimmerIn(top_words),
            ShimmerIn(side_words)
        )
        self.dither()
        self.play(
            DelayByOrder(Transform(*grids)),
            Transform(top_words, new_top_words),
            Transform(side_words, new_side_words)
        )
        self.dither()
示例#11
0
 def setup_background(self):
     glass = Region(lambda x, y : y < 0, color = BLUE_E)
     self.generate_start_and_end_points()
     point_a = Dot(self.start_point)
     point_b = Dot(self.end_point)
     A = TextMobject("A").next_to(point_a, UP)
     B = TextMobject("B").next_to(point_b, DOWN)
     self.add(glass, point_a, point_b, A, B)
示例#12
0
    def discontinuous_point(self):
        point_description = TextMobject("Point where the function jumps")
        point_description.shift(3 * RIGHT)
        discontinuous_at_A = TextMobject("``Discontinuous at A''",
                                         size="\\Large")
        discontinuous_at_A.shift(2 * UP).to_edge(LEFT)
        text = TextMobject("""
            Circle around ouput \\\\ 
            points can never \\\\
            be smaller than \\\\
            the jump
        """)
        text.scale(0.75)
        text.shift(3.5 * RIGHT)

        input_value = 0.5
        input_radius = 0.04
        vary_circles = VaryCircles(
            self,
            input_value,
            input_radius,
            run_time=5,
        )
        for dot in self.input_dot, self.output_dot:
            dot.center()
        kwargs = {
            "rate_func": lambda t: interpolate(0.45, input_value, smooth(t))
        }
        self.play(Homotopy(self.input_homotopy, self.input_dot, **kwargs),
                  Homotopy(self.output_homotopy, self.output_dot, **kwargs))
        discontinuous_arrow = Arrow(discontinuous_at_A, self.input_dot)
        arrow = Arrow(point_description,
                      self.output_dot,
                      buff=0.05,
                      color=self.output_color)
        self.play(ShimmerIn(point_description), ShowCreation(arrow))
        self.dither()
        self.remove(point_description, arrow)

        tup = self.get_circles_and_points(input_value - input_radius,
                                          input_value + input_radius)
        input_circle, input_points, output_circle, output_points = tup
        input_points_copy = input_points.copy()
        self.play(ShowCreation(input_circle))
        self.play(ShowCreation(input_points))
        self.play(Transform(input_points_copy, output_points), run_time=2)
        self.play(ShowCreation(output_circle))
        self.dither()
        self.play(ShimmerIn(text))
        self.remove(input_circle, input_points, output_circle,
                    input_points_copy)
        self.play(vary_circles)
        self.dither()
        self.play(ShimmerIn(discontinuous_at_A),
                  ShowCreation(discontinuous_arrow))
        self.dither(3)
        self.remove(vary_circles.mobject, discontinuous_at_A,
                    discontinuous_arrow)
示例#13
0
    def draw_circles(self):
        input_value = 0.45
        input_radius = 0.04
        for dot in self.input_dot, self.output_dot:
            dot.center()
        kwargs = {
            "rate_func" : lambda t : interpolate(1, input_value, smooth(t))
        }
        self.play(
            Homotopy(self.input_homotopy, self.input_dot, **kwargs),
            Homotopy(self.output_homotopy, self.output_dot, **kwargs)
        )

        A, B = map(Mobject.get_center, [self.input_dot, self.output_dot])
        A_text = TextMobject("A")
        A_text.shift(A+2*(LEFT+UP))
        A_arrow = Arrow(
            A_text, self.input_dot,
            color = self.input_color
        )
        B_text = TextMobject("B")
        B_text.shift(B+2*RIGHT+DOWN)
        B_arrow = Arrow(
            B_text, self.output_dot,
            color = self.output_color
        )
        tup = self.get_circles_and_points(
            input_value-input_radius, 
            input_value+input_radius
        )
        input_circle, input_points, output_circle, output_points = tup

        for text, arrow in [(A_text, A_arrow), (B_text, B_arrow)]:
            self.play(
                ShimmerIn(text),
                ShowCreation(arrow)
            )
            self.wait()
        self.remove(A_text, A_arrow, B_text, B_arrow)
        self.play(ShowCreation(input_circle))
        self.wait()
        self.play(ShowCreation(input_points))
        self.wait()
        input_points_copy = input_points.copy()
        self.play(
            Transform(input_points_copy, output_points),
            run_time = 2
        )
        self.wait()
        self.play(ShowCreation(output_circle))
        self.wait()
        self.wait()
        self.remove(*[
            input_circle, input_points, 
            output_circle, input_points_copy
        ])
示例#14
0
    def show_change_side_by_side(self):

        seed = TextMobject("Seed")
        seed.shift(3 * LEFT + 2 * DOWN)
        fractal = TextMobject("Fractal")
        fractal.shift(3 * RIGHT + 2 * DOWN)
        words = map(TextMobject, [
            "A sharper angle results in a richer curve",
            "A more obtuse angle gives a sparser curve",
            "And as the angle approaches 0\\dots",
            "We have a new space-filling curve."
        ])
        for text in words:
            text.to_edge(UP)
        sharper, duller, space_filling = [
            CurveClass(order=1).shift(3 * LEFT)
            for CurveClass in SharperKoch, DullerKoch, SpaceFillingKoch
        ]
        shaper_f, duller_f, space_filling_f = [
            CurveClass(order=self.max_order).shift(3 * RIGHT)
            for CurveClass in SharperKoch, DullerKoch, SpaceFillingKoch
        ]

        self.add(words[0])
        left_curve = SharperKoch(order=1)
        right_curve = SharperKoch(order=1)
        self.play(
            Transform(left_curve, sharper),
            ApplyMethod(right_curve.shift, 3 * RIGHT),
        )
        self.play(
            Transform(right_curve,
                      SharperKoch(order=2).shift(3 * RIGHT)), ShimmerIn(seed),
            ShimmerIn(fractal))
        for order in range(3, self.max_order):
            self.play(
                Transform(right_curve,
                          SharperKoch(order=order).shift(3 * RIGHT)))
        self.remove(words[0])
        self.add(words[1])
        kwargs = {
            "run_time": 4,
        }
        self.play(Transform(left_curve, duller, **kwargs),
                  Transform(right_curve, duller_f, **kwargs))
        self.wait()
        kwargs["run_time"] = 7
        kwargs["rate_func"] = None
        self.remove(words[1])
        self.add(words[2])
        self.play(Transform(left_curve, space_filling, **kwargs),
                  Transform(right_curve, space_filling_f, **kwargs))
        self.remove(words[2])
        self.add(words[3])
        self.wait()
示例#15
0
    def construct(self):
        logo = MirekOlsakLogo(self.camera)
        series_title = TextMobject(self.series_str).to_edge(UP)
        self.add(series_title)
        chapter_title = TextMobject(self.chapter_str)
        chapter_title.scale(1.4)

        self.play(Write(chapter_title))
        self.play(ShowCreation(logo))
        self.dither(self.dither_time)
        self.play(FadeOut(VGroup(series_title, chapter_title, logo)))
示例#16
0
    def construct(self):
        all_points = TextMobject("$f$ is continuous at every input point")
        continuous = TextMobject("$f$ is continuous")
        all_points.shift(UP)
        continuous.shift(DOWN)
        arrow = Arrow(all_points, continuous)

        self.play(ShimmerIn(all_points))
        self.play(ShowCreation(arrow))
        self.play(ShimmerIn(continuous))
        self.wait()
示例#17
0
    def construct(self, with_words):
        CycloidScene.construct(self)

        randy = Randolph()
        randy.scale(RANDY_SCALE_FACTOR)
        randy.shift(-randy.get_bottom())
        central_randy = randy.copy()
        start_randy = self.adjust_mobject_to_index(
            randy.copy(), 1, self.cycloid.points
        )

        if with_words:
            words1 = TextMobject("Trajectory due to gravity")
            arrow = TexMobject("\\leftrightarrow")
            words2 = TextMobject("Trajectory due \\emph{constantly} rotating wheel")
            words1.next_to(arrow, LEFT)
            words2.next_to(arrow, RIGHT)
            words = Mobject(words1, arrow, words2)
            words.scale_to_fit_width(2*SPACE_WIDTH-1)
            words.to_edge(UP, buff = 0.2)
            words.to_edge(LEFT)

        self.play(ShowCreation(self.cycloid.copy()))
        self.slide(randy, self.cycloid)
        self.add(self.slider)
        self.wait()
        self.grow_parts()
        self.draw_cycloid()
        self.wait()
        self.play(Transform(self.slider, start_randy))
        self.wait()
        self.roll_back()
        self.wait()
        if with_words:
            self.play(*map(ShimmerIn, [words1, arrow, words2]))
        self.wait()
        self.remove(self.circle)
        start_time = len(self.frames)*self.frame_duration
        self.remove(self.slider)        
        self.slide(central_randy, self.cycloid)
        end_time = len(self.frames)*self.frame_duration
        self.play_over_time_range(
            start_time,
            end_time,
            RollAlongVector(
                self.circle, 
                self.cycloid.points[-1]-self.cycloid.points[0],
                run_time = end_time-start_time,
                rate_func = None
            )
        )
        self.add(self.circle, self.slider)
        self.wait()
示例#18
0
    def construct(self):
        top_words = TextMobject("Different pixel-frequency association")
        bottom_words = TextMobject("Need to relearn sight-via-sound")
        top_words.shift(UP)
        bottom_words.shift(DOWN)
        arrow = Arrow(top_words, bottom_words)

        self.play(ShimmerIn(top_words))
        self.dither()
        self.play(ShowCreation(arrow))
        self.play(ShimmerIn(bottom_words))
        self.dither()
示例#19
0
    def construct(self):
        name = TextMobject("Steven Strogatz")
        name.to_edge(UP)
        contributions = TextMobject("Frequent Contributions")
        contributions.scale(0.5).to_edge(RIGHT).shift(2 * UP)
        books_word = TextMobject("Books")
        books_word.scale(0.5).to_edge(LEFT).shift(2 * UP)
        radio_lab, sci_fri, cornell, book2, book3, book4 = [
            ImageMobject(filename, invert=False, filter_color=WHITE)
            for filename in [
                "radio_lab",
                "science_friday",
                "cornell",
                "strogatz_book2",
                "strogatz_book3",
                "strogatz_book4",
            ]
        ]
        book1 = ImageMobject("strogatz_book1", invert=False)
        nyt = ImageMobject("new_york_times")
        logos = [radio_lab, nyt, sci_fri]
        books = [book1, book2, book3, book4]

        sample_size = Square(side_length=2)
        last = contributions
        for image in logos:
            image.replace(sample_size)
            image.next_to(last, DOWN)
            last = image
        sci_fri.scale_in_place(0.9)
        shift_val = 0
        sample_size.scale(0.75)
        for book in books:
            book.replace(sample_size)
            book.next_to(books_word, DOWN)
            book.shift(shift_val * (RIGHT + DOWN))
            shift_val += 0.5
        sample_size.scale(2)
        cornell.replace(sample_size)
        cornell.next_to(name, DOWN)

        self.add(name)
        self.play(FadeIn(cornell))
        self.play(ShimmerIn(books_word))
        for book in books:
            book.shift(5 * LEFT)
            self.play(ApplyMethod(book.shift, 5 * RIGHT))
        self.play(ShimmerIn(contributions))
        for logo in logos:
            self.play(FadeIn(logo))
        self.dither()
示例#20
0
 def add_rod_and_ring(self, rod, ring):
     rod_word = TextMobject("Rod")
     rod_word.next_to(Point(), UP)
     ring_word = TextMobject("Ring")
     ring_word.next_to(ring, UP)
     self.wait()
     self.add(rod)
     self.play(ShimmerIn(rod_word))
     self.wait()
     self.remove(rod_word)
     self.play(ShowCreation(ring))
     self.play(ShimmerIn(ring_word))
     self.wait()
     self.remove(ring_word)
示例#21
0
    def construct(self):
        words = TextMobject("""
            It might come as a surprise how some well-known
            fractals can be described with curves.
        """)
        words.to_edge(UP)

        self.setup(Sierpinski)
        self.add(TextMobject("Speaking of other fractals\\dots"))
        self.wait(3)
        self.clear()
        self.play(ShimmerIn(words))
        for x in range(9):
            self.increase_order()
示例#22
0
    def construct(self):
        horiz_radius = 5
        vert_radius = 3

        vert_axis = NumberLine(numerical_radius=vert_radius)
        vert_axis.rotate(np.pi / 2)
        vert_axis.shift(horiz_radius * LEFT)
        horiz_axis = NumberLine(numerical_radius=5,
                                numbers_with_elongated_ticks=[])
        axes = Mobject(horiz_axis, vert_axis)
        graph = FunctionGraph(lambda x: 0.4 * (x - 2) * (x + 2) + 3,
                              x_min=-2,
                              x_max=2,
                              density=3 * DEFAULT_POINT_DENSITY_1D)
        graph.stretch_to_fit_width(2 * horiz_radius)
        graph.highlight(YELLOW)
        min_point = Dot(graph.get_bottom())
        nature_finds = TextMobject("Nature finds this point")
        nature_finds.scale(0.5)
        nature_finds.highlight(GREEN)
        nature_finds.shift(2 * RIGHT + 3 * UP)
        arrow = Arrow(nature_finds.get_bottom(), min_point, color=GREEN)

        side_words_start = TextMobject("Parameter describing")
        top_words, last_side_words = [
            map(TextMobject, pair)
            for pair in [("Light's travel time",
                          "Potential energy"), ("path", "mechanical state")]
        ]
        for word in top_words + last_side_words + [side_words_start]:
            word.scale(0.7)
        side_words_start.next_to(horiz_axis, DOWN)
        side_words_start.to_edge(RIGHT)
        for words in top_words:
            words.next_to(vert_axis, UP)
            words.to_edge(LEFT)
        for words in last_side_words:
            words.next_to(side_words_start, DOWN)
        for words in top_words[1], last_side_words[1]:
            words.highlight(RED)

        self.add(axes, top_words[0], side_words_start, last_side_words[0])
        self.play(ShowCreation(graph))
        self.play(ShimmerIn(nature_finds), ShowCreation(arrow),
                  ShowCreation(min_point))
        self.dither()
        self.play(FadeOut(top_words[0]), FadeOut(last_side_words[0]),
                  GrowFromCenter(top_words[1]),
                  GrowFromCenter(last_side_words[1]))
        self.dither(3)
示例#23
0
    def construct(self):
        snells = TextMobject("Snell's")
        snells.shift(-snells.get_left())
        snells.to_edge(UP)
        for vect in [RIGHT, RIGHT, LEFT, DOWN, DOWN, DOWN]:
            snells.add(snells.copy().next_to(snells, vect))
        snells.ingest_submobjects()
        snells.show()
        condensed = TextMobject("condensed")

        self.add(snells)
        self.dither()
        self.play(DelayByOrder(Transform(snells, condensed, run_time=2)))
        self.dither()
示例#24
0
 def label_spaces(self):
     input_space = TextMobject("Input Space")
     input_space.to_edge(UP)
     input_space.shift(LEFT * SPACE_WIDTH / 2)
     output_space = TextMobject("Output Space")
     output_space.to_edge(UP)
     output_space.shift(RIGHT * SPACE_WIDTH / 2)
     line = Line(UP * SPACE_HEIGHT, DOWN * SPACE_HEIGHT, color=WHITE)
     self.play(
         ShimmerIn(input_space),
         ShimmerIn(output_space),
         ShowCreation(line),
         ShowCreation(self.interval),
     )
     self.dither()
示例#25
0
    def construct(self):
        digest_config(self, {})
        ## Usually shouldn't need this...
        self.frame_duration = self.CONFIG["frame_duration"]
        ##
        digest_config(self, {})
        circle = Circle(density=self.circle_density, color=self.circle_blue)
        circle.repeat(self.circle_repeats)
        circle.scale(self.radius)
        sphere = Sphere(density=self.sphere_density, color=self.sphere_blue)
        sphere.scale(self.radius)
        sphere.rotate(-np.pi / 7, [1, 0, 0])
        sphere.rotate(-np.pi / 7)
        iris = Mobject()
        iris.interpolate(circle, sphere, self.interpolation_factor)
        for mob, color in [(iris, self.sphere_brown),
                           (circle, self.circle_brown)]:
            mob.highlight(color, lambda (x, y, z): x < 0 and y > 0)
            mob.highlight(
                "black",
                lambda point: np.linalg.norm(point) < \
                              self.inner_radius_ratio*self.radius
            )
        self.name_mob = TextMobject("3Blue1Brown").center()
        self.name_mob.highlight("grey")
        self.name_mob.shift(2 * DOWN)

        self.play(Transform(circle, iris, run_time=self.run_time))
        self.frames = drag_pixels(self.frames)
        self.save_image(IMAGE_DIR)
        self.logo = MobjectFromPixelArray(self.frames[-1])
        self.add(self.name_mob)
        self.dither()
示例#26
0
    def construct(self):
        rect = Rectangle(height=4, width=6, color=WHITE)
        words = TextMobject("Details of proof")
        words.to_edge(UP)

        self.play(ShowCreation(rect), ShimmerIn(words))
        self.wait()
示例#27
0
    def construct(self):
        point_a, point_b = 3 * LEFT, 3 * RIGHT
        dots = []
        for point, char in [(point_a, "A"), (point_b, "B")]:
            dot = Dot(point)
            letter = TexMobject(char)
            letter.next_to(dot, UP + LEFT)
            dot.add(letter)
            dots.append(dot)

        path = ParametricFunction(lambda t:
                                  (t / 2 + np.cos(t)) * RIGHT + np.sin(t) * UP,
                                  start=-2 * np.pi,
                                  end=2 * np.pi)
        path.scale(6 / (2 * np.pi))
        path.shift(point_a - path.points[0])
        path.highlight(RED)
        line = Line(point_a, point_b)
        words = TextMobject("Shortest path from $A$ to $B$")
        words.to_edge(UP)

        self.play(ShimmerIn(words), *map(GrowFromCenter, dots))
        self.play(ShowCreation(path))
        self.play(Transform(path, line, path_func=path_along_arc(np.pi)))
        self.wait()
示例#28
0
    def construct(self):
        t_axis = NumberLine()
        theta_axis = NumberLine().rotate(np.pi / 2)
        theta_mob = TexMobject("\\theta(t)")
        t_mob = TexMobject("t")
        theta_mob.next_to(theta_axis, RIGHT)
        theta_mob.to_edge(UP)
        t_mob.next_to(t_axis, UP)
        t_mob.to_edge(RIGHT)
        graph = ParametricFunction(
            lambda t: 4 * t * RIGHT + 2 * smooth(t) * UP)
        line = Line(graph.points[0], graph.points[-1], color=WHITE)
        q_mark = TextMobject("?")
        q_mark.next_to(Point(graph.get_center()), LEFT)
        stars = Stars(color=BLACK)
        stars.scale(0.1).shift(q_mark.get_center())

        squiggle = ParametricFunction(lambda t: t * RIGHT + 0.2 * t * (5 - t) *
                                      (np.sin(t)**2) * UP,
                                      start=0,
                                      end=5)

        self.play(ShowCreation(t_axis), ShowCreation(theta_axis),
                  ShimmerIn(theta_mob), ShimmerIn(t_mob))
        self.play(ShimmerIn(q_mark), ShowCreation(graph))
        self.wait()
        self.play(Transform(q_mark, stars), Transform(graph, line))
        self.wait()
        self.play(Transform(graph, squiggle))
        self.wait()
示例#29
0
    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)
示例#30
0
    def show_diameter(self):
        exceptions = [
            self.circle, self.tangent_line, self.pc_line,
            self.right_angle_symbol
        ]
        everything = set(self.mobjects).difference(exceptions)
        everything_copy = Mobject(*everything).copy()
        light_everything = everything_copy.copy()
        dark_everything = everything_copy.copy()
        dark_everything.fade(0.8)
        bottom_point = np.array(self.c_point)
        bottom_point += 2 * self.radius * DOWN
        diameter = Line(bottom_point, self.c_point)
        brace = Brace(diameter, RIGHT)
        diameter_word = TextMobject("Diameter")
        d_mob = TexMobject("D")
        diameter_word.next_to(brace)
        d_mob.next_to(diameter)

        self.remove(*everything)
        self.play(Transform(everything_copy, dark_everything))
        self.dither()
        self.play(ShowCreation(diameter))
        self.play(GrowFromCenter(brace))
        self.play(ShimmerIn(diameter_word))
        self.dither()
        self.play(*[Transform(mob, d_mob) for mob in brace, diameter_word])
        self.remove(brace, diameter_word)
        self.add(d_mob)
        self.play(Transform(everything_copy, light_everything))
        self.remove(everything_copy)
        self.add(*everything)

        self.d_mob = d_mob
        self.bottom_point = bottom_point