GithubHelp home page GithubHelp logo

mbrukman / 3b1b-manim Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 3b1b/manim

0.0 1.0 0.0 9.11 MB

Animation engine for explanatory math videos

License: Other

Dockerfile 0.01% Python 99.98% TeX 0.01%

3b1b-manim's Introduction

Manim - Mathematical Animation Engine

Documentation Status MIT License

Manim is an animation engine for explanatory math videos. It's used to create precise animations programmatically, as seen in the videos at 3Blue1Brown.

Installation

Manim runs on python 3.7. You can install the python requirements with python3 -m pip install -r requirements.txt. System requirements are cairo, latex, ffmpeg, and sox.

Directly

git clone https://github.com/3b1b/manim.git
cd manim
python3 -m pip install -r requirements.txt
python3 -m manim example_scenes.py SquareToCircle -pl

Directly (Windows)

  1. Install FFmpeg.

  2. Install Cairo. Download the wheel from https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycairo. For most users, pycairo‑1.18.0‑cp37‑cp37m‑win32.whl will do fine.

    pip3 install C:\path\to\wheel\pycairo‑1.18.0‑cp37‑cp37m‑win32.whl
  3. Install a LaTeX distribution. MiKTeX is recommended.

  4. Install SoX.

  5. Install the remaining Python packages. Make sure that pycairo==1.17.1 is changed to pycairo==1.18.0 in requirements.txt.

    git clone https://github.com/3b1b/manim.git
    cd manim
    pip3 install -r requirements.txt
    python3 manim.py example_scenes.py SquareToCircle -pl

Using virtualenv and virtualenvwrapper

After installing virtualenv and virtualenvwrapper

git clone https://github.com/3b1b/manim.git
mkvirtualenv -a manim -r requirements.txt manim
python3 -m manim example_scenes.py SquareToCircle -pl

Using Docker

Since it's a bit tricky to get all the dependencies set up just right, there is a Dockerfile and Compose file provided in this repo as well as a premade image on Docker Hub. The Dockerfile contains instructions on how to build a manim image, while the Compose file contains instructions on how to run the image.

The image does not contain a copy of the repo. This is intentional, as it allows you to either bind mount a repo that you've cloned locally or clone any fork/branch you want. In order to do this with the Compose file, you must set the MANIM_PATH environment variable to the absolute path to the manim repo.

  1. Install Docker
  2. Install Docker Compose
  3. Render an animation
MANIM_PATH=/absolute/path/to/manim/repo docker-compose run manim example_scenes.py SquareToCircle -l

The first time you execute the above command, Docker will pull the image from Docker Hub and cache it. Any subsequent runs until the image is evicted will use the cached image. Note that the image doesn't have any development tools installed and can't preview animations. Its purpose is building and testing only.

Using manim

Try running the following:

python3 -m manim example_scenes.py SquareToCircle -pl

The -p is for previewing, meaning the video file will automatically open when it is done rendering. Use -l for a faster rendering at a lower quality. Use -s to skip to the end and just show the final frame. Use -n (number) to skip ahead to the n'th animation of a scene. Use -f to show the file in finder (for osx)

Set MEDIA_DIR environment variable to determine where image and animation files will be written.

Look through the old_projects folder to see the code for previous 3b1b videos. Note, however, that developments are often made to the library without considering backwards compatibility on those old_projects. To run them with a guarantee that they will work, you will have to go back to the commit which complete that project.

While developing a scene, the -sp flags are helpful to just see what things look like at the end without having to generate the full animation. It can also be helpful to use the -n flag to skip over some number of animations.

Documentation

Documentation is in progress at manim.readthedocs.io.

Walkthrough

Todd Zimmerman put together a tutorial on getting started with manim, which has been updated to run on python 3.7.

Live Streaming

To live stream your animations, simply run manim with the --livestream option.

> python -m manim --livestream
Writing to media/videos/scene/scene/1080p30/LiveStreamTemp.mp4

Manim is now running in streaming mode. Stream animations by passing
them to manim.play(), e.g.
>>> c = Circle()
>>> manim.play(ShowCreation(c))

>>>

It is also possible to stream directly to Twitch. To do that simply pass --livestream and --to-twitch to manim and specify the stream key with --with-key. Then when you follow the above example the stream will directly start on your Twitch channel (with no audio support).

Contributing

Is always welcome. In particular, there is a dire need for tests and documentation.

License

All files in the directories active_projects and old_projects, which by and large generate the visuals for 3b1b videos, are copyright 3Blue1Brown.

The general purpose animation code found in the remainder of the repository, on the other hand, is under the MIT license.

3b1b-manim's People

Contributors

3b1b avatar bhbr avatar brockelmore avatar cclauss avatar charliepark avatar danwaxman avatar eulertour avatar frozar avatar fwcd avatar ggarza avatar govindkag avatar hanwenzhu avatar hashar avatar jeanimal avatar jsunshoshana avatar lkevinzc avatar mertyildiran avatar mirefek avatar npetrangelo avatar rajdakin avatar scottopell avatar shahar603 avatar solara570 avatar sridhar3b1b avatar sswatson avatar styxtwo avatar vavanade avatar vivek3141 avatar xfbs avatar yoshiask avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.