Esempio n. 1
0
    def construct(self):
        morty = Mortimer()
        morty.next_to(ORIGIN, DOWN)

        n_patrons = len(self.specific_patrons)
        special_thanks = TextMobject("Special thanks")
        special_thanks.highlight(YELLOW)
        special_thanks.to_edge(UP)

        patreon_logo = PatreonLogo()
        patreon_logo.next_to(morty, UP, buff=MED_LARGE_BUFF)

        patrons = map(TextMobject, self.specific_patrons)
        patron_groups = []
        index = 0
        counter = 0
        while index < len(patrons):
            next_index = index + self.patron_group_size
            group = VGroup(*patrons[index:next_index])
            group.arrange_submobjects(DOWN, aligned_edge=LEFT)
            if counter % 2 == 0:
                group.to_edge(LEFT)
            else:
                group.to_edge(RIGHT)
            patron_groups.append(group)
            index = next_index
            counter += 1

        self.play(
            morty.change_mode,
            "gracious",
            DrawBorderThenFill(patreon_logo),
        )
        self.play(Write(special_thanks, run_time=1))
        for i, group in enumerate(patron_groups):
            anims = [
                FadeIn(
                    group,
                    run_time=2,
                    submobject_mode="lagged_start",
                    lag_factor=4,
                ),
                morty.look_at,
                group.get_top(),
            ]
            if i >= 2:
                anims.append(FadeOut(patron_groups[i - 2]))
            self.play(*anims)
            self.play(morty.look_at, group.get_bottom())
            self.play(Blink(morty))
Esempio n. 2
0
    def scroll_through_patrons(self):
        logo_box = Square(side_length=2.5)
        logo_box.to_corner(DOWN + LEFT, buff=MED_LARGE_BUFF)
        total_width = SPACE_WIDTH - logo_box.get_right()[0]

        black_rect = Rectangle(fill_color=BLACK,
                               fill_opacity=1,
                               stroke_width=0,
                               width=2 * SPACE_WIDTH,
                               height=1.1 * SPACE_HEIGHT)
        black_rect.to_edge(UP, buff=0)
        line = DashedLine(SPACE_WIDTH * LEFT, SPACE_WIDTH * RIGHT)
        line.move_to(black_rect, DOWN)
        line.shift(SMALL_BUFF * SMALL_BUFF * DOWN)
        self.add(line)

        patrons = VGroup(*map(TextMobject, self.specific_patrons))
        patrons.scale(self.patron_scale_val)
        for patron in patrons:
            if patron.get_width() > self.max_patron_width:
                patron.scale_to_fit_width(self.max_patron_width)
        columns = VGroup(*[
            VGroup(*patrons[i::self.n_patron_columns]).arrange_submobjects(
                DOWN, buff=MED_SMALL_BUFF)
            for i in range(self.n_patron_columns)
        ])
        columns.arrange_submobjects(
            RIGHT,
            buff=LARGE_BUFF,
            aligned_edge=UP,
        )
        columns.scale_to_fit_width(total_width - 1)
        columns.next_to(black_rect, DOWN, 3 * LARGE_BUFF)
        columns.to_edge(RIGHT)

        self.play(
            columns.next_to,
            SPACE_HEIGHT * DOWN,
            UP,
            LARGE_BUFF,
            columns.to_edge,
            RIGHT,
            Animation(black_rect),
            rate_func=None,
            run_time=self.run_time,
        )