Animation engine for explanatory math videos
Find a file
2018-01-20 11:33:09 -08:00
active_projects Finished DrawFrequencyPlot of Fourier 2018-01-19 18:35:58 -08:00
animation Editing ApplyMethod so that if the last arg is a dict, it's treated as kwargs for the method 2018-01-20 11:00:23 -08:00
eop Finally changed to 2018-01-15 19:15:05 -08:00
files Added various svg files to files directory (not usually where they live) so anyone outisde 3b1b wanting to download the code and try it out won't see it break on all pi creature scenes 2018-01-12 13:39:51 -08:00
mobject Updated the scale_to_fit Mobject methods based on new about_point and about_edge convention 2018-01-20 11:33:09 -08:00
old_projects Moved nn/ to old_projects 2018-01-16 13:15:14 -08:00
scene When calling Scene.play on a method followed by its args, if you end the list with a dict, it will interpret it as the kwargs of the method. 2018-01-20 11:19:12 -08:00
topics Corrected get_arc_center() 2018-01-19 17:30:39 -08:00
.gitignore working on basel 2018-01-17 15:18:02 -08:00
__init__.py Beginning Hilbert project 2015-11-23 10:34:42 -08:00
camera.py Most of the restructuring for how scenes hold mobjects is done, just need to handle the trickiness of Scene.remove 2018-01-17 21:32:50 -08:00
constants.py Most of the restructuring for how scenes hold mobjects is done, just need to handle the trickiness of Scene.remove 2018-01-17 21:32:50 -08:00
Dockerfile adds support for docker 2016-09-05 15:05:37 -04:00
example_scenes.py Slight change to example_scene.py 2018-01-16 22:39:43 -08:00
extract_scene.py Update extract_scene.py args to better support previewing, showing in finder, opening output files, etc. 2018-01-19 17:31:31 -08:00
helpers.py Further fixes to Succession animations 2018-01-19 16:52:31 -08:00
README.md Added sox requirement 2018-01-15 18:49:28 -08:00
requirements.txt Make pip to install aggdraw from github 2017-05-04 15:07:30 +02:00
stage_scenes.py Changed the defaults for where animations are written, and where images for ImageMobject and SVGMobject are sought after 2018-01-12 13:38:25 -08:00
template.tex Added support for Chinese and Japanese characters 2017-09-28 14:26:40 +08:00
text_template.tex Up to SecondLayerIsLittleEdgeLayer in nn 2017-09-28 10:38:55 -07:00

Manim

Animation engine for explanatory math videos.

For those who want to play around with this tool, I should be upfront that I've mostly had my own use cases (i.e. 3b1b videos) in mind while building it, and it might not be the most friendly thing to get up and running. In particular, I have not done a great job tracking requirements, and documentation, to put it euphamistically, almost exclusively takes the form of naming conventions.

For 9/10 math animation needs, you'd probably be better off using a more well-maintained tool, like matplotlib, mathematica or even going a non-programatic route with something like After Effects. I also happen to think the program "Grapher" built into osx is really great, and surprisingly versatile for many needs. My own reasons for building this tool and using it for videos are twofold, and I'm not sure how well they apply to other people's use cases.

  1. If I wish to work with some new type of mathematical thing (e.g. a fractal), or to experiment with a different type of animation, it's easier to work it into the underlying system and manipulate it the same way as more standard objects/animation. Admittedly, though, part of the reason I find this easier is because I'm more familiar with the underlying system here than I am with others. This keeps me from shying away from certain video topics that I would otherwise have no idea how to animate.

  2. Having my own tool has been a forcing function for having a style which is more original than what I may have otherwise produced. The cost of this was slower video production when the tool was in its early days, and during points when I do some kind of rehaul, but I think the artistic benefit is a real one. If you wish to use this tool and adopt the same style, by all means feel free. In fact, I encourage it. But the tricky part about anything which confers the benefit of originality is that this benefit cannot be easily shared.

Install requirements

Manim dependencies rely on system libraries you will need to install on your operating system:

  • ffmpeg
  • latex
  • sox

Then you can install the python dependencies:

pip install -r requirements.txt

Note: pip will install the python module aggdraw from https://github.com/scottopell/aggdraw-64bits/ and it might requires additional dependencies.

This doesn't install freetype, but I don't think it's required for this project

How to Use

Try running the following:

python extract_scene.py -p example_scenes.py SquareToCircle

-p gives a preview of an animation, -w will write it to a file, and -s will show/save the final image in the animation.

You will probably want to change the ANIMATIONS_DIR constant to be whatever direction you want video files to output to.

Look through the old_projects folder to see the code for previous 3b1b videos.

While developing a scene, the -s flag is helpful to just see what things look like at the end without having to generate the full animation. It can also be helpful to put self.force_skipping() at the top of the construct method, and self.revert_to_original_skipping_status() before the portion of the scene that you want to test, and run with the -p flag to just see a preview of one part of the scene.

Scene with PiCreatures are somewhat 3b1b specific, so the specific designs for various expressions are not part of the public repo. You should still be able to run them, but they will fall back on using the "plain" expression for the creature.

Docker Method

Since its a bit tricky to get all the dependencies set up just right, there is a Dockerfile provided.

  1. Install Docker
  2. Build docker image. docker build -t manim .
  3. Run it! docker run --rm -v "$PWD/files":/app/files manim example_scenes.py WarpSquare