目录

Note: This is a temporary test environment in which you can play around with Manim without the need of installing it locally. Keep in mind that this is a temporary environment, though: your changes will not be saved and cannot be shared with others. To save your work, you will need to download the notebook file (“File > Download as > Notebook (.ipynb)”). Enjoy!

Useful resources: Documentation, Discord, Reddit

from manim import *
config.media_width = "35%"
config.media_embed = True
config.verbosity = "WARNING"
%manim --help
Usage: manim [OPTIONS] COMMAND [ARGS]...

  Animation engine for explanatory math videos.

Options:
  --version                      Show version and exit.
  --show-splash / --hide-splash  Print splash message with version information.
  --help                         Show this message and exit.

Commands:
  cfg          Manages Manim configuration files.
  checkhealth  This subcommand checks whether Manim is installed correctly...
  init         Create a new project or insert a new scene.
  plugins      Manages Manim plugins.
  render       Render SCENE(S) from the input FILE.

See 'manim <command>' to read about a specific subcommand.

Note: the subcommand 'manim render' is called if no other subcommand is
specified. Run 'manim render --help' if you would like to know what the '-ql' or
'-p' flags do, for example.

Made with <3 by Manim Community developers.
%%manim -qm -v WARNING SquareToCircle

class SquareToCircle(Scene):
    def construct(self):
        circle = Circle()
        square = Square()
        square.flip(RIGHT)
        square.rotate(-3 * TAU / 8)
        circle.set_fill(PINK, opacity=0.5)

        self.play(Create(square))
        self.play(Transform(square, circle))
        self.play(FadeOut(square))
Manim Community v0.18.1

Animation 0: Create(Square):   0%|          | 0/30 [00:00<?, ?it/s]
Animation 0: Create(Square):  37%|███▋      | 11/30 [00:00<00:00, 107.55it/s]
Animation 0: Create(Square): 100%|██████████| 30/30 [00:00<00:00, 154.75it/s]
Animation 1: Transform(Square):   0%|          | 0/30 [00:00<?, ?it/s]
Animation 1: Transform(Square):  40%|████      | 12/30 [00:00<00:00, 116.81it/s]
Animation 2: FadeOut(Square):   0%|          | 0/30 [00:00<?, ?it/s]
Animation 2: FadeOut(Square):  37%|███▋      | 11/30 [00:00<00:00, 105.86it/s]
%%manim -qm -v WARNING WarpSquare

class WarpSquare(Scene):
    def construct(self):
        square = Square()
        self.play(
            ApplyPointwiseFunction(
                lambda point: complex_to_R3(np.exp(R3_to_complex(point))), square
            )
        )
        self.wait()
Manim Community v0.18.1

Animation 0: ApplyPointwiseFunction(Square):   0%|          | 0/90 [00:00<?, ?it/s]
Animation 0: ApplyPointwiseFunction(Square):  11%|█         | 10/90 [00:00<00:00, 96.35it/s]
Animation 0: ApplyPointwiseFunction(Square):  31%|███       | 28/90 [00:00<00:00, 141.56it/s]
Animation 0: ApplyPointwiseFunction(Square):  50%|█████     | 45/90 [00:00<00:00, 151.17it/s]
Animation 0: ApplyPointwiseFunction(Square):  68%|██████▊   | 61/90 [00:00<00:00, 127.11it/s]
Animation 0: ApplyPointwiseFunction(Square):  83%|████████▎ | 75/90 [00:00<00:00, 130.62it/s]
%%manim -qm -v WARNING WriteStuff

class WriteStuff(Scene):
    def construct(self):
        example_text = Tex("This is some text", tex_to_color_map={"text": YELLOW})
        example_tex = MathTex(
            "\\sum_{k=1}^\\infty {1 \\over k^2} = {\\pi^2 \\over 6}",
        )
        group = VGroup(example_text, example_tex)
        group.arrange(DOWN)
        group.set(width=config["frame_width"] - 2 * LARGE_BUFF)

        self.play(Write(example_text))
        self.play(Write(example_tex))
        self.wait()
Manim Community v0.18.1

Animation 0: Write(Tex('This is some text')):   0%|          | 0/30 [00:00<?, ?it/s]
Animation 0: Write(Tex('This is some text')):  37%|███▋      | 11/30 [00:00<00:00, 107.20it/s]
Animation 0: Write(Tex('This is some text')):  77%|███████▋  | 23/30 [00:00<00:00, 112.33it/s]
Animation 1: Write(MathTex('\\sum_{k=1}^\\infty {1 \\over k^2} = {\\pi^2 \\over 6}')):   0%|          | 0/30 [00:00<?, ?it/s]
Animation 1: Write(MathTex('\\sum_{k=1}^\\infty {1 \\over k^2} = {\\pi^2 \\over 6}')):  37%|███▋      | 11/30 [00:00<00:00, 104.38it/s]
Animation 1: Write(MathTex('\\sum_{k=1}^\\infty {1 \\over k^2} = {\\pi^2 \\over 6}')):  80%|████████  | 24/30 [00:00<00:00, 116.86it/s]
%%manim -qm -v WARNING UpdatersExample

class UpdatersExample(Scene):
    def construct(self):
        decimal = DecimalNumber(
            0,
            show_ellipsis=True,
            num_decimal_places=3,
            include_sign=True,
        )
        square = Square().to_edge(UP)

        decimal.add_updater(lambda d: d.next_to(square, RIGHT))
        decimal.add_updater(lambda d: d.set_value(square.get_center()[1]))
        self.add(square, decimal)
        self.play(
            square.animate.to_edge(DOWN),
            rate_func=there_and_back,
            run_time=5,
        )
        self.wait()
Manim Community v0.18.1

Animation 0: _MethodAnimation(Square):   0%|          | 0/150 [00:00<?, ?it/s]
Animation 0: _MethodAnimation(Square):   2%|▏         | 3/150 [00:00<00:05, 28.19it/s]
Animation 0: _MethodAnimation(Square):   5%|▍         | 7/150 [00:00<00:04, 31.76it/s]
Animation 0: _MethodAnimation(Square):   8%|▊         | 12/150 [00:00<00:03, 39.28it/s]
Animation 0: _MethodAnimation(Square):  11%|█▏        | 17/150 [00:00<00:03, 42.28it/s]
Animation 0: _MethodAnimation(Square):  15%|█▍        | 22/150 [00:00<00:02, 44.92it/s]
Animation 0: _MethodAnimation(Square):  19%|█▊        | 28/150 [00:00<00:02, 46.92it/s]
Animation 0: _MethodAnimation(Square):  22%|██▏       | 33/150 [00:00<00:02, 47.77it/s]
Animation 0: _MethodAnimation(Square):  25%|██▌       | 38/150 [00:00<00:02, 48.21it/s]
Animation 0: _MethodAnimation(Square):  29%|██▊       | 43/150 [00:00<00:02, 47.28it/s]
Animation 0: _MethodAnimation(Square):  32%|███▏      | 48/150 [00:01<00:02, 46.30it/s]
Animation 0: _MethodAnimation(Square):  35%|███▌      | 53/150 [00:01<00:02, 46.20it/s]
Animation 0: _MethodAnimation(Square):  39%|███▊      | 58/150 [00:01<00:02, 45.30it/s]
Animation 0: _MethodAnimation(Square):  42%|████▏     | 63/150 [00:01<00:02, 41.76it/s]
Animation 0: _MethodAnimation(Square):  45%|████▌     | 68/150 [00:01<00:01, 42.73it/s]
Animation 0: _MethodAnimation(Square):  49%|████▊     | 73/150 [00:01<00:01, 44.08it/s]
Animation 0: _MethodAnimation(Square):  53%|█████▎    | 79/150 [00:01<00:01, 45.82it/s]
Animation 0: _MethodAnimation(Square):  57%|█████▋    | 85/150 [00:01<00:01, 47.09it/s]
Animation 0: _MethodAnimation(Square):  60%|██████    | 90/150 [00:02<00:01, 47.65it/s]
Animation 0: _MethodAnimation(Square):  64%|██████▍   | 96/150 [00:02<00:01, 48.36it/s]
Animation 0: _MethodAnimation(Square):  67%|██████▋   | 101/150 [00:02<00:01, 48.50it/s]
Animation 0: _MethodAnimation(Square):  71%|███████▏  | 107/150 [00:02<00:00, 49.50it/s]
Animation 0: _MethodAnimation(Square):  75%|███████▍  | 112/150 [00:02<00:00, 49.31it/s]
Animation 0: _MethodAnimation(Square):  78%|███████▊  | 117/150 [00:02<00:00, 48.85it/s]
Animation 0: _MethodAnimation(Square):  82%|████████▏ | 123/150 [00:02<00:00, 49.54it/s]
Animation 0: _MethodAnimation(Square):  86%|████████▌ | 129/150 [00:02<00:00, 49.69it/s]
Animation 0: _MethodAnimation(Square):  90%|█████████ | 135/150 [00:02<00:00, 49.54it/s]
Animation 0: _MethodAnimation(Square):  93%|█████████▎| 140/150 [00:03<00:00, 48.78it/s]
Animation 0: _MethodAnimation(Square):  97%|█████████▋| 145/150 [00:03<00:00, 48.17it/s]
Animation 0: _MethodAnimation(Square): 100%|██████████| 150/150 [00:03<00:00, 47.51it/s]
%%manim -qm -v WARNING OpeningManim

class OpeningManim(Scene):
    def construct(self):
        title = Tex(r"This is some \LaTeX")
        basel = MathTex(r"\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}")
        VGroup(title, basel).arrange(DOWN)
        self.play(
            Write(title),
            FadeIn(basel, shift = UP),
        )
        self.wait()

        transform_title = Tex("That was a transform")
        transform_title.to_corner(UP + LEFT)
        self.play(
            Transform(title, transform_title),
            LaggedStart(*[FadeOut(obj, shift=DOWN) for obj in basel]),
        )
        self.wait()

        grid = NumberPlane(x_range=(- 10, 10, 1), y_range=(- 6.0, 6.0, 1))
        grid_title = Tex("This is a grid")
        grid_title.scale(1.5)
        grid_title.move_to(transform_title)

        self.add(grid, grid_title)  # Make sure title is on top of grid
        self.play(
            FadeOut(title),
            FadeIn(grid_title, shift=DOWN),
            Create(grid, run_time=3, lag_ratio=0.1),
        )
        self.wait()

        grid_transform_title = Tex(
            r"That was a non-linear function \\ applied to the grid"
        )
        grid_transform_title.move_to(grid_title, UL)
        grid.prepare_for_nonlinear_transform()
        self.play(
            grid.animate.apply_function(
                lambda p: p
                + np.array(
                    [
                        np.sin(p[1]),
                        np.sin(p[0]),
                        0,
                    ]
                )
            ),
            run_time=3,
        )
        self.wait()
        self.play(Transform(grid_title, grid_transform_title))
        self.wait()
Manim Community v0.18.1

Animation 0: Write(Tex('This is some \\LaTeX')), etc.:   0%|          | 0/1 [00:00<?, ?it/s]
Animation 2: Transform(Tex('This is some \\LaTeX')), etc.:   0%|          | 0/1 [00:00<?, ?it/s]
Animation 4: FadeOut(Tex('This is some \\LaTeX')), etc.:   0%|          | 0/1 [00:00<?, ?it/s]
Animation 6: _MethodAnimation(NumberPlane of 4 submobjects):   0%|          | 0/1 [00:00<?, ?it/s]
Animation 8: Transform(Tex('This is a grid')):   0%|          | 0/1 [00:00<?, ?it/s]

See many more examples at https://docs.manim.community/en/latest/examples.html!