This repository is a collection of Manim scripts and utilities for creating mathematical animations. It's structured to organize scenes, reusable code, and assets effectively.
The repository is organized as follows:
README.md: This file, providing an overview of the project.requirements.txt: Specifies the Python dependencies for this project..gitignore: Lists files and directories that Git should ignore (e.g., cache files, virtual environments).scenes/: Contains all Manim scene scripts. Each.pyfile in this directory typically defines one or more Manim scenes.scenes/example_scene.py: An example of how a scene file could be structured (you can create this or use an existing one as an example).
src/: Houses custom Python modules, utility functions, or custom Manim Mobjects that can be reused across different scenes.src/__init__.py: An empty file that makes thesrc/directory a Python package, allowing for easier imports.src/custom_utils.py: An example of a utility module where you might place helper functions or custom classes (you can create this).
assets/: Stores static files such as images, sound files, data files (e.g., CSV, JSON), etc., that your Manim scenes might need.tests/: Contains unit tests for your custom modules and potentially for scenes to ensure they behave as expected.
To run the scripts in this repository, you'll need to set up a Python environment with Manim and its dependencies.
- 
Clone the repository:
git clone https://github.com/your-username/your-repository-name.git cd your-repository-name(Replace
your-username/your-repository-namewith the actual path if different) - 
Create and activate a virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
 - 
Install LaTeX: Manim requires a LaTeX distribution for rendering text and formulas. Install a LaTeX distribution suitable for your operating system:
- Debian/Ubuntu:
sudo apt-get install texlive-full
 - macOS (using MacPorts):
sudo port install texlive-full
 - macOS (using Homebrew):
brew install --cask mactex
 - Windows (using MiKTeX): Download and install MiKTeX from https://miktex.org/download. A full installation is recommended.
 - Windows (using Chocolatey):
(Ensure you run PowerShell as Administrator)
choco install miktex --params="--shared"
 
 - Debian/Ubuntu:
 - 
Install the required packages:
pip install -r requirements.txt
 
- New Scenes: Place all new Manim scene scripts (Python files containing classes derived from 
Scene) into thescenes/directory. - Reusable Code: If you develop utility functions, custom Mobjects, or any other Python code that you intend to reuse across multiple scenes, place it within the 
src/directory. You can organizesrc/into sub-modules if needed. For example, from a scene inscenes/my_scene.py, you could import a utility function like this:from src.custom_utils import my_helper_function from src.custom_mobjects import MyCustomMobject
 - Assets: Any external files like images, sound clips, or data files should be placed in the 
assets/directory. When referencing these in your scenes, use a path relative to the project root, e.g.,assets/my_image.pngorassets/data/my_data.csv. Manim'sImageMobject("assets/my_image.png")will correctly locate the file. 
To run Manim scripts, navigate to the root directory of this project in your terminal. Here are examples of how to render scenes now that they are in the scenes/ directory:
- 
Atom Animation (
scenes/atom.py)- Command:
manim -pql scenes/atom.py AtomAnimation
 
 - Command:
 - 
Dice Roll Simulation (
scenes/dice.py)- To run the 
Dicescene:manim -pql scenes/dice.py Dice
 
 - To run the 
 - 
Calculus Explanations (
scenes/calculus.py)- To run the 
MaclaurinSinescene:manim -pql scenes/calculus.py MaclaurinSine
 
 - To run the 
 - 
Sorting Algorithm Visualizations (
scenes/sorts.py)- To run the 
InsertionSortScene:manim -pql scenes/sorts.py InsertionSortScene
 
 - To run the 
 - 
OpenGL Example (
scenes/openg.py)- If you have scenes requiring the OpenGL renderer:
manim --renderer=opengl -pql scenes/openg.py OpenGLIntro
 
 - If you have scenes requiring the OpenGL renderer:
 
Note:
- The 
-pqlflags stand for "preview", "quality low". Use-pqmfor medium quality or-pqhfor high quality. - To list all scenes in a file: 
manim scenes/your_script_name.py 
Contributions to this repository are welcome! If you have new Manim scripts, improvements to existing ones, or bug fixes, please follow these steps:
- Fork the repository.
 - Clone your fork.
 - Create a new branch (
git checkout -b my-new-feature). - Make your changes. Ensure your code follows the project structure (scenes in 
scenes/, reusable code insrc/). - Commit your changes (
git commit -am 'Add some feature'). - Push to your branch (
git push origin my-new-feature). - Create a Pull Request.
 
This repository and its structure draw inspiration from common practices in software development and from various sources in the Manim community, including:
- https://github.com/kolibril13/mobject-gallery
 - https://github.com/pedrovhb/anims
 - General Python project structuring guidelines.