Skip to content

Commit

Permalink
Merge pull request #11 from 3b1b/master
Browse files Browse the repository at this point in the history
Updating
  • Loading branch information
vivek3141 committed Jun 11, 2019
2 parents 5d55bbd + 1322152 commit 0c7f1ea
Show file tree
Hide file tree
Showing 231 changed files with 2,269 additions and 337 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ ben_cairo_test.py
media
manim.sublime-project
manim.sublime-workspace
.eggs/
build/
dist/
manim.egg-info/

primes.py
/media_dir.txt
33 changes: 21 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
group: travis_latest
language: python
sudo: required # required for Python 3.7 (travis-ci/travis-ci#9069)
dist: xenial # required for Python 3.7 (travis-ci/travis-ci#9069)
python: "3.7"
cache: pip
matrix:
include:
- python: 3.7
dist: xenial # required for Python 3.7 (travis-ci/travis-ci#9069)
sudo: required # required for Python 3.7 (travis-ci/travis-ci#9069)

addons:
apt:
packages:
- python3-sphinx
install:
- pip install --upgrade pip
- pip install -r requirements.txt
- pip install flake8
before_script:
# stop the build if there are Python syntax errors or undefined names
- flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics
- flake8 manimlib/ --count --select=E9,F63,F72,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- flake8 manimlib/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
script:
- true # add other tests here
notifications:
on_success: change
on_failure: change # `always` will be the setting once code changes slow down
- python setup.py test
- python setup.py bdist_wheel
after_success:
- test $TRAVIS_BRANCH = "master" && test $TRAVIS_PULL_REQUEST = "false" && travis/build_docs.sh
deploy:
provider: pypi
user: eulertour
on:
tags: true
password:
secure: j5M2hiJo9kDWJhl0/iSuIQmfd2G2O1Qoc455AkUPMCheAcALnX9xJgFsYBmqfgOXTCtUCQf52XGdOIG4o4s5TY340NZ9eLKI9cWae+sTeSrDCkdwChUilm3D0jQf1FWPUf9ywScwGi20m0sRtzxEJyTuX+JMFd7PIa8bFoDXWPtEjoFOOJrfBusMsANzrI+j+vIMdJ48lc1J8UsQdZapwusTrYU9s12JLhKBPLavmaDKf0HDAJdEhFQ9SaINdkiW/QY8qbfJ/MVu5jHai168zXjD/IaswxoKqCO1G+fWlOq3KwVhG7gI7rwhnnuF+wcA7yLAaMdo0CjO2V7z15S6cG721V2Il2IIh1jq0F8irSH1ZOLOkv/fFk9hkSUQyEU0i8k4m1wE9L47a6GP/66+b+gI91PGfxBOqq4gE/1BdZJqceh0qc13KpcehtYrQwR05bSw0Ye5OoTkqAnCeON0B0Ur4ejfHd3TzkjgB06fw76cZtjAK8f/YjB3KyNCvysOixgzE4tRxlY92yX/tAKZ3iX3yD0MjsinSfwo52N5sIEaCS/FmPRMhJOQBa6ftkfbcUNQBTG9G3b134XXF/LbC4vBloCaTm5VSXagta+oY3SFKQxPAZXx7X+wcFGjqxDjZXG1e66QnA2JJH4aBDsRfSXmUtD8MblwFYdcCJWz+Ck=
15 changes: 10 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ RUN apt-get update \
&& apt-get install -qqy --no-install-recommends \
apt-utils \
ffmpeg \
texlive-latex-base \
texlive-full \
texlive-fonts-extra \
sox \
libcairo2-dev \
texlive \
texlive-fonts-extra \
texlive-latex-extra \
texlive-latex-recommended \
texlive-science \
tipa \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt requirements.txt
RUN python -m pip install -r requirements.txt && rm requirements.txt
COPY . /manim
RUN cd /manim \
&& python setup.py sdist \
&& python -m pip install dist/manimlib*
ENTRYPOINT ["/bin/bash"]
72 changes: 53 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,40 @@
# Manim - Mathematical Animation Engine
[![Documentation Status](https://readthedocs.org/projects/manim/badge/?version=latest)](https://manim.readthedocs.io/en/latest/?badge=latest)
<img src="logo/cropped.png"/>

[![Build Status](https://travis-ci.org/3b1b/manim.svg?branch=master)](https://travis-ci.org/3b1b/manim)
[![Documentation](https://img.shields.io/badge/docs-EulerTour-blue.svg)](https://www.eulertour.com/learn/manim/)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://choosealicense.com/licenses/mit/)
[![Manim Subreddit](https://img.shields.io/reddit/subreddit-subscribers/manim.svg?color=ff4301&label=reddit)](https://www.reddit.com/r/manim/)
[![Manim Discord](https://img.shields.io/discord/581738731934056449.svg?label=discord)](https://discord.gg/mMRrZQW)

Manim is an animation engine for explanatory math videos. It's used to create precise animations programmatically, as seen in the videos at [3Blue1Brown](https://www.3blue1brown.com/).

## 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](https://www.cairographics.org), [latex](https://www.latex-project.org),
[ffmpeg](https://www.ffmpeg.org), and [sox](http://sox.sourceforge.net).
Manim runs on python 3.7. You can install it from PyPI via pip

```sh
pip3 install manimlib
```

System requirements are [cairo](https://www.cairographics.org), [ffmpeg](https://www.ffmpeg.org), [sox](http://sox.sourceforge.net), [latex](https://www.latex-project.org) (optional, if you want to use LaTeX).

You can now use it via the `manim` command. For example:

```sh
manim my_project.py MyScene
```

For more options, take a look at the “Using manim“ sections further below.

### Directly

If you want to hack on manimlib itself, clone this repository and in that directory execute:

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

# Try it out
python3 ./manim.py example_scenes.py SquareToCircle -pl
```

### Directly (Windows)
Expand All @@ -36,6 +55,14 @@ python3 -m manim example_scenes.py SquareToCircle -pl
python3 manim.py example_scenes.py SquareToCircle -pl
```


## Anaconda Install

* Install sox and latex as above.
* Create a conda environment using `conda env create -f environment.yml`
* **WINDOWS ONLY** Install `pyreadline` via `pip install pyreadline`.


### Using `virtualenv` and `virtualenvwrapper`
After installing `virtualenv` and `virtualenvwrapper`
```sh
Expand All @@ -47,13 +74,18 @@ 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](https://hub.docker.com/r/eulertour/manim/tags/). 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.
In order to do this with the Compose file, you must set the `INPUT_PATH`
environment variable to the directory containing your source code and the
`OUTPUT_DIRECTORY` environment variable to the directory where you want media
to be written.

1. [Install Docker](https://www.docker.com/products/overview)
1. [Install Docker](https://docs.docker.com)
2. [Install Docker Compose](https://docs.docker.com/compose/install/)
3. Render an animation
```sh
MANIM_PATH=/absolute/path/to/manim/repo docker-compose run manim example_scenes.py SquareToCircle -l
INPUT_PATH=/path/to/dir/containing/source/code \
OUTPUT_PATH=/path/to/dir/for/media \
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.
Expand All @@ -63,15 +95,17 @@ Try running the following:
```sh
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)
The `-p` flag in the command above is for previewing, meaning the video file will automatically open when it is done rendering. The `-l` flag is for a faster rendering at a lower quality.

Some other useful flags include:

* `-s` to skip to the end and just show the final frame.
* `-n <number>` to skip ahead to the `n`'th animation of a scene.
* `-f` to show the file in finder (for OSX).

Set MEDIA_DIR environment variable to determine where image and animation files will be written.
Set `MEDIA_DIR` environment variable to specify where the 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.
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 with those old projects. To run an old project with a guarantee that it will work, you will have to go back to the commit which completed 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.

Expand Down
2 changes: 1 addition & 1 deletion active_projects/aliquot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *


def get_factors(n):
Expand Down
2 changes: 1 addition & 1 deletion active_projects/eola2/cramer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *

X_COLOR = GREEN
Y_COLOR = RED
Expand Down
2 changes: 1 addition & 1 deletion active_projects/eola2/determinant_puzzle.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *


class WorkOutNumerically(Scene):
Expand Down
2 changes: 1 addition & 1 deletion active_projects/eola2/gauss.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from fractions import Fraction

from big_ol_pile_of_manim_imports import *
from manimlib.imports import *
from functools import reduce


Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/bayes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *

#revert_to_original_skipping_status

Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/bayes_footnote.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *

from active_projects.eop.bayes import IntroducePokerHand

Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/birthday.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *

class Birthday(Scene):

Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter0.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *

class Introduction(TeacherStudentsScene):

Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter0/intro.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *

class Introduction(TeacherStudentsScene):

Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter1/all_sequences.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

from big_ol_pile_of_manim_imports import *
from manimlib.imports import *
from active_projects.eop.reusable_imports import *

class ShuffleThroughAllSequences(Scene):
Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter1/area_model_bayes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *


class IllustrateAreaModelBayes(Scene):
Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter1/area_model_erf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

from big_ol_pile_of_manim_imports import *
from manimlib.imports import *
from old_projects.eoc.chapter8 import *

import scipy.special
Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter1/area_model_expectation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

from big_ol_pile_of_manim_imports import *
from manimlib.imports import *
from active_projects.eop.reusable_imports import *


Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter1/brick_row_scene.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *
from active_projects.eop.reusable_imports import *


Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter1/entire_brick_wall.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

from big_ol_pile_of_manim_imports import *
from manimlib.imports import *
from active_projects.eop.reusable_imports import *
from active_projects.eop.chapter1.brick_row_scene import BrickRowScene

Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter1/intro.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *
from active_projects.eop.reusable_imports import *

class Chapter1OpeningQuote(OpeningQuote):
Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter1/just_randy_flipping_coin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

from big_ol_pile_of_manim_imports import *
from manimlib.imports import *
from active_projects.eop.reusable_imports import *

class JustFlipping(Scene):
Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter1/million_flips.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *
from active_projects.eop.reusable_imports import *


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

from big_ol_pile_of_manim_imports import *
from manimlib.imports import *
from active_projects.eop.reusable_imports import *

class GenericMorphBrickRowIntoHistogram(Scene):
Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter1/prob_dist_visuals.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *
from active_projects.eop.reusable_imports import *


Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter1/quiz_result.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *
from active_projects.eop.reusable_imports import *
from active_projects.eop.independence import *

Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter1/show_proportion.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *


class ProbabilityRect(VMobject):
Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter1/show_uncertainty_darts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *
from active_projects.eop.reusable_imports import *


Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter1/show_uncertainty_dice.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *
from active_projects.eop.reusable_imports import *

class ShowUncertaintyDice(Scene):
Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter1/show_uncertainty_disease.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *
from active_projects.eop.reusable_imports import *


Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter1/stacking_coins.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *
from active_projects.eop.reusable_imports import *


Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter1/think_about_coin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

from big_ol_pile_of_manim_imports import *
from manimlib.imports import *
from active_projects.eop.reusable_imports import *

class RandyThinksAboutCoin(PiCreatureScene):
Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter1/various_intro_visuals.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *
from active_projects.eop.reusable_imports import *
from active_projects.eop.combinations import *
from active_projects.eop.independence import *
Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter1/what_does_probability_mean.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *


class WhatDoesItReallyMean(TeacherStudentsScene):
Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/chapter2/permutation_grid.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *

def print_permutation(index_list):

Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/combinations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *

#revert_to_original_skipping_status

Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/independence.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *

from scene.scene import ProgressDisplay
import scipy
Expand Down
2 changes: 1 addition & 1 deletion active_projects/eop/pascal.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

from big_ol_pile_of_manim_imports import *
from manimlib.imports import *
from once_useful_constructs.combinatorics import *

nb_levels = 5
Expand Down
Loading

0 comments on commit 0c7f1ea

Please sign in to comment.