diff --git a/docs/source/development/about.rst b/docs/source/development/about.rst index 02bf7c3572..ba07c421ea 100644 --- a/docs/source/development/about.rst +++ b/docs/source/development/about.rst @@ -4,28 +4,43 @@ About About Manim ----------- -Manim is an animation engine for explanatory math videos. -You can use it to make math videos (or other fields) like 3Blue1Brown. +Manim is a powerful animation engine designed for creating +**explanatory math videos**. +It is widely used to create videos similar to those of 3Blue1Brown, +but it can also be applied to other domains that require precise +and visually appealing animations. -There are mainly two versions here: +There are mainly **two versions** of Manim: -- `3b1b/manim `_ : Maintained by Grant Sanderson of 3Blue1Brown. +- `3b1b/manim `__ + + Maintained by Grant Sanderson of 3Blue1Brown. -Using OpenGL and its GLSL language to use GPU for rendering. It has higher efficiency, -faster rendering speed, and supports real-time rendering and interaction. + - Uses **OpenGL** and its **GLSL language** to leverage the GPU. + - Offers higher efficiency, faster rendering, and real-time interaction. + - Best suited for high-quality production-ready videos. -- `ManimCommunity/manim `_ : Maintained by Manim Community Dev Team. +- `ManimCommunity/manim `__ + + Maintained by the Manim Community Development Team. -Using multiple backend rendering. There is better documentation and -a more open contribution community. + - Uses multiple backend rendering options. + - Provides better documentation and open contribution workflow. + - Ideal for learners and educators. -About this documentation +About this Documentation ------------------------ -This documentation is based on the version in `3b1b/manim `_. -Created by `TonyCrane `_ ("鹤翔万里" in Chinese) and in production. +This documentation is primarily based on: -Among them, the ``manim_example_ext`` extension for Sphinx refers to -`the documentation of ManimCommunity `_. +`3b1b/manim `__ -If you want to contribute to manim or this document, please see: :doc:`contributing` \ No newline at end of file +- Created by `TonyCrane `__. +- Continuously updated for clarity and accuracy. + +.. note:: + + Some features such as ``manim_example_ext`` are inspired by + the `ManimCommunity documentation `__. + +If you want to contribute, please see :doc:`contributing`. \ No newline at end of file diff --git a/docs/source/development/contributing.rst b/docs/source/development/contributing.rst index ce19472c2a..7cfe39b504 100644 --- a/docs/source/development/contributing.rst +++ b/docs/source/development/contributing.rst @@ -1,59 +1,81 @@ Contributing ============ -Accept any contribution you make :) +We welcome and appreciate any contributions you make to Manim! :) -- **Contribute to the manim source code**: +Contributing to the Source Code +------------------------------- -Please fork to your own repository and make changes, submit a pull request, and fill in -the motivation for the change following the instructions in the template. We will check -your pull request in detail (this usually takes a while, please be patient) +- **Fork the repository** to your own GitHub account. +- Make your changes locally. +- Submit a **pull request** to the main repository. +- Fill in the **motivation for your change** following the instructions in the provided template. -- **Contribute to the documentation**: +.. note:: -Also submit a pull request and write down the main changes. + Pull requests will be reviewed in detail. This process may take some time, so please be patient. -- **If you find a bug in the code**: +Contributing to the Documentation +--------------------------------- -Please open an issue and fill in the found problem and your environment according -to the template. (But please note that if you think this problem is just a problem -of yourself, rather than a problem of source code, it is recommended that you ask a -question in the `Q&A category `_ -of the discussion page) +- Make edits to the documentation files in your fork. +- Submit a **pull request** describing the main changes you made. -- **You are welcome to share the content you made with manim**: +Reporting Bugs +-------------- -Post it in the `show and tell category `_ -of the discussion page. +If you find a bug in the code: -- **You are also welcome to share some of your suggestions and ideas**: +1. Open a new **issue** in the repository. +2. Describe the problem clearly. +3. Include details about your **environment** (Python version, OS, Manim version, etc.) according to the issue template. -Post them in the `ideas category `_ -of the discussion page. +.. note:: -How to build this documentation -------------------------------- + If you suspect the problem is local to your setup rather than the source code, it is recommended to ask a question in the + `Q&A category `_ of the discussion page. + +Sharing Your Work +----------------- + +- You are welcome to share content you created using Manim. +- Post it in the `Show and Tell category `_ of the discussion page. + +Sharing Ideas and Suggestions +----------------------------- -- Clone the 3b1b/manim repository +- Suggestions, feature requests, and ideas are encouraged! +- Post them in the `Ideas category `_ of the discussion page. + +How to Build the Documentation +------------------------------ + +Follow these steps to build the Manim documentation locally: + +1. **Clone the repository** .. code-block:: sh git clone https://github.com/3b1b/manim.git - # or your own repo - # git clone https://github.com//manim.git + # Or clone your own fork + # git clone https://github.com//manim.git cd manim -- Install python package dependencies +2. **Install Python package dependencies** .. code-block:: sh pip install -r docs/requirements.txt -- Go to the ``docs/`` folder and build +3. **Navigate to the docs folder and build HTML** .. code-block:: sh cd docs/ make html -- The output document is located in ``docs/build/html/`` \ No newline at end of file +4. **Find the built documentation** + + The output HTML files will be located in:: + + docs/build/html/ \ No newline at end of file diff --git a/docs/source/documentation/constants.rst b/docs/source/documentation/constants.rst index c27515b0a5..19bd1488a1 100644 --- a/docs/source/documentation/constants.rst +++ b/docs/source/documentation/constants.rst @@ -1,98 +1,107 @@ -constants +Constants ========= -The ``constants.py`` in the ``manimlib`` folder defines the constants -needed when running manim. Some constants are not explained here because -they are only used inside manim. +The ``constants.py`` in ``manimlib`` defines all the constants needed when running Manim. +Some constants are internal and not usually modified by users. -Frame and pixel shape ---------------------- +Frame and Pixel Shape +-------------------- -These values will be determined based on the ``camera`` configuration in default_config.yml or custom_config.yml +These values are determined based on ``manim_config.camera`` in ``default_config.yml`` or ``custom_config.yml``: .. code-block:: python - ASPECT_RATIO - FRAME_HEIGHT - FRAME_WIDTH - FRAME_Y_RADIUS - FRAME_X_RADIUS + DEFAULT_RESOLUTION: tuple[int, int] = manim_config.camera.resolution + DEFAULT_PIXEL_WIDTH: int = DEFAULT_RESOLUTION[0] + DEFAULT_PIXEL_HEIGHT: int = DEFAULT_RESOLUTION[1] - DEFAULT_PIXEL_HEIGHT - DEFAULT_PIXEL_WIDTH - DEFAULT_FPS + ASPECT_RATIO: float = DEFAULT_PIXEL_WIDTH / DEFAULT_PIXEL_HEIGHT + FRAME_HEIGHT: float = manim_config.sizes.frame_height + FRAME_WIDTH: float = FRAME_HEIGHT * ASPECT_RATIO + FRAME_SHAPE: tuple[float, float] = (FRAME_WIDTH, FRAME_HEIGHT) + FRAME_Y_RADIUS: float = FRAME_HEIGHT / 2 + FRAME_X_RADIUS: float = FRAME_WIDTH / 2 Buffs ----- -These values will be determined based on the ``size`` configuration in default_config.yml or custom_config.yml - +Useful spacing values, configured in ``manim_config.sizes``: .. code-block:: python - SMALL_BUFF - MED_SMALL_BUFF - MED_LARGE_BUFF - LARGE_BUFF + SMALL_BUFF: float = manim_config.sizes.small_buff + MED_SMALL_BUFF: float = manim_config.sizes.med_small_buff + MED_LARGE_BUFF: float = manim_config.sizes.med_large_buff + LARGE_BUFF: float = manim_config.sizes.large_buff - DEFAULT_MOBJECT_TO_EDGE_BUFF - DEFAULT_MOBJECT_TO_MOBJECT_BUFF + DEFAULT_MOBJECT_TO_EDGE_BUFF: float = manim_config.sizes.default_mobject_to_edge_buff + DEFAULT_MOBJECT_TO_MOBJECT_BUFF: float = manim_config.sizes.default_mobject_to_mobject_buff Coordinates ----------- -manim uses three-dimensional coordinates and uses the type of ``ndarray`` +Manim uses 3D coordinates (``ndarray``) for positioning: + +.. code-block:: python + + ORIGIN: Vect3 = np.array([0., 0., 0.]) + UP: Vect3 = np.array([0., 1., 0.]) + DOWN: Vect3 = np.array([0., -1., 0.]) + RIGHT: Vect3 = np.array([1., 0., 0.]) + LEFT: Vect3 = np.array([-1., 0., 0.]) + IN: Vect3 = np.array([0., 0., -1.]) + OUT: Vect3 = np.array([0., 0., 1.]) + X_AXIS: Vect3 = RIGHT + Y_AXIS: Vect3 = UP + Z_AXIS: Vect3 = OUT + NULL_POINTS = np.array([[0., 0., 0.]]) + +Diagonal shortcuts: .. code-block:: python - ORIGIN = np.array((0., 0., 0.)) - UP = np.array((0., 1., 0.)) - DOWN = np.array((0., -1., 0.)) - RIGHT = np.array((1., 0., 0.)) - LEFT = np.array((-1., 0., 0.)) - IN = np.array((0., 0., -1.)) - OUT = np.array((0., 0., 1.)) - X_AXIS = np.array((1., 0., 0.)) - Y_AXIS = np.array((0., 1., 0.)) - Z_AXIS = np.array((0., 0., 1.)) - - # Useful abbreviations for diagonals - UL = UP + LEFT - UR = UP + RIGHT - DL = DOWN + LEFT - DR = DOWN + RIGHT - - TOP = FRAME_Y_RADIUS * UP - BOTTOM = FRAME_Y_RADIUS * DOWN - LEFT_SIDE = FRAME_X_RADIUS * LEFT - RIGHT_SIDE = FRAME_X_RADIUS * RIGHT - -Mathematical constant ---------------------- + UL: Vect3 = UP + LEFT + UR: Vect3 = UP + RIGHT + DL: Vect3 = DOWN + LEFT + DR: Vect3 = DOWN + RIGHT + +Frame edges: .. code-block:: python - PI = np.pi - TAU = 2 * PI - DEG = TAU / 360 + TOP: Vect3 = FRAME_Y_RADIUS * UP + BOTTOM: Vect3 = FRAME_Y_RADIUS * DOWN + LEFT_SIDE: Vect3 = FRAME_X_RADIUS * LEFT + RIGHT_SIDE: Vect3 = FRAME_X_RADIUS * RIGHT -Text ----- +Angles +------ + +.. code-block:: python + + PI: float = np.pi + TAU: float = 2 * PI + DEG: float = TAU / 360 + DEGREES = DEG # Older animations may use this + RADIANS: float = 1 + +Text Styles +----------- .. code-block:: python - NORMAL = "NORMAL" - ITALIC = "ITALIC" - OBLIQUE = "OBLIQUE" - BOLD = "BOLD" + NORMAL: str = "NORMAL" + ITALIC: str = "ITALIC" + OBLIQUE: str = "OBLIQUE" + BOLD: str = "BOLD" Colours ------- -Color constants are determined based on the ``color`` configuration in default_config.yml or custom_config.yml +Color constants are determined based on the ``manim_config.colors`` configuration +in ``default_config.yml`` or ``custom_config.yml``. -Here are the preview of default colours. (Modified from -`elteoremadebeethoven `_) +Here are the preview of default colours. .. raw:: html @@ -104,6 +113,7 @@ Here are the preview of default colours. (Modified from

BLUE_B

BLUE_A

+

TEAL

TEAL_E

@@ -112,6 +122,7 @@ Here are the preview of default colours. (Modified from

TEAL_B

TEAL_A

+

GREEN

GREEN_E

@@ -120,6 +131,7 @@ Here are the preview of default colours. (Modified from

GREEN_B

GREEN_A

+

YELLOW

YELLOW_E

@@ -128,6 +140,7 @@ Here are the preview of default colours. (Modified from

YELLOW_B

YELLOW_A

+

GOLD

GOLD_E

@@ -136,6 +149,7 @@ Here are the preview of default colours. (Modified from

GOLD_B

GOLD_A

+

RED

RED_E

@@ -144,6 +158,7 @@ Here are the preview of default colours. (Modified from

RED_B

RED_A

+

MAROON

MAROON_E

@@ -152,6 +167,7 @@ Here are the preview of default colours. (Modified from

MAROON_B

MAROON_A

+

PURPLE

PURPLE_E

@@ -160,6 +176,7 @@ Here are the preview of default colours. (Modified from

PURPLE_B

PURPLE_A

+

GREY

GREY_E

@@ -168,6 +185,7 @@ Here are the preview of default colours. (Modified from

GREY_B

GREY_A

+

Others

WHITE

@@ -179,4 +197,9 @@ Here are the preview of default colours. (Modified from

LIGHT_PINK

GREEN_SCREEN

ORANGE

+

PURE_RED

+

PURE_GREEN

+

PURE_BLUE

+ +
\ No newline at end of file diff --git a/docs/source/documentation/custom_config.rst b/docs/source/documentation/custom_config.rst index 271399ce2b..e65f143788 100644 --- a/docs/source/documentation/custom_config.rst +++ b/docs/source/documentation/custom_config.rst @@ -1,176 +1,165 @@ custom_config -============== +============= -``directories`` ---------------- +This file determines the default configuration for how Manim is run, including +names for directories it will write to, default parameters for various classes, +style choices, etc. To customize your own, create a ``custom_config.yml`` file +in whatever directory you are running Manim. -- ``mirror_module_path`` - (``True`` or ``False``) Whether to create a folder named the name of the - running file under the ``output`` path, and save the output (``images/`` - or ``videos/``) in it. - -- ``base`` - The root directory that will hold files, such as video files manim renders, - or image resources that it pulls from - -- ``output`` - Output file path, the videos will be saved in the ``videos/`` folder under it, - and the pictures will be saved in the ``images/`` folder under it. - - For example, if you set ``output`` to ``"/.../manim/output"`` and - ``mirror_module_path`` to ``False``, then you exported ``Scene1`` in the code - file and saved the last frame, then the final directory structure will be like: - - .. code-block:: text - :emphasize-lines: 9, 11 - - manim/ - ├── manimlib/ - │ ├── animation/ - │ ├── ... - │ ├── default_config.yml - │ └── window.py - ├── output/ - │ ├── images - │ │ └── Scene1.png - │ └── videos - │ └── Scene1.mp4 - ├── code.py - └── custom_config.yml - - But if you set ``mirror_module_path`` to ``True``, the directory structure will be: - - .. code-block:: text - :emphasize-lines: 8 - - manim/ - ├── manimlib/ - │ ├── animation/ - │ ├── ... - │ ├── default_config.yml - │ └── window.py - ├── output/ - │ └── code/ - │ ├── images - │ │ └── Scene1.png - │ └── videos - │ └── Scene1.mp4 - ├── code.py - └── custom_config.yml - -- ``raster_images`` - The directory for storing raster images to be used in the code (including - ``.jpg``, ``.jpeg``, ``.png`` and ``.gif``), which will be read by ``ImageMobject``. - -- ``vector_images`` - The directory for storing vector images to be used in the code (including - ``.svg`` and ``.xdv``), which will be read by ``SVGMobject``. - -- ``sounds`` - The directory for storing sound files to be used in ``Scene.add_sound()`` ( - including ``.wav`` and ``.mp3``). +Alternatively, you can create it wherever you like, and on running Manim, pass in +``--config_file /path/to/custom/config/file.yml``. -- ``cache`` - The directory for storing temporarily generated cache files, including - ``Tex`` cache, ``Text`` cache and storage of object points. +directories +----------- +- ``mirror_module_path`` + (``True`` or ``False``) Whether to create a folder named the name of the + running file under the ``output`` path, and save the output + (``images/`` or ``videos/``) in it. -``window`` ----------- +- ``removed_mirror_prefix`` + Path prefix to remove from mirrored directories. -- ``position_string`` - The relative position of the playback window on the display (two characters, - the first character means upper(U) / middle(O) / lower(D), the second character - means left(L) / middle(O) / right(R)). +- ``base`` + The root directory that will hold files, such as video files Manim renders, + or image resources that it pulls from. + +- ``subdirs`` + Subdirectories under ``base`` for various resources: + + - ``output``: Where Manim saves video and image files. + - ``raster_images``: For ``.jpg``, ``.jpeg``, ``.png``, ``.gif`` used by ``ImageMobject``. + - ``vector_images``: For ``.svg`` and ``.xdv`` used by ``SVGMobject``. + - ``pi_creature_images``: SVG images for Pi creatures. + - ``three_d_models``: For 3D model files. + - ``sounds``: For audio files used in ``Scene.add_sound()``. + - ``data``: Any project-related data like CSVs. + - ``downloads``: Default folder for downloaded assets. + - ``latex_cache``: For storing cached LaTeX compilation results. -- ``monitor_index`` - If using multiple monitors, which one should the window show up in? +- ``cache`` + Directory for storing temporary cache files, including Tex/Text caches. -- ``full_screen`` - Should the preview window be full screen. If not, it defaults to half the screen +window +------ -- ``position`` - This is an option to more manually set the default window position, in pixel - coordinates, e.g. (500, 300) +- ``position_string``: Position of the playback window on screen (e.g. UR → Upper Right). +- ``monitor_index``: Which monitor to display the window on. +- ``full_screen``: Whether to use full screen. +- ``position``: Optional pixel coordinates to manually set window position. +- ``size``: Optional pixel dimensions to manually set window size. -- ``size`` - Option to more manually set the default window size, in pixel coordinates, - e.g. (1920, 1080) +camera +------ +- ``resolution``: Output resolution, e.g. (1920, 1080). +- ``background_color``: Default scene background color. +- ``fps``: Frames per second. +- ``background_opacity``: Opacity of background. -``camera`` ----------- +file_writer +----------- -- ``resolution`` - Resolution to render at, e.g. (1920, 1080) +Configuration for file writing, e.g., ffmpeg parameters: -- ``background_color`` - Default background color of scenes +- ``ffmpeg_bin``: Path to ffmpeg. +- ``video_codec``: Codec to use. +- ``pixel_format``: Pixel format. +- ``saturation``: Saturation value. +- ``gamma``: Gamma correction. -- ``fps`` - Framerate +scene +----- -- ``background_opacity`` - Opacity of the background +Default configuration for the ``Scene`` class: +- ``show_animation_progress``: Show progress bars. +- ``leave_progress_bars``: Keep progress bars visible. +- ``preview_while_skipping``: Render a single frame when skipping animations. +- ``default_wait_time``: Duration for ``Scene.wait()`` calls. -``file_writer`` ---------------- -Configuration specifying how files are written, e.g. what ffmpeg parameters to use +vmobject +-------- +- ``default_stroke_width``: Stroke width. +- ``default_stroke_color``: Default stroke color. +- ``default_fill_color``: Default fill color. -``scene`` +mobject ------- -Some default configuration for the Scene class +- ``default_mobject_color``: Default mobject color. +- ``default_light_color``: Default light color. -``text`` -------- - -- ``font`` - Default font of Text +tex +--- -- ``text_alignment`` - Default text alignment for LaTeX +- ``template``: Tex template to use (see ``tex_templates.yml``). -``tex`` -------- +text +---- -- ``template`` - Which configuration from the manimlib/tex_template.yml file should be used - to determine the latex compiler to use, and what preamble to include for - rendering tex. +- ``font``: Default font for Text. +- ``alignment``: Default alignment for LaTeX text. +embed +----- -``sizes`` ---------- +- ``exception_mode``: Mode for displaying exceptions. +- ``autoreload``: Whether to automatically reload scripts. -Valuess for various constants used in manimm to specify distances, like the height -of the frame, the value of SMALL_BUFF, LARGE_BUFF, etc. +resolution_options +------------------ +- ``low``: Low resolution (854, 480) +- ``med``: Medium resolution (1280, 720) +- ``high``: High resolution (1920, 1080) +- ``4k``: Ultra HD (3840, 2160) -``colors`` ----------- +sizes +----- -Color pallete to use, determining values of color constants like RED, BLUE_E, TEAL, etc. +- ``frame_height``: Frame height for Manim coordinate system. +- ``small_buff``, ``med_small_buff``, ``med_large_buff``, ``large_buff``: Default spacing constants. +- ``default_mobject_to_edge_buff``: Buffer for ``Mobject.to_edge``. +- ``default_mobject_to_mobject_buff``: Buffer for ``Mobject.next_to``. -``loglevel`` +key_bindings ------------ -Can be DEBUG / INFO / WARNING / ERROR / CRITICAL - +Default keyboard bindings: + +- ``pan_3d``: d +- ``pan``: f +- ``reset``: r +- ``quit``: q +- ``select``: s +- ``unselect``: u +- ``grab``: g +- ``x_grab``: h +- ``y_grab``: v +- ``z_grab``: z +- ``resize``: t +- ``color``: c +- ``information``: i +- ``cursor``: k + +colors +------ + +Defined in ``custom_config.yml`` (see colors section above). + +log_level +--------- -``universal_import_line`` -------------------------- +Can be DEBUG / INFO / WARNING / ERROR / CRITICAL. -Import line that need to execute when entering interactive mode directly. +universal_import_line +--------------------- +Python import line to execute in interactive mode. -``ignore_manimlib_modules_on_reload`` -------------------------------------- +ignore_manimlib_modules_on_reload +--------------------------------- -When calling ``reload`` during the interactive mode, imported modules are -by default reloaded, in case the user writing a scene which pulls from various -other files they have written. By default, modules withinn the manim library will -be ignored, but one developing manim may want to set this to be False so that -edits to the library are reloaded as well. +If False, modules inside Manim are reloaded when calling ``reload`` in interactive mode. \ No newline at end of file diff --git a/docs/source/getting_started/installation.rst b/docs/source/getting_started/installation.rst index bf5cea3359..a1eb416214 100644 --- a/docs/source/getting_started/installation.rst +++ b/docs/source/getting_started/installation.rst @@ -1,95 +1,164 @@ Installation ============ -Manim runs on Python 3.7 or higher. +ManimGL runs on **Python 3.7 or higher**. -System requirements are: - -- `FFmpeg `__ -- `OpenGL `__ (included in python package ``PyOpenGL``) -- `LaTeX `__ (optional, if you want to use LaTeX) -- `Pango `__ (only for Linux) +System Requirements +------------------- +- `FFmpeg `__ +- `OpenGL `__ (included in Python package ``PyOpenGL``) +- `LaTeX `__ (optional, only if you want to render LaTeX) +- `Pango `__ (required only for Linux) +--- Install FFmpeg --------------- - - +-------------------------- -Install FFmpeg Windows ------------------------- +Windows +---------------- .. code-block:: cmd choco install ffmpeg +.. admonition:: 💡 Note + :class: tip -# Install FFmepeg Linux ----------------------------- + Make sure FFmpeg is added to your PATH environment variable. + +Linux +-------- .. code-block:: sh - $ sudo apt update - $ sudo apt install ffmpeg - $ ffmpeg -version - -# Install FFmpeg MacOS ----------------------------- -- Download This ZIP file `https://www.gyan.dev/ffmpeg/builds/ffmpeg-git-full.7z`(if the link is not working download this zip file from there original website) + sudo apt update + sudo apt install ffmpeg + ffmpeg -version +MacOS +------ +- Download the FFmpeg ZIP archive from: + `FFmpeg Builds `__ +.. admonition:: 💡 Note + :class: tip -Directly --------- + If the link is not working, you can download FFmpeg from the official website: `https://ffmpeg.org/download.html`__ + +--- + +Direct Installation via pip +--------------------------- .. code-block:: sh - # Install manimgl + # Install ManimGL pip install manimgl - # Try it out + # Test the installation manimgl -If you want to hack on manimlib itself, clone this repository and in -that directory execute: +.. admonition:: 💡 Note + :class: tip + + If no error appears, the installation was successful. + +--- + +Clone & Editable Installation +------------------------------ + +If you want to hack on ManimGL itself: .. code-block:: sh - # Install python requirements + # Clone the repository + git clone https://github.com/3b1b/manim.git + cd manim + + # Install in editable mode pip install -e . - # Try it out + # Test an example scene manimgl example_scenes.py OpeningManimExample # or manim-render example_scenes.py OpeningManimExample -If you run the above command and no error message appears, -then you have successfully installed all the environments required by manim. +--- + +Linux (Debian-based distributions) +----------------------------------- +These instructions apply to Debian-based systems such as **Ubuntu, Linux Mint, Pop!_OS**, etc. + +1. Install system dependencies: + + .. code-block:: sh + + sudo apt update + sudo apt install ffmpeg texlive-latex-base texlive-latex-recommended texlive-fonts-recommended + sudo apt install texlive-science texlive-fonts-extra texlive-latex-extra + sudo apt install libpango1.0-dev pkg-config python3-dev + + .. admonition:: 💡 Note + :class: tip + + These packages provide a lightweight LaTeX setup (~1.5GB). + If you want the full LaTeX distribution (~6GB), you can install: + + .. code-block:: sh + + sudo apt install texlive-full + +--- Directly (Windows) ------------------ +1. Install `FFmpeg `__ and ensure its path is in the PATH environment variable. +2. Install a LaTeX distribution: `TeXLive-full `__ is recommended. +3. Clone and install ManimGL: -1. `Install - FFmpeg `__, and make sure that its path is in the PATH environment variable. -2. Install a LaTeX distribution. - `TeXLive-full `__ is recommended. -3. Install the remaining Python packages. + .. code-block:: sh -.. code-block:: sh + git clone https://github.com/3b1b/manim.git + cd manim + pip install -e . + manimgl example_scenes.py OpeningManimExample - git clone https://github.com/3b1b/manim.git - cd manim - pip install -e . - manimgl example_scenes.py OpeningManimExample +--- + +For Anaconda Users +------------------- +- **Install FFmpeg and LaTeX** as described above. +- **Create a conda environment and install ManimGL:** + + .. code-block:: sh + + # Clone the repository + git clone https://github.com/3b1b/manim.git + cd manim -For Anaconda ------------- + # Create a conda environment (choose your Python version) + conda create -n manim python= # e.g., python=3.8 or python=3.12 + conda activate manim -- Install FFmpeg and LaTeX as above. -- Create a conda environment using + # Install Manim in editable mode (choose version if needed) + pip install -e .[dev] +.. admonition:: 💡 Note + :class: tip + + Replace `` with the Python version you want (>=3.7). + The `[dev]` option installs optional dependencies useful for development and examples. + +--- + +Quick Test +---------- .. code-block:: sh - - git clone https://github.com/3b1b/manim.git - cd manim - conda create -n manim python=3.8 - conda activate manim - pip install -e . + + manimgl example_scenes.py OpeningManimExample + +.. admonition:: 💡 Note + :class: tip + + If a window pops up playing a scene, your installation is ready. + If you encounter errors, check FFmpeg, Python version, or LaTeX installation. \ No newline at end of file diff --git a/docs/source/getting_started/structure.rst b/docs/source/getting_started/structure.rst index b7a0b2a778..d1c21046bf 100644 --- a/docs/source/getting_started/structure.rst +++ b/docs/source/getting_started/structure.rst @@ -3,125 +3,139 @@ Manim's structure Manim's directory structure ---------------------------- +---------------------------- -The manim directory looks very complicated, with a lot of files, +The manim directory looks very complicated, with a lot of files, but the structure is clear. Below is the directory structure of manim: .. code-block:: text - manimlib/ # manim library - ├── __init__.py - ├── __main__.py - ├── default_config.yml # Default configuration file - ├── config.py # Process CLI flags - ├── constants.py # Defined some constants - ├── extract_scene.py # Extract and run the scene - ├── shader_wrapper.py # Shaders' Wrapper for convenient control - ├── window.py # Playback window - ├── tex_templates/ # Templates preset for LaTeX - │ ├── tex_templates.tex # Tex template (will be compiled with latex, default) - │ └── ctex_templates.tex # Tex template that support Chinese (will be compiled with xelatex) - ├── camera/ - │ └── camera.py # Including Camera and CameraFrame - ├── scene/ - │ ├── scene_file_writer.py # Used to write scene to video file - │ ├── scene.py # The basic Scene class - │ ├── three_d_scene.py # Three-dimensional scene - │ ├── sample_space_scene.py # Probability related sample space scene - │ └── vector_space_scene.py # Vector field scene - ├── animation/ - │ ├── animation.py # The basic class of animation - │ ├── composition.py # Animation group - │ ├── creation.py # Animation related to Create - │ ├── fading.py # Fade related animation - │ ├── growing.py # Animation related to Grow - │ ├── indication.py # Some animations for emphasis - │ ├── movement.py # Animation related to movement - │ ├── numbers.py # Realize changes to DecimalNumber - │ ├── rotation.py # Animation related to rotation - │ ├── specialized.py # Some uncommon animations for special projects - │ ├── transform_matching_parts.py # Transform which can automatically match parts - │ ├── transform.py # Some Transforms - │ └── update.py # Realize update from function - ├── mobject/ - │ ├── mobject.py # The basic class of all math object - │ ├── types/ # 4 types of mobject - │ │ ├── dot_cloud.py # Dot cloud (an subclass of PMobject) - │ │ ├── image_mobject.py # Insert pictures - │ │ ├── point_cloud_mobject.py # PMobject (mobject composed of points) - │ │ ├── surface.py # ParametricSurface - │ │ └── vectorized_mobject.py # VMobject (vectorized mobject) - │ ├── svg/ # mobject related to svg - │ │ ├── svg_mobject.py # SVGMobject - │ │ ├── brace.py # Brace - │ │ ├── drawings.py # Some special mobject of svg image - │ │ ├── tex_mobject.py # Tex and TexText implemented by LaTeX - │ │ └── text_mobject.py # Text implemented by manimpango - │ ├── changing.py # Dynamically changing mobject - │ ├── coordinate_systems.py # coordinate system - │ ├── frame.py # mobject related to frame - │ ├── functions.py # ParametricFunction - │ ├── geometry.py # geometry mobjects - │ ├── matrix.py # matrix - │ ├── mobject_update_utils.py # some defined updater - │ ├── number_line.py # Number line - │ ├── numbers.py # Numbers that can be changed - │ ├── probability.py # mobject related to probability - │ ├── shape_matchers.py # mobject adapted to the size of other objects - │ ├── three_dimensions.py # Three-dimensional objects - │ ├── value_tracker.py # ValueTracker which storage number - │ └── vector_field.py # VectorField - ├── once_useful_constructs/ # 3b1b's Common scenes written for some videos - │ └── ... - ├── shaders/ # GLSL scripts for rendering - │ ├── simple_vert.glsl # a simple glsl script for position - │ ├── insert/ # glsl scripts to be inserted in other glsl scripts - │ │ ├── NOTE.md # explain how to insert glsl scripts - │ │ └── ... # useful scripts - │ ├── image/ # glsl for images - │ │ └── ... # containing shaders for vertex and fragment - │ ├── quadratic_bezier_fill/ # glsl for the fill of quadratic bezier curve - │ │ └── ... # containing shaders for vertex, fragment and geometry - │ ├── quadratic_bezier_stroke/ # glsl for the stroke of quadratic bezier curve - │ │ └── ... # containing shaders for vertex, fragment and geometry - │ ├── surface/ # glsl for surfaces - │ │ └── ... # containing shaders for vertex and fragment - │ ├── textured_surface/ # glsl for textured_surface - │ │ └── ... # containing shaders for vertex and fragment - │ └── true_dot/ # glsl for a dot - │ └── ... # containing shaders for vertex, fragment and geometry - └── utils/ # Some useful utility functions - ├── bezier.py # For bezier curve - ├── color.py # For color - ├── dict_ops.py # Functions related to dictionary processing - ├── customization.py # Read from custom_config.yml - ├── debug.py # Utilities for debugging in program - ├── directories.py # Read directories from config file - ├── family_ops.py # Process family members - ├── file_ops.py # Process files and directories - ├── images.py # Read image - ├── iterables.py # Functions related to list/dictionary processing - ├── paths.py # Curve path - ├── rate_functions.py # Some defined rate_functions - ├── simple_functions.py # Some commonly used functions - ├── sounds.py # Process sounds - ├── space_ops.py # Space coordinate calculation - ├── strings.py # Process strings - └── tex_file_writing.py # Use LaTeX to write strings as svg - -Inheritance structure of manim's classes + manimlib/ # Main Manim library package + ├── __init__.py # Package initializer + ├── __main__.py # CLI entry point + ├── config.py # Configuration handling + ├── constants.py # Global constants (colors, directions, etc.) + ├── default_config.yml # Default configuration file + ├── extract_scene.py # Extract and run scenes + ├── logger.py # Logging utilities + ├── module_loader.py # Dynamic module loading + ├── shader_wrapper.py # Shader wrapper for convenient control + ├── tex_templates.yml # LaTeX templates + ├── typing.py # Custom typing definitions + ├── window.py # Playback window + + ├── animation/ # Animation system + │ ├── animation.py # Base Animation class + │ ├── composition.py # AnimationGroup, Succession, etc. + │ ├── creation.py # Create / Write animations + │ ├── fading.py # FadeIn, FadeOut + │ ├── growing.py # Grow animations + │ ├── indication.py # Emphasis animations + │ ├── movement.py # Movement animations + │ ├── numbers.py # DecimalNumber animations + │ ├── rotation.py # Rotation animations + │ ├── specialized.py # Special project animations + │ ├── transform.py # Transform animations + │ ├── transform_matching_parts.py # Smart matching transforms + │ └── update.py # UpdateFromFunc animations + + ├── camera/ # Camera system + │ ├── camera.py # Camera and CameraFrame + │ └── camera_frame.py # CameraFrame definition + + ├── event_handle/ # Event handling (keyboard, mouse) + │ ├── event_dispatcher.py # Event dispatcher + │ ├── event_listner.py # Event listeners + │ └── event_type.py # Event type definitions + + ├── mobject/ # Core visual objects + │ ├── mobject.py # Base Mobject class + │ ├── mobject_update_utils.py # Updater utilities + │ ├── boolean_ops.py # Union, intersection, difference + │ ├── changing.py # Dynamically changing mobjects + │ ├── coordinate_systems.py # Axes, NumberPlane + │ ├── frame.py # Frame-related mobjects + │ ├── functions.py # ParametricFunction + │ ├── geometry.py # Circle, Square, Line, etc. + │ ├── interactive.py # Interactive mobjects + │ ├── matrix.py # Matrix mobject + │ ├── number_line.py # NumberLine + │ ├── numbers.py # DecimalNumber, Integer + │ ├── probability.py # Probability visuals + │ ├── shape_matchers.py # SurroundingRectangle, etc. + │ ├── three_dimensions.py # 3D objects + │ ├── value_tracker.py # ValueTracker + │ └── vector_field.py # VectorField + + │ ├── types/ # Core mobject types + │ │ ├── vectorized_mobject.py # VMobject (Bezier-based) + │ │ ├── point_cloud_mobject.py# PMobject (points-based) + │ │ ├── dot_cloud.py # DotCloud + │ │ ├── image_mobject.py # ImageMobject + │ │ └── surface.py # ParametricSurface + + │ └── svg/ # SVG & LaTeX-based mobjects + │ ├── svg_mobject.py # SVG loader + │ ├── tex_mobject.py # Tex (LaTeX) + │ ├── text_mobject.py # Text (Pango) + │ ├── string_mobject.py # String-based objects + │ ├── special_tex.py # Special LaTeX + │ ├── old_tex_mobject.py # Legacy Tex + │ ├── brace.py # Brace object + │ └── drawings.py # Custom SVG drawings + + ├── scene/ # Scene system + │ ├── scene.py # Base Scene class + │ ├── interactive_scene.py # Interactive scenes + │ ├── scene_embed.py # Embed mode + │ └── scene_file_writer.py # Video writer + + ├── shaders/ # GLSL shaders + │ ├── simple_vert.glsl # Basic vertex shader + │ ├── insert/ # GLSL snippets + │ ├── image/ # Image shaders + │ ├── surface/ # Surface shaders + │ ├── textured_surface/ # Textured surface shaders + │ ├── quadratic_bezier/ # Bezier fill shaders + │ ├── true_dot/ # Dot shader + │ ├── mandelbrot_fractal/ # Mandelbrot shader + │ └── newton_fractal/ # Newton fractal shader + + └── utils/ # Utility functions + ├── bezier.py # Bezier curve math + ├── cache.py # Caching utilities + ├── color.py # Color utilities + ├── debug.py # Debug helpers + ├── dict_ops.py # Dictionary operations + ├── directories.py # Directory management + ├── family_ops.py # Mobject family handling + ├── file_ops.py # File utilities + ├── images.py # Image processing + ├── iterables.py # Iterable helpers + ├── paths.py # Path calculations + ├── rate_functions.py # Animation easing functions + ├── shaders.py # Shader utilities + ├── simple_functions.py # Common helper functions + ├── sounds.py # Sound processing + ├── space_ops.py # Vector/space math + ├── text.py # Text utilities + ├── tex_file_writing.py # LaTeX compilation + └── tex_to_symbol_count.py # LaTeX symbol counting + + +Inheritance structure of Manim's classes ---------------------------------------- -`Here `_ -is a pdf showed inheritance structure of manim's classes, large, -but basically all classes have included: +Here is a PDF showing the inheritance structure of Manim's classes: -.. image:: https://cdn.jsdelivr.net/gh/manim-kindergarten/CDN@master/manimgl_assets/manim_shaders_structure.png +https://github.com/3b1b/manim/files/5824383/manim_shaders_structure.pdf -Manim execution process ------------------------ +The structure is large, but fundamentally most components are built upon: -.. image:: https://cdn.jsdelivr.net/gh/manim-kindergarten/CDN@master/manimgl_assets/manim_shaders_process_en.png +- Mobject +- VMobject / PMobject +- Animation +- Scene +- Camera \ No newline at end of file