How to use the manimlib.animation.creation.ShowCreation function in manimlib

To help you get started, we’ve selected a few manimlib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Solara570 / demo-solara / short / ford_circles.py View on Github external
def play_farey_sum_animation(self, p1, q1, p2, q2):
        c1, c2, c3, l1, l2, l3 = self.get_farey_sum_key_mobjects(p1, q1, p2, q2)
        l3.set_color(PINK)
        self.wait()
        self.play(
            ShowCreation(c1), ApplyMethod(l1.set_color, YELLOW),
            ShowCreation(c2), ApplyMethod(l2.set_color, YELLOW),
        )
        self.play(
            ReplacementTransform(l1.numer.deepcopy(), l3.numer),
            ReplacementTransform(l1.line.deepcopy(), l3.line),
            ReplacementTransform(l1.denom.deepcopy(), l3.denom),
            ReplacementTransform(l2.numer.deepcopy(), l3.numer),
            ReplacementTransform(l2.line.deepcopy(), l3.line),
            ReplacementTransform(l2.denom.deepcopy(), l3.denom),
            ReplacementTransform(c1.deepcopy(), c3),
            ReplacementTransform(c2.deepcopy(), c3),
        )
        self.wait()
        self.play(FadeOut(VGroup(c1, c2, c3, l1, l2, l3)))
github Solara570 / demo-solara / short / ford_circles.py View on Github external
def play_farey_sum_animation(self, p1, q1, p2, q2):
        c1, c2, c3, l1, l2, l3 = self.get_farey_sum_key_mobjects(p1, q1, p2, q2)
        l3.set_color(PINK)
        self.wait()
        self.play(
            ShowCreation(c1), ApplyMethod(l1.set_color, YELLOW),
            ShowCreation(c2), ApplyMethod(l2.set_color, YELLOW),
        )
        self.play(
            ReplacementTransform(l1.numer.deepcopy(), l3.numer),
            ReplacementTransform(l1.line.deepcopy(), l3.line),
            ReplacementTransform(l1.denom.deepcopy(), l3.denom),
            ReplacementTransform(l2.numer.deepcopy(), l3.numer),
            ReplacementTransform(l2.line.deepcopy(), l3.line),
            ReplacementTransform(l2.denom.deepcopy(), l3.denom),
            ReplacementTransform(c1.deepcopy(), c3),
            ReplacementTransform(c2.deepcopy(), c3),
        )
        self.wait()
        self.play(FadeOut(VGroup(c1, c2, c3, l1, l2, l3)))
github Solara570 / demo-solara / calissons.py View on Github external
def show_rhombi(self):
        self.wait()
        rhombi = VGroup(*[RhombusType() for RhombusType in (RRhombus, HRhombus, LRhombus)])
        rhombi.arrange_submobjects(RIGHT, aligned_edge = DOWN, buff = 1)
        rhombi.to_edge(RIGHT, buff = 1)
        rhombi.to_edge(UP)
        hexagon_text, rhombi_text = self.bg_texts[0]
        self.play(
            Write(hexagon_text),
            run_time = 1
        )
        self.wait()
        self.play(
            ShowCreation(rhombi, submobject_mode = "all_at_once"),
            Write(rhombi_text),
            run_time = 1
        )
        self.wait()
        self.rhombi = rhombi
github Solara570 / demo-solara / calissons.py View on Github external
def ask_about_how_to_prove(self):
        claim_text = self.q_texts[0]
        self.wait()
        self.play(self.q_texts.shift, DOWN, run_time = 1)
        claim_rect = SurroundingRectangle(
            VGroup(claim_text, self.how_to_prove_text),
            stroke_color = YELLOW, buff = 0.3
        )
        self.play(
            Write(self.how_to_prove_text),
            ShowCreation(claim_rect),
            run_time = 1,
        )
        self.wait()
        self.claim_rect = claim_rect
github 3b1b / manim / manimlib / scene / vector_space_scene.py View on Github external
x_coord.copy(), x_line, vector
        )
        y_coord_start = self.position_y_coordinate(
            y_coord.copy(), y_line, vector
        )
        brackets = array.get_brackets()

        if show_creation:
            self.play(ShowCreation(arrow))
        self.play(
            ShowCreation(x_line),
            Write(x_coord_start),
            run_time=1
        )
        self.play(
            ShowCreation(y_line),
            Write(y_coord_start),
            run_time=1
        )
        self.wait()
        self.play(
            Transform(x_coord_start, x_coord, lag_ratio=0),
            Transform(y_coord_start, y_coord, lag_ratio=0),
            Write(brackets, run_time=1),
        )
        self.wait()

        self.remove(x_coord_start, y_coord_start, brackets)
        self.add(array)
        if clean_up:
            self.clear()
            self.add(*starting_mobjects)
github Solara570 / demo-solara / short / kkd / kkd.py View on Github external
def construct_infinite_sum(self):
        for n in range(1, 11):
            # Get highlighted terms
            highlighted_terms = self.get_highlighted_terms(n)
            # Update highlight rectangles
            if n == 1:
                rects = self.get_highlight_rectangles(1)
                self.play(ShowCreation(rects), lag_ratio = 0.2)
                self.wait()
            else:
                new_rects = self.get_highlight_rectangles(n)
                self.play(Transform(rects, new_rects))
                if n <= 4:
                    self.wait()
            # Show the detailed construction of the first four terms
            if n <= 4:
                # Make copies of the elements that are going to be moved
                highlighted_terms_copy = self.get_highlighted_terms(n).deepcopy()
                times_symbols_copy = self.get_times_symbols().deepcopy()
                cdots_copy = self.get_cdots_symbol().deepcopy()
                # Move highlighted terms into position
                arranged_terms_list = []
                for i in range(4):
                    arranged_terms_list.append(highlighted_terms_copy[i])
github Solara570 / demo-solara / calissons.py View on Github external
def show_border_and_reflines(self):
        self.set_camera_orientation(*DIAG_POS)
        self.wait()

        init_ct = self.cts[0]
        border = init_ct.get_border()
        reflines = Reflines(init_ct)
        self.play(ShowCreation(border))
        self.wait(3)
        self.play(
            Write(reflines, rate_func = smooth, submobject_mode = "lagged_start"),
            Animation(border),
            run_time = 3,
        )
        self.play(
            Indicate(VGroup(border, reflines), scale_factor = 1.05),
            run_time = 2,
        )
        self.wait()

        self.border = border
        self.reflines = reflines
github 3b1b / manim / manimlib / animation / creation.py View on Github external
)

    def get_bounds(self, alpha):
        raise Exception("Not Implemented")


class ShowCreation(ShowPartial):
    CONFIG = {
        "lag_ratio": 1,
    }

    def get_bounds(self, alpha):
        return (0, alpha)


class Uncreate(ShowCreation):
    CONFIG = {
        "rate_func": lambda t: smooth(1 - t),
        "remover": True
    }


class DrawBorderThenFill(Animation):
    CONFIG = {
        "run_time": 2,
        "rate_func": double_smooth,
        "stroke_width": 2,
        "stroke_color": None,
        "draw_border_animation_config": {},
        "fill_animation_config": {},
    }