A Python GUI-based application to create beautiful Manim animations for algorithms and data structures.
Assumes setup on Ubuntu Linux.
First, install Python and Python Dev Tools (if not already installed)
sudo apt install python3 python3-dev
Next, install all system library dependencies of Manim (this will consume quite a bit of disk space)
sudo apt install sox ffmpeg libcairo2 libcairo2-dev texlive-full
For alternative system setup, please check out the official Manim documentation
Lastly, set up a virtual environment and install the Python dependencies. The command line should now be prefaced by (venv)
.
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Verify installation by running the following command, which will produce preview files under ./media
.
python3 -m manim example_scenes.py SquareToCircle -pl
You can run the video-rendering GUI as follows:
python3 -m cmdgui
Directory | Content Description |
---|---|
algomanim/ |
Library containing implementations of Data Structures and Animations |
algomanim_examples/ |
Various examples showing how to use AlgoManim library |
gui/ |
AlgoManim GUI Source Code |
manim_example/ |
Animations written in pure manim for reference |
tests/ |
Tests |
Examples that show the usage of the customizations and data structures that we support currently are provided in the algomanim_examples/
folder. If you would like to get a quick overview of all the features we provide, please see algomanim_examples/binarytreesort.py
.
The simplest algomanim program, only requires a single python file with a class that extends AlgoScene
and overrides the algo(self)
method (as seen below). This scene, implements the BubbleSort Algorithm.
from algomanim.algoscene import AlgoScene
from algomanim.algolist import AlgoList
class DefaultBubbleSortScene(AlgoScene):
def algo(self):
algolist = AlgoList(self, [25, 43, 5, 18, 30])
swaps_made = True
while swaps_made:
swaps_made = False
for i in range(algolist.len() - 1):
j = i + 1
if algolist.compare(i, j):
swaps_made = True
algolist.swap(i, j)
To run this program, simply type python3 -m manim algomanim_examples/bubblesort_default.py DefaultBubbleSortScene -pl
. The animation will automatically play once it is rendered.
DefaultBubbleSortScene.mp4
Please read Customizations.md to find out more about how to customize the animations generated by us and DataStructures.md to find out more about how to extend the library to the Data Structures of your choice and the operations on data structures currently supported.
All Python code should adhere to PEP8. Pylint is used to enforce this, so it would probably be a good idea to select the linter in your editor if it allows you to.
If there are any linting rules that you want to exclude (for good reason), disable it in .pylintrc
.
In order to pre-empt pipeline failure, please run pytest -v --cov=algomanim
and pylint *
locally before pushing.