### Install TeX Live on Fedora Source: https://github.com/manimcommunity/manim/blob/main/docs/source/installation/uv.md Install the full TeX Live distribution on Fedora Linux systems using dnf. ```bash sudo dnf install texlive-scheme-full ``` -------------------------------- ### Install TeX Live on Debian-based systems Source: https://github.com/manimcommunity/manim/blob/main/docs/source/installation/uv.md Install the full TeX Live distribution on Debian-based Linux systems using apt. ```bash sudo apt install texlive-full ``` -------------------------------- ### Install System Utilities (MacOS) Source: https://github.com/manimcommunity/manim/blob/main/docs/source/installation/uv.md Installs `cairo` and `pkg-config` using Homebrew, which are required for Manim dependencies. ```bash brew install cairo pkg-config ``` -------------------------------- ### Install Manim Voiceover Plugin Source: https://github.com/manimcommunity/manim/blob/main/docs/source/guides/add_voiceovers.rst Install the Manim Voiceover plugin with support for Azure and Google Text-to-Speech services. ```bash pip install "manim-voiceover[azure,gtts]" ``` -------------------------------- ### Install Pre-Commit Hooks Source: https://github.com/manimcommunity/manim/blob/main/docs/source/contributing/development.md Install the pre-commit framework to automatically format and lint your code before each commit. This ensures code quality and consistency. ```shell uv run pre-commit install ``` -------------------------------- ### Install Manim with Pixi Source: https://github.com/manimcommunity/manim/blob/main/docs/source/installation/conda.rst These commands initialize a new project with Pixi and add Manim as a dependency. ```bash pixi init pixi add manim ``` -------------------------------- ### Install Manim and Dependencies in Google Colab Source: https://github.com/manimcommunity/manim/blob/main/docs/source/installation/jupyter.rst Execute these commands in a Google Colab notebook to install Manim and its necessary system dependencies. Remember to restart the runtime after installation. ```bash !sudo apt update !sudo apt install libcairo2-dev \ texlive texlive-latex-extra texlive-fonts-extra \ texlive-latex-recommended texlive-science \ tipa libpango1.0-dev !pip install manim !pip install IPython==8.21.0 ``` -------------------------------- ### Install Python using uv Source: https://github.com/manimcommunity/manim/blob/main/docs/source/installation/uv.md Run this command in your terminal to install the latest version of Python using uv. ```bash uv python install ``` -------------------------------- ### Install Dependencies (Arch Linux) Source: https://github.com/manimcommunity/manim/blob/main/docs/source/installation/uv.md Installs required packages for Manim on Arch Linux using `pacman`. ```bash sudo pacman -Syu base-devel cairo pango ``` -------------------------------- ### Mobject Placement Examples Source: https://github.com/manimcommunity/manim/blob/main/docs/source/tutorials/building_blocks.rst Illustrates various methods for positioning mobjects on the screen, including .move_to(), .next_to(), and .align_to(). ```python class MobjectPlacement(Scene): def construct(self): circle = Circle() square = Square() triangle = Triangle() ``` -------------------------------- ### Install Dependencies (Fedora Linux) Source: https://github.com/manimcommunity/manim/blob/main/docs/source/installation/uv.md Installs necessary development packages for Manim on Fedora Linux using `dnf`. ```bash sudo dnf install python3-devel pkg-config cairo-devel pango-devel ``` -------------------------------- ### Install Dependencies (Debian-based Linux) Source: https://github.com/manimcommunity/manim/blob/main/docs/source/installation/uv.md Installs essential build tools and development headers for Manim on Debian-based Linux distributions using `apt`. ```bash sudo apt update sudo apt install build-essential python3-dev libcairo2-dev libpango1.0-dev ``` -------------------------------- ### Install Manim Plugin Source: https://github.com/manimcommunity/manim/blob/main/docs/source/plugins.rst Install plugins using pip. The standard naming convention is to prefix the plugin with 'manim-'. ```bash pip install manim-* ``` -------------------------------- ### Example Folder-Wide Configuration File Source: https://github.com/manimcommunity/manim/blob/main/docs/source/guides/configuration.rst A sample 'manim.cfg' file demonstrating how to set output file name, save as GIF, and background color. ```ini [CLI] # my config file output_file = myscene save_as_gif = True background_color = WHITE ``` -------------------------------- ### Example User-Wide and Folder-Wide Configuration Source: https://github.com/manimcommunity/manim/blob/main/docs/source/guides/configuration.rst Illustrates cascading configuration where the folder-wide file takes precedence over the user-wide file for 'save_as_gif'. ```ini # user-wide [CLI] output_file = myscene save_as_gif = True background_color = WHITE ``` ```ini # folder-wide [CLI] save_as_gif = False ``` -------------------------------- ### Install uv on Windows Source: https://github.com/manimcommunity/manim/blob/main/docs/source/installation/uv.md Use this PowerShell command to install the uv Python environment manager on Windows systems. ```powershell powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" ``` -------------------------------- ### Install SnakeViz for Profiling Visualization Source: https://github.com/manimcommunity/manim/blob/main/docs/source/contributing/performance.rst Install SnakeViz, a tool used to visualize cProfile output, which helps in identifying performance bottlenecks. ```bash pip install snakeviz ``` -------------------------------- ### Install Cython for ManimPango Source: https://github.com/manimcommunity/manim/blob/main/docs/source/faq/installation.md Install Cython to help build ManimPango wheels locally if pre-built versions are not available for your architecture. ```bash pip3 install Cython ``` -------------------------------- ### Install uv on MacOS and Linux Source: https://github.com/manimcommunity/manim/blob/main/docs/source/installation/uv.md Use this command to install the uv Python environment manager on MacOS and Linux systems. ```bash curl -LsSf https://astral.sh/uv/install.sh | sh ``` -------------------------------- ### Install Manim as a Global uv Tool Source: https://github.com/manimcommunity/manim/blob/main/docs/source/installation/uv.md Installs Manim as a globally available `uv`-managed tool, making the `manim` executable accessible without activating virtual environments. ```bash uv tool install manim ``` -------------------------------- ### Square Initialization Example Source: https://github.com/manimcommunity/manim/blob/main/docs/source/guides/deep_dive.rst Illustrates the initialization of a Square object, showing the call to the parent class constructor and subsequent stretching to fit dimensions. ```python Square(color=ORANGE, fill_opacity=0.5) ``` -------------------------------- ### Transform vs ReplacementTransform Example Source: https://github.com/manimcommunity/manim/blob/main/docs/source/tutorials/quickstart.rst Demonstrates the usage of `Transform` and `ReplacementTransform` to animate shape changes. ```python class TwoTransforms(Scene): def transform(self): a = Circle() b = Square() c = Triangle() self.play(Transform(a, b)) self.play(Transform(a, c)) self.play(FadeOut(a)) def replacement_transform(self): a = Circle() b = Square() c = Triangle() self.play(ReplacementTransform(a, b)) self.play(ReplacementTransform(b, c)) self.play(FadeOut(c)) def construct(self): self.transform() self.wait(0.5) self.replacement_transform() ``` -------------------------------- ### Example Control Data JSON Source: https://github.com/manimcommunity/manim/blob/main/docs/source/contributing/testing.rst This is an example of the JSON structure saved by save_control_data_from_video. It contains configuration details about the rendered video. ```json { "name": "SquareToCircleWithlFlag", "config": { "codec_name": "h264", "width": 854, "height": 480, "avg_frame_rate": "15/1", "duration": "1.000000", "nb_frames": "15" } } ``` -------------------------------- ### Manim Toy Scene Example Source: https://github.com/manimcommunity/manim/blob/main/docs/source/guides/deep_dive.rst A basic Manim scene demonstrating Mobject creation, transformation, updaters, and animation. ```python from manim import * class ToyExample(Scene): def construct(self): orange_square = Square(color=ORANGE, fill_opacity=0.5) blue_circle = Circle(color=BLUE, fill_opacity=0.5) self.add(orange_square) self.play(ReplacementTransform(orange_square, blue_circle, run_time=3)) small_dot = Dot() small_dot.add_updater(lambda mob: mob.next_to(blue_circle, DOWN)) self.play(Create(small_dot)) self.play(blue_circle.animate.shift(RIGHT)) self.wait() self.play(FadeOut(blue_circle, small_dot)) ``` -------------------------------- ### Rectangle Initialization Example Source: https://github.com/manimcommunity/manim/blob/main/docs/source/guides/deep_dive.rst Shows the initialization of a Rectangle, including the call to its parent Polygon class with corner coordinates and setting width/height. ```python super().__init__(UR, UL, DL, DR, color=color, **kwargs) self.stretch_to_fit_width(width) self.stretch_to_fit_height(height) ``` -------------------------------- ### Install Latest Development Version of Manim Source: https://github.com/manimcommunity/manim/blob/main/docs/source/installation/uv.md Install the latest, potentially unstable, development version of Manim directly from its GitHub repository using `uv add` with a Git URL. This command fetches the code from the `main` branch. ```bash uv add git+https://github.com/ManimCommunity/manim.git@main ``` -------------------------------- ### Render Scene with Medium Quality Source: https://github.com/manimcommunity/manim/blob/main/docs/source/guides/configuration.rst Example of rendering a specific scene with medium quality settings. The '-qm' flag controls the quality. ```bash manim -qm file.py SceneOne ``` -------------------------------- ### List Available Manim Plugins Source: https://github.com/manimcommunity/manim/blob/main/docs/source/plugins.rst List all installed Manim plugins using the '-l' or '--list' flag with the 'manim plugins' command. ```bash manim plugins -l ``` -------------------------------- ### Manim PointWithTrace Example Source: https://github.com/manimcommunity/manim/blob/main/docs/source/examples.rst Illustrates creating a trace of a moving point using VMobject.set_points_as_corners and Mobject.add_updater. The trace follows the dot's movement. ```python class PointWithTrace(Scene): def construct(self): path = VMobject() dot = Dot() path.set_points_as_corners([dot.get_center(), dot.get_center()]) def update_path(path): previous_path = path.copy() previous_path.add_points_as_corners([dot.get_center()]) path.become(previous_path) path.add_updater(update_path) self.add(path, dot) self.play(Rotating(dot, angle=PI, about_point=RIGHT, run_time=2)) self.wait() self.play(dot.animate.shift(UP)) self.play(dot.animate.shift(LEFT)) self.wait() ``` -------------------------------- ### Get Global uv Tool Directory Source: https://github.com/manimcommunity/manim/blob/main/docs/source/installation/uv.md Retrieves the base directory for `uv`-managed tools, which is useful for configuring code editors when Manim is installed globally. ```bash uv tool dir ``` -------------------------------- ### Create and Use a Named Docker Container Source: https://github.com/manimcommunity/manim/blob/main/docs/source/installation/docker.rst This sequence of commands allows you to create a persistent Docker container for Manim. First, start an interactive bash session to modify the container (e.g., install packages). Then, start the container in the background and use 'docker exec' to run Manim commands within it. ```sh docker run -it --name my-manim-container -v "/full/path/to/your/directory:/manim" manimcommunity/manim bash ``` ```sh docker start my-manim-container ``` ```sh docker exec -it my-manim-container manim -qm test_scenes.py CircleToSquare ``` -------------------------------- ### Initialize Project and Add Manim Dependency (Windows) Source: https://github.com/manimcommunity/manim/blob/main/docs/source/installation/uv.md Creates a new Python project directory and adds Manim as a local dependency using `uv`. ```bash uv init manimations cd manimations uv add manim ``` -------------------------------- ### Chocolatey Install Script for Manim Source: https://github.com/manimcommunity/manim/wiki/Maintainer's-Guidelines-Chocolatey This PowerShell script is used by Chocolatey to install Manim. It handles installing dependencies like pycairo and then installs Manim from the master branch. ```powershell Install-Package pycairo -Source "https://www.nuget.org/api/v2/" Install-Package Manim -Source "https://www.nuget.org/api/v2/" # Or install from master branch # pip install git+https://github.com/ManimCommunity/manim ``` -------------------------------- ### Initialize Manim Project Source: https://github.com/manimcommunity/manim/blob/main/docs/source/tutorials/quickstart.rst Use the manim CLI to create a new project directory with default configuration files. ```bash manim init project my-project --default ``` -------------------------------- ### Install Manim with Conda/Mamba Source: https://github.com/manimcommunity/manim/blob/main/docs/source/installation/conda.rst Use these commands to create a new conda environment, activate it, and install Manim from conda-forge. You can replace 'conda' with 'mamba' for faster package installation. ```bash # if you want to use mamba, just replace conda below with mamba conda create -n my-manim-environment conda activate my-manim-environment conda install -c conda-forge manim ``` -------------------------------- ### Check Homebrew Installation (MacOS) Source: https://github.com/manimcommunity/manim/blob/main/docs/source/installation/uv.md Verifies if Homebrew, a package manager for MacOS, is installed. ```bash brew --version ``` -------------------------------- ### Customized Scene with Manim Banner Source: https://github.com/manimcommunity/manim/blob/main/example_scenes/manim_jupyter_example.ipynb This example demonstrates how to create a scene with a customized background color and animate the Manim banner. It also shows how to configure media output size and embedding. ```python %%manim -v WARNING --disable_caching -qm HelloManim # set the maximum width for video outputs to a predefined value config.media_width = "20vw" # embed video config.media_embed = True class HelloManim(Scene): def construct(self): self.camera.background_color = "#ece6e2" banner_large = ManimBanner(dark_theme=False).scale(0.7) self.play(banner_large.create()) self.play(banner_large.expand()) ``` -------------------------------- ### Sync Dependencies with uv Source: https://github.com/manimcommunity/manim/blob/main/docs/source/contributing/development.md Use `uv sync` to create a virtual environment and install the project's core dependencies. For optional dependencies, use `uv sync --all-extras` or `uv sync --extra `. ```shell uv sync ``` ```shell uv sync --all-extras ``` ```shell uv sync --extra jupyterhub ``` -------------------------------- ### Render a Manim Scene from Command Line Source: https://github.com/manimcommunity/manim/blob/main/README.md Use this command in your terminal to render the Manim scene defined in 'example.py'. The -p flag previews the animation, and -ql sets low quality for faster rendering. ```sh manim -p -ql example.py SquareToCircle ``` -------------------------------- ### Manim Plugins Help Source: https://github.com/manimcommunity/manim/blob/main/docs/source/plugins.rst View help for the 'manim plugins' command to understand its options for managing plugins. ```bash manim plugins -h ``` -------------------------------- ### Advanced Rendering Options Source: https://github.com/manimcommunity/manim/blob/main/docs/source/guides/configuration.rst This example demonstrates several advanced command-line flags: specifying an output file name ('-o'), rendering only a range of animations ('-n'), setting a specific background color ('-c'), and changing the output format to GIF ('--format=gif'). ```bash manim -o myscene --format=gif -n 0,10 -c WHITE SceneName ``` -------------------------------- ### Install Manim with a Specific Python Version Source: https://github.com/manimcommunity/manim/blob/main/docs/source/installation/uv.md Initialize a new project with a specific Python version using `uv init`. This is useful for managing compatibility with other packages. After initializing, navigate into the project directory and add Manim using `uv add`. ```bash uv init --python 3.12 manimations cd manimations uv add manim ``` -------------------------------- ### Install pycairo with Conda Source: https://github.com/manimcommunity/manim/blob/main/docs/source/faq/installation.md Use this command to install a compatible version of pycairo when using Anaconda environments to resolve import errors. ```bash conda install -c conda-forge pycairo ``` -------------------------------- ### Equivalent CLI Commands with Configuration Source: https://github.com/manimcommunity/manim/blob/main/docs/source/guides/configuration.rst Shows how a 'manim.cfg' file can replace specific command-line flags for rendering a scene. ```bash manim -o myscene -i -c WHITE SceneName ``` ```bash manim SceneName ``` -------------------------------- ### Manim CLI Help and Commands Source: https://github.com/manimcommunity/manim/blob/main/docs/source/guides/configuration.rst This displays the main help page for the Manim command-line interface, showing available options and subcommands like 'cfg', 'init', 'new', 'plugins', and 'render'. ```bash Usage: manim [OPTIONS] COMMAND [ARGS]... Animation engine for explanatory math videos. Options: --version Show version and exit. --help Show this message and exit. Commands: cfg Manages Manim configuration files. init Sets up a new project in current working directory with default settings. It copies files from templates directory and pastes them in the current working dir. new Create a new project or insert a new scene. plugins Manages Manim plugins. render Render SCENE(S) from the input FILE. See 'manim ' to read about a specific subcommand. Made with <3 by Manim Community developers. ``` -------------------------------- ### VMobject Point Processing Example Source: https://github.com/manimcommunity/manim/blob/main/docs/source/guides/deep_dive.rst Demonstrates how to manually set points for a VMobject to define its shape using cubic Bézier curves. Handles and connecting lines are also visualized. ```python class VMobjectDemo(Scene): def construct(self): plane = NumberPlane() my_vmobject = VMobject(color=GREEN) my_vmobject.points = [ np.array([-2, -1, 0]), # start of first curve np.array([-3, 1, 0]), np.array([0, 3, 0]), np.array([1, 3, 0]), # end of first curve np.array([1, 3, 0]), # start of second curve np.array([0, 1, 0]), np.array([4, 3, 0]), np.array([4, -2, 0]), # end of second curve ] handles = [ Dot(point, color=RED) for point in [[-3, 1, 0], [0, 3, 0], [0, 1, 0], [4, 3, 0]] ] handle_lines = [ Line( my_vmobject.points[ind], my_vmobject.points[ind+1], color=RED, stroke_width=2 ) for ind in range(0, len(my_vmobject.points), 2) ] self.add(plane, *handles, *handle_lines, my_vmobject) ``` -------------------------------- ### Verify Manim Installation Source: https://github.com/manimcommunity/manim/blob/main/docs/source/installation/uv.md Runs a health check command using `uv run` to confirm Manim is correctly installed and available in the project environment. ```bash uv run manim checkhealth ``` -------------------------------- ### Dockerfile for Binder Environment Source: https://github.com/manimcommunity/manim/blob/main/docs/source/installation/jupyter.rst Use this Dockerfile to create a custom Binder environment with Manim installed. Ensure the version tag matches your local Manim installation. ```dockerfile FROM docker.io/manimcommunity/manim:v0.9.0 COPY --chown=manimuser:manimuser . /manim ``` -------------------------------- ### Build Manim Docker Image (Multi-Platform) Source: https://github.com/manimcommunity/manim/blob/main/docker/readme.md Builds a multi-platform Docker image (e.g., for ARM64 and AMD64) and pushes it. Replace TAG with your desired tag. ```bash docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag manimcommunity/manim:TAG -f docker/Dockerfile . ``` -------------------------------- ### NumPy Docstring Format for Functions Source: https://github.com/manimcommunity/manim/blob/main/docs/source/contributing/docs/docstrings.rst Use NumPy format for function docstrings, including Parameters, Returns, and Examples sections. Parameters should not include default values in their type documentation. Examples are highly encouraged for clarity. ```python def my_function( thing: int, other: np.ndarray, name: str, *, d: "SomeClassFromFarAway", test: Optional[int] = 45 ) -> "EpicClassInThisFile": # typings are optional for now """My cool function. Builds and modifies an :class:`EpicClassInThisFile` instance with the given parameters. Parameters ---------- thing Specifies the index of life. other Specifies something cool. name ``` -------------------------------- ### Normal Usage Example - Python Function Call Source: https://github.com/manimcommunity/manim/blob/main/docs/source/contributing/docs/docstrings.rst Demonstrates a typical function call with various argument types including integers, numpy arrays, strings, and custom class instances. This serves as an example for documenting function signatures and their expected inputs. ```python my_function(5, np.array([1, 2, 3]), "Chelovek", d=SomeClassFromFarAway(cool=True), test=5) ``` -------------------------------- ### Manim Directive Example Source: https://github.com/manimcommunity/manim/blob/main/docs/source/contributing/docs/examples.rst This is an example of how to use the `.. manim::` directive in an RST file to include a runnable Manim scene. The directive specifies the scene name and can include flags like `:save_last_frame:`. The Python class must match the specified scene name. ```rst .. code:: rst Formulas ======== .. manim:: Formula1 :save_last_frame: class Formula1(Scene): def construct(self): t = MathTex(r"\int_a^b f'(x) dx = f(b) - f(a)") self.add(t) self.wait(1) ``` -------------------------------- ### Manim Scene Definition and Rendering Source: https://github.com/manimcommunity/manim/blob/main/docs/source/guides/deep_dive.rst Defines a `ToyExample` scene with several animations and then renders it using `tempconfig` for specific rendering settings. This snippet demonstrates basic Manim animation commands like `add`, `play`, `Create`, `wait`, and `FadeOut`. ```python from manim import * class ToyExample(Scene): def construct(self): orange_square = Square(color=ORANGE, fill_opacity=0.5) blue_circle = Circle(color=BLUE, fill_opacity=0.5) self.add(orange_square) self.play(ReplacementTransform(orange_square, blue_circle, run_time=3)) small_dot = Dot() small_dot.add_updater(lambda mob: mob.next_to(blue_circle, DOWN)) self.play(Create(small_dot)) self.play(blue_circle.animate.shift(RIGHT)) self.wait() self.play(FadeOut(blue_circle, small_dot)) with tempconfig({"quality": "medium_quality", "preview": True}): scene = ToyExample() scene.render() ``` -------------------------------- ### Manim RotationUpdater Example Source: https://github.com/manimcommunity/manim/blob/main/docs/source/examples.rst Demonstrates how to use Mobject.add_updater and Mobject.remove_updater to create continuous rotation effects on a line object. ```python class RotationUpdater(Scene): def construct(self): def updater_forth(mobj, dt): mobj.rotate_about_origin(dt) def updater_back(mobj, dt): mobj.rotate_about_origin(-dt) line_reference = Line(ORIGIN, LEFT).set_color(WHITE) line_moving = Line(ORIGIN, LEFT).set_color(YELLOW) line_moving.add_updater(updater_forth) self.add(line_reference, line_moving) self.wait(2) line_moving.remove_updater(updater_forth) line_moving.add_updater(updater_back) self.wait(2) line_moving.remove_updater(updater_back) self.wait(0.5) ``` -------------------------------- ### reST Tip Directive Example Source: https://github.com/manimcommunity/manim/blob/main/docs/source/contributing/docs/admonitions.rst Use the `.. tip::` directive to offer helpful suggestions or advice to the reader. ```rest .. tip:: A tip ``` -------------------------------- ### Build Manim Documentation Locally Source: https://github.com/manimcommunity/manim/blob/main/docs/source/contributing/development.md Build the HTML version of the Manim documentation locally. This allows you to preview formatting and check for Sphinx errors. Run from the `docs` directory. ```shell make html ``` -------------------------------- ### GLSL Uniform Declaration Source: https://github.com/manimcommunity/manim/wiki/Developer-documentation-(WIP) Example of how a uniform variable, such as 'gloss' of type float, is declared in GLSL shader language. ```glsl uniform float gloss; ``` -------------------------------- ### Check dvisvgm PostScript support Source: https://github.com/manimcommunity/manim/blob/main/docs/source/faq/general.md Determine if your dvisvgm installation supports PostScript specials, which are necessary for PDF to SVG conversion. ```bash dvisvgm -l ``` -------------------------------- ### Typst: Text Mode Group Wrapping Source: https://github.com/manimcommunity/manim/blob/main/agents/typst_selector.md Example of how a text mode group with a label is wrapped using #box and the label. ```typst #box[Hello] ```