A community-maintained Python framework for creating mathematical animations.
initial sphinx setup
leotrs94f004d5f6c9
diff --git a/docs/Makefile b/docs/Makefileindex 69fe55ecf..d0c3cbf10 100644--- a/docs/Makefile+++ b/docs/Makefile@@ -1,9 +1,10 @@# Minimal makefile for Sphinx documentation#-# You can set these variables from the command line.-SPHINXOPTS =-SPHINXBUILD = sphinx-build+# You can set these variables from the command line, and also+# from the environment for the first two.+SPHINXOPTS ?=+SPHINXBUILD ?= sphinx-buildSOURCEDIR = sourceBUILDDIR = build@@ -16,4 +17,4 @@ help:# Catch-all target: route all unknown targets to Sphinx using the new# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).%: Makefile- @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)\ No newline at end of file+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)diff --git a/docs/make.bat b/docs/make.batindex 543c6b13b..6247f7e23 100644--- a/docs/make.bat+++ b/docs/make.bat@@ -25,11 +25,11 @@ if errorlevel 9009 (exit /b 1)-%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%+%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%goto end:help-%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%+%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%:endpopddiff --git a/docs/source/about.rst b/docs/source/about.rstdeleted file mode 100644index 2a86dfd9b..000000000--- a/docs/source/about.rst+++ /dev/null@@ -1,11 +0,0 @@-About-=====--Animating technical concepts is traditionally pretty tedious, since it can be-difficult to make the animations precise enough to convey them accurately.-``Manim`` uses Python to generate animations programmatically, which makes it-possible to specify exactly how each one should run.--This project is still very much a work in progress, but I hope that the-information here will make it easier for newcomers to get started using-``Manim``.diff --git a/docs/source/animation.rst b/docs/source/animation.rstdeleted file mode 100644index e38db6333..000000000--- a/docs/source/animation.rst+++ /dev/null@@ -1,210 +0,0 @@-Animation-=========----The simplest of which is ``Scene.add``. The object appears on the first frame-without any animation::-- class NoAnimation(Scene):- def construct(self):- square = Square()- self.add(square))--Animation are used in conjunction with ``scene.Play``--Fade-------.. raw:: html-- <video width="560" height="315" controls>- <source src="_static/AnimationFadeIn.mp4" type="video/mp4">- </video>--.. code-block:: python-- class AnimationFadeIn(Scene):- def construct(self):- square = Square()-- anno = TextMobject("Fade In")- anno.shift(2 * DOWN)- self.add(anno)- self.play(FadeIn(square))--.. raw:: html-- <video width="560" height="315" controls>- <source src="_static/AnimationFadeOut.mp4" type="video/mp4">- </video>--.. code-block:: python-- class AnimationFadeOut(Scene):- def construct(self):- square = Square()-- anno = TextMobject("Fade Out")- anno.shift(2 * DOWN)- self.add(anno)- self.add(square)- self.play(FadeOut(square))----.. raw:: html-- <video width="560" height="315" controls>- <source src="_static/AnimationFadeInFrom.mp4" type="video/mp4">- </video>--.. code-block:: python-- class AnimationFadeInFrom(Scene):- def construct(self):- square = Square()- for label, edge in zip(- ["LEFT", "RIGHT", "UP", "DOWN"], [LEFT, RIGHT, UP, DOWN]- ):- anno = TextMobject(f"Fade In from {label}")- anno.shift(2 * DOWN)- self.add(anno)-- self.play(FadeInFrom(square, edge))- self.remove(anno, square)----.. raw:: html-- <video width="560" height="315" controls>- <source src="_static/AnimationFadeOutAndShift.mp4" type="video/mp4">- </video>--.. code-block:: python-- class AnimationFadeOutAndShift(Scene):- def construct(self):- square = Square()- for label, edge in zip(- ["LEFT", "RIGHT", "UP", "DOWN"], [LEFT, RIGHT, UP, DOWN]- ):- anno = TextMobject(f"Fade Out and shift {label}")- anno.shift(2 * DOWN)- self.add(anno)-- self.play(FadeOutAndShift(square, edge))- self.remove(anno, square)----.. raw:: html-- <video width="560" height="315" controls>- <source src="_static/AnimationFadeInFromLarge.mp4" type="video/mp4">- </video>--.. code-block:: python-- class AnimationFadeInFromLarge(Scene):- def construct(self):- square = Square()-- for factor in [0.1, 0.5, 0.8, 1, 2, 5]:- anno = TextMobject(f"Fade In from large scale\_factor={factor}")- anno.shift(2 * DOWN)- self.add(anno)-- self.play(FadeInFromLarge(square, scale_factor=factor))- self.remove(anno, square)--.. raw:: html-- <video width="560" height="315" controls>- <source src="_static/AnimationFadeInFromPoint.mp4" type="video/mp4">- </video>--.. code-block:: python-- class AnimationFadeInFromPoint(Scene):- def construct(self):- square = Square()- for i in range(-6, 7, 2):- anno = TextMobject(f"Fade In from point {i}")- anno.shift(2 * DOWN)- self.add(anno)- self.play(FadeInFromPoint(square, point=i))- self.remove(anno, square)----Grow-------.. raw:: html-- <video width="560" height="315" controls>- <source src="_static/AnimationGrowFromEdge.mp4" type="video/mp4">- </video>--.. code-block:: python-- class AnimationGrowFromEdge(Scene):- def construct(self):-- for label, edge in zip(- ["LEFT", "RIGHT", "UP", "DOWN"], [LEFT, RIGHT, UP, DOWN]- ):- anno = TextMobject(f"Grow from {label} edge")- anno.shift(2 * DOWN)- self.add(anno)- square = Square()- self.play(GrowFromEdge(square, edge))- self.remove(anno, square)----.. raw:: html-- <video width="560" height="315" controls>- <source src="_static/AnimationGrowFromCenter.mp4" type="video/mp4">- </video>--.. code-block:: python-- class AnimationGrowFromCenter(Scene):- def construct(self):- square = Square()-- anno = TextMobject("Grow from center")- anno.shift(2 * DOWN)- self.add(anno)-- self.play(GrowFromCenter(square))-----Diagonal Directions----------------------You can combine cardinal directions to form diagonal animations--.. raw:: html-- <video width="560" height="315" controls>- <source src="_static/AnimationFadeInFromDiagonal.mp4" type="video/mp4">- </video>--.. code-block:: python-- class AnimationFadeInFromDiagonal(Scene):- def construct(self):- square = Square()- for diag in [UP + LEFT, UP + RIGHT, DOWN + LEFT, DOWN + RIGHT]:- self.play(FadeInFrom(square, diag))--.. note::- You can also use the abbreviated forms like ``UL, UR, DL, DR``.- See :ref:`ref-directions`.diff --git a/docs/source/assets/AnimationFadeIn.mp4 b/docs/source/assets/AnimationFadeIn.mp4deleted file mode 100644index 783a6fa89..000000000Binary files a/docs/source/assets/AnimationFadeIn.mp4 and /dev/null differdiff --git a/docs/source/assets/AnimationFadeInFrom.mp4 b/docs/source/assets/AnimationFadeInFrom.mp4deleted file mode 100644index 90ead0726..000000000Binary files a/docs/source/assets/AnimationFadeInFrom.mp4 and /dev/null differdiff --git a/docs/source/assets/AnimationFadeInFromDiagonal.mp4 b/docs/source/assets/AnimationFadeInFromDiagonal.mp4deleted file mode 100644index 25b0145c4..000000000Binary files a/docs/source/assets/AnimationFadeInFromDiagonal.mp4 and /dev/null differdiff --git a/docs/source/assets/AnimationFadeInFromLarge.mp4 b/docs/source/assets/AnimationFadeInFromLarge.mp4deleted file mode 100644index 589789ea4..000000000Binary files a/docs/source/assets/AnimationFadeInFromLarge.mp4 and /dev/null differdiff --git a/docs/source/assets/AnimationFadeInFromPoint.mp4 b/docs/source/assets/AnimationFadeInFromPoint.mp4deleted file mode 100644index cdfdc84cc..000000000Binary files a/docs/source/assets/AnimationFadeInFromPoint.mp4 and /dev/null differdiff --git a/docs/source/assets/AnimationFadeInFromSmall.mp4 b/docs/source/assets/AnimationFadeInFromSmall.mp4deleted file mode 100644index 9e8f80974..000000000Binary files a/docs/source/assets/AnimationFadeInFromSmall.mp4 and /dev/null differdiff --git a/docs/source/assets/AnimationFadeOut.mp4 b/docs/source/assets/AnimationFadeOut.mp4deleted file mode 100644index 5938ab7e7..000000000Binary files a/docs/source/assets/AnimationFadeOut.mp4 and /dev/null differdiff --git a/docs/source/assets/AnimationFadeOutAndShift.mp4 b/docs/source/assets/AnimationFadeOutAndShift.mp4deleted file mode 100644index 834145cb4..000000000Binary files a/docs/source/assets/AnimationFadeOutAndShift.mp4 and /dev/null differdiff --git a/docs/source/assets/AnimationGrowFromCenter.mp4 b/docs/source/assets/AnimationGrowFromCenter.mp4deleted file mode 100644index 634863bb7..000000000Binary files a/docs/source/assets/AnimationGrowFromCenter.mp4 and /dev/null differdiff --git a/docs/source/assets/AnimationGrowFromEdge.mp4 b/docs/source/assets/AnimationGrowFromEdge.mp4deleted file mode 100644index 7da5f313d..000000000Binary files a/docs/source/assets/AnimationGrowFromEdge.mp4 and /dev/null differdiff --git a/docs/source/assets/SquareToCircle.mp4 b/docs/source/assets/SquareToCircle.mp4deleted file mode 100644index 5b1e9b902..000000000Binary files a/docs/source/assets/SquareToCircle.mp4 and /dev/null differdiff --git a/docs/source/assets/coordinate/CoorAlias.mp4 b/docs/source/assets/coordinate/CoorAlias.mp4deleted file mode 100644index 3df8e0fdc..000000000Binary files a/docs/source/assets/coordinate/CoorAlias.mp4 and /dev/null differdiff --git a/docs/source/assets/coordinate/CoorArithmetic.mp4 b/docs/source/assets/coordinate/CoorArithmetic.mp4deleted file mode 100644index cea6c0877..000000000Binary files a/docs/source/assets/coordinate/CoorArithmetic.mp4 and /dev/null differdiff --git a/docs/source/assets/coordinate/CoorPolygon.png b/docs/source/assets/coordinate/CoorPolygon.pngdeleted file mode 100644index 5c9793fae..000000000Binary files a/docs/source/assets/coordinate/CoorPolygon.png and /dev/null differdiff --git a/docs/source/assets/coordinate/DotMap.mp4 b/docs/source/assets/coordinate/DotMap.mp4deleted file mode 100644index 6e7d0c3d0..000000000Binary files a/docs/source/assets/coordinate/DotMap.mp4 and /dev/null differdiff --git a/docs/source/conf.py b/docs/source/conf.pyindex ec8e26948..ace00af18 100644--- a/docs/source/conf.py+++ b/docs/source/conf.py@@ -2,7 +2,7 @@## This file only contains a selection of the most common options. For a full# list see the documentation:-# http://www.sphinx-doc.org/en/master/config+# https://www.sphinx-doc.org/en/master/usage/configuration.html# -- Path setup --------------------------------------------------------------@@ -17,21 +17,23 @@# -- Project information ------------------------------------------------------project = "Manim"-copyright = "2019, EulerTour"-author = "EulerTour"+project = 'manim'+copyright = '2020, The Manim Community Dev Team'+author = 'The Manim Community Dev Team'# -- General configuration ----------------------------------------------------master_doc = "index"# Add any Sphinx extension module names here, as strings. They can be# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom# ones.-extensions = []+extensions = [+ 'sphinx.ext.autodoc',+ 'sphinx_rtd_theme',+]# Add any paths that contain templates here, relative to this directory.-templates_path = ["_templates"]+templates_path = ['_templates']# List of patterns, relative to source directory, that match files and# directories to ignore when looking for source files.@@ -44,9 +46,9 @@ exclude_patterns = []# The theme to use for HTML and HTML Help pages. See the documentation for# a list of builtin themes.#-html_theme = "sphinx_rtd_theme"+html_theme = 'sphinx_rtd_theme'# Add any paths that contain custom static files (such as style sheets) here,# relative to this directory. They are copied after the builtin static files,# so a file named "default.css" will overwrite the builtin "default.css".-html_static_path = ["assets"]+html_static_path = ['_static']diff --git a/docs/source/config.rst b/docs/source/config.rstnew file mode 100644index 000000000..0e6cb75a6--- /dev/null+++ b/docs/source/config.rst@@ -0,0 +1,4 @@+.. automodule:: manim.config+ :members:+ :undoc-members:+ :show-inheritance:diff --git a/docs/source/configuration.rst b/docs/source/configuration.rstnew file mode 100644index 000000000..1514c4260--- /dev/null+++ b/docs/source/configuration.rst@@ -0,0 +1,4 @@+Configuration+=============++This is a stub file.diff --git a/docs/source/constants.rst b/docs/source/constants.rstindex 7bc34d147..b0fb2c6e8 100644--- a/docs/source/constants.rst+++ b/docs/source/constants.rst@@ -1,94 +1,7 @@-Manim Constants-===============+Constants+=========-The ``constants.py`` under ``manimlib/`` contains variables that are used-during setup and running manim. Some variables are not documented here as they are-only used internally by manim.--Directories-------------- MEDIA_DIR- The directory where ``VIDEO_DIR`` and ``TEX_DIR`` will be created,- if they aren't specified via flags.- VIDEO_DIR- Used to store the scenes rendered by Manim. When a scene is- finished rendering, it will be stored under- ``VIDEO_DIR/module_name/scene_name/quality/scene_name.mp4``.- Created under ``MEDIA_DIR`` by default.- TEX_DIR- Files written by Latex are stored here. It also acts as a cache- so that the files aren't rewritten each time Latex is needed.--Those directories are created if they don't exist.--Tex----- TEX_USE_CTEX- A boolean value. Change it to True if you need to use Chinese typesetting.- TEX_TEXT_TO_REPLACE- Placeholder text used by manim when generating tex files- TEMPLATE_TEX_FILE- By default ``manimlib/tex_template.tex`` is used. If ``TEX_USE_CTEX``- is set to True then ``manimlib/ctex_template.tex`` is used.--Numerical Constants---------------------- PI- alias to ``numpy.pi``- TAU- PI * 2-- DEGREES- TAU / 360--Camera Configuration-----------------------Render setting presets-- PRODUCTION_QUALITY_CAMERA_CONFIG- 2560x1440 @ 60fps # This is the default when rendering a scene- HIGH_QUALITY_CAMERA_CONFIG- 1920x1080 @ 60fps. # Used when the ``-h`` or ``--high_quality`` flag- is passed.- MEDIUM_QUALITY_CAMERA_CONFIG- 1280x720 @ 30fps. # Used when the ``-m`` or ``--medium_quality``- flag is passed.- LOW_QUALITY_CAMERA_CONFIG- 854x480 @ 15fps. # Used when the ``-l`` or ``--low_quality`` flag is- passed.--.. _ref-directions:--Coordinates--------------Used for 2d/3d animations and placements::-- ORIGIN- UP- DOWN- RIGHT- LEFT- IN # 3d camera only, away from camera- OUT # 3d camera only, close to camera-- UL = UP + LEFT # diagonal abbreviations. You can use either one- UR = UP + RIGHT- DL = DOWN + LEFT- DR = DOWN + RIGHT-- TOP- BOTTOM- LEFT_SIDE- RIGHT_SIDE``--Colors--------- COLOR_MAP- A predefined color maps- PALETTE- A list of color hex strings, derived from COLOR_MAP+.. automodule:: manim.constants+ :members:+ :undoc-members:+ :show-inheritance:diff --git a/docs/source/coordinate.rst b/docs/source/coordinate.rstdeleted file mode 100644index 27edb2566..000000000--- a/docs/source/coordinate.rst+++ /dev/null@@ -1,178 +0,0 @@-Coordinate-==========--By default, the scene in manim is made up by 8 x 14 grid. The grid is addressed using a numpy-array in the form of [x, y, z]. For 2D animations only the x and y axes are used.--.. code-block:: python-- class DotMap(Scene):- def construct(self):- dots = dict()- annos = dict()- var_index = 0- for x in range(-7, 8):- for y in range(-4, 5):- annos[f"{x}{y}"] = TexMobject(f"({x}, {y})")- dots[f"{var_index}"] = Dot(np.array([x, y, 0]))- var_index = var_index + 1- for anno, dot in zip(annos.values(), dots.values()):- self.add(anno)- self.add(dot)- self.wait(0.2)- self.remove(anno)--.. raw:: html-- <video width="700" height="394" controls>- <source src="_static/coordinate/DotMap.mp4" type="video/mp4">- </video>--.. note::- You can place objects outside this boundary, but it won't show up in the render.--Using Coordinates--------------------Coordinates are used for creating geometries (`VMobject` in manim) and animations.--Here coordinates are used to create this Polygon--.. code-block:: python-- class CoorPolygon(Scene):- def construct(self):- for x in range(-7, 8):- for y in range(-4, 5):- self.add(Dot(np.array([x, y, 0]), color=DARK_GREY))- polygon = Polygon(- np.array([3, 2, 0]),- np.array([1, -1, 0]),- np.array([-5, -4, 0]),- np.array([-4, 4, 0]))- self.add(polygon)---.. Image:: assets/coordinate/CoorPolygon.png- :width: 700px--Coordinate Aliasing----------------------From some animations typing a ``np.array`` everytime you need a coordinate can be tedious.-Manim provides aliases to the most common coordinates::-- UP == np.array([0, 1, 0])- DOWN == np.array([0, -1, 0])- LEFT == np.array([-1, 0, 0])- RIGHT == np.array([1, 0, 0])- UL == np.array([-1, 1, 0])- DL == np.array([-1, -1, 0])- UR == np.array([1, 1, 0])- DR == np.array([1, -1, 0])--Here coordinates are used for animations--.. code-block:: python-- class CoorAlias(Scene):- def construct(self):- for x in range(-7, 8):- for y in range(-4, 5):- self.add(Dot(np.array([x, y, 0]), color=DARK_GREY))-- aliases = {- "UP": UP,- "np.array([0,1,0])": np.array([0, 1, 0]),- "DOWN": DOWN,- "np.array([0,-1,0])": np.array([0, -1, 0]),- "LEFT": LEFT,- "np.array([-1,0,0])": np.array([-1, 0, 0]),- "RIGHT": RIGHT,- "np.array([1,0,0])": np.array([1, 0, 0]),- "UL": UL,- "np.array([-1,1,0])": np.array([-1, 1, 0]),- "DL": DL,- "np.array([-1,-1,0])": np.array([-1, -1, 0]),- "UR": UR,- "np.array([1,1,0])": np.array([1, 1, 0]),- "DR": DR,- "np.array([1,-1,0])": np.array([1, -1, 0])}- circle = Circle(color=RED, radius=0.5)- self.add(circle)- self.wait(0.5)-- for text, aliase in aliases.items():- anno = TexMobject(f"\\texttt{{{text}}}")- self.play(Write(anno, run_time=0.2))- self.play(ApplyMethod(circle.shift, aliase))- self.wait(0.2)- self.play(FadeOut(anno, run_time=0.2))--.. raw:: html-- <video width="700" height="394" controls>- <source src="_static/coordinate/CoorAlias.mp4" type="video/mp4">- </video>--Coordinate Arithmetic------------------------Numpy array allows arithmetic operations::-- >>> numpy.array([2,2,0]) + 4- array([6, 6, 4])-- >>> np.array([1, -3, 0]) + np.array([-4, 2, 0])- array([-3, -1, 0])-- >>> np.array([2, 2, 0]) - np.array([3,6, 0])- array([-1, -4, 0])-- >>> numpy.array([2,2,0]) - 3- array([-1, -1, -3])-- >>> np.array([1, -3, 0]) * 3- array([ 3, -9, 0])-- >>> numpy.array([2,2,0]) / 2- array([1., 1., 0.])-- >>> numpy.array([2,2,0]) / numpy.array([1, 4, 0])- __main__:1: RuntimeWarning: invalid value encountered in true_divide- array([2. , 0.5, nan])--.. code-block:: python-- class CoorArithmetic(Scene):- def construct(self):- for x in range(-7, 8):- for y in range(-4, 5):- self.add(Dot(np.array([x, y, 0]), color=DARK_GREY))-- circle = Circle(color=RED, radius=0.5)- self.add(circle)- self.wait(0.5)-- aliases = {- "LEFT * 3": LEFT * 3,- "UP + RIGHT / 2": UP + RIGHT / 2,- "DOWN + LEFT * 2": DOWN + LEFT * 2,- "RIGHT * 3.75 * DOWN": RIGHT * 3.75 * DOWN,- # certain arithmetic won't work as you expected- # In [4]: RIGHT * 3.75 * DOWN- # Out[4]: array([ 0., -0., 0.])- "RIGHT * 3.75 + DOWN": RIGHT * 3.75 + DOWN}-- for text, aliase in aliases.items():- anno = TexMobject(f"\\texttt{{{text}}}")- self.play(Write(anno, run_time=0.2))- self.play(ApplyMethod(circle.shift, aliase))- self.wait(0.2)- self.play(FadeOut(anno, run_time=0.2))--.. raw:: html-- <video width="700" height="394" controls>- <source src="_static/coordinate/CoorArithmetic.mp4" type="video/mp4">- </video>diff --git a/docs/source/getting_started/animating_mobjects.rst b/docs/source/getting_started/animating_mobjects.rstdeleted file mode 100644index efc0a1098..000000000--- a/docs/source/getting_started/animating_mobjects.rst+++ /dev/null@@ -1,4 +0,0 @@-Animating Mobjects-==================--Learn about animations.diff --git a/docs/source/getting_started/index.rst b/docs/source/getting_started/index.rstdeleted file mode 100644index 11f8e9d0b..000000000--- a/docs/source/getting_started/index.rst+++ /dev/null@@ -1,18 +0,0 @@-Getting Started-===============--Todd Zimmerman put together `a very nice tutorial`_ on getting started with-``manim``, which has been updated to run on python 3.7. Note that you'll want-to change `from big_ol_pile_of_manim_imports import *` to `from-manimlib.imports import *` to work with the current codebase.--.. _a very nice tutorial: https://talkingphysics.wordpress.com/2019/01/08/getting-started-animating-with-manim-and-python-3-7/--.. toctree::- :caption: Contents- :maxdepth: 2-- learning_by_example- mathematical_objects- animating_mobjects- making_a_scenediff --git a/docs/source/getting_started/learning_by_example.rst b/docs/source/getting_started/learning_by_example.rstdeleted file mode 100644index dee86d7cc..000000000--- a/docs/source/getting_started/learning_by_example.rst+++ /dev/null@@ -1,131 +0,0 @@-Learning by Example-===================--SquareToCircle-----------------``example_scenes.py`` contains simple examples that we can use to learn about manim.--Go ahead and try out the ``SquareToCircle`` scene by running it with ``$ manim example_scenes.py SquareToCircle -p``-in manim directory.--.. code-block:: python- :linenos:-- from manimlib.imports import *-- class SquareToCircle(Scene):- def construct(self):- circle = Circle()- square = Square()- square.flip(RIGHT)- square.rotate(-3 * TAU / 8)- circle.set_fill(PINK, opacity=0.5)-- self.play(ShowCreation(square))- self.play(Transform(square, circle))- self.play(FadeOut(square))--.. raw:: html-- <video width="560" height="315" controls>- <source src="../_static/SquareToCircle.mp4" type="video/mp4">- </video>---.. note::-- The flag ``-p`` plays the rendered video with default video player.-- Other frequently used flags are:-- * ``-l`` for rendering video in lower resolution (which renders faster)- * ``-s`` to show the last frame of the video.-- Run ``manim -h`` all the available flags (``python -m manim -h`` if you installed it to a venv)---Let's step through each line of ``SquareToCircle``--.. code-block:: python- :lineno-start: 3-- class SquareToCircle(Scene):--You create videos in manim by writing :class:`~scene.scene.Scene` classes.--Each :class:`~scene.scene.Scene` in manim is self-contained. That means everything-you created under this scene does not exist outside the class.--.. code-block:: python- :lineno-start: 4-- def construct(self):--:meth:`~scene.scene.Scene.construct` specifies what is displayed on the screen-when the :class:`~scene.scene.Scene` is rendered to video.--.. code-block:: python- :lineno-start: 5-- circle = Circle()- square = Square()--``Circle()`` and ``Square()`` create :class:`~mobject.geometry.Circle` and :class:`~mobject.geometry.Square`.--Both of these are instances of :class:`~mobject.mobject.Mobject` subclasses, the base class for objects in manim. Note-that instantiating a :class:`~mobject.mobject.Mobject` does not add it to the-:class:`~scene.scene.Scene`, so you wouldn't see anything if you were to render-the :class:`~scene.scene.Scene` at this point.--.. code-block:: python- :lineno-start: 7-- square.flip(RIGHT)- square.rotate(-3 * TAU / 8)- circle.set_fill(PINK, opacity=0.5)--``flip()`` ``rotate()`` ``set_fill()`` apply various modifications to the mobjects before animating-them. The call to :meth:`~mobject.mobject.Mobject.flip` flips the-:class:`~mobject.geometry.Square` across the RIGHT vector. This is equivalent-to a refection across the x-axis.--The call to :meth:`~mobject.mobject.Mobject.rotate` rotates the-:class:`~mobject.geometry.Square` 3/8ths of a full rotation counterclockwise.--The call to :meth:`~mobject.mobject.Mobject.set_fill` sets-the fill color for the :class:`~mobject.geometry.Circle` to pink, and its opacity to 0.5.--.. code-block:: python- :lineno-start: 11-- self.play(ShowCreation(square))- self.play(Transform(square, circle))- self.play(FadeOut(square))--To generated animation, :class:`~animation.animation.Animation` classes are used.--Each :class:`~animation.animation.Animation` takes one or more :class:`~mobject.mobject.Mobject` instances as arguments, which it animates-when passed to :meth:`~scene.scene.Scene.play`. This is how video is typically-created in manim.--:class:`~mobject.mobject.Mobject` instances are automatically-added to the :class:`~scene.scene.Scene` when they are animated. You can add a-:class:`~mobject.mobject.Mobject` to the :class:`~scene.scene.Scene` manually-by passing it as an argument to :meth:`~scene.scene.Scene.add`.---:class:`~animation.creation.ShowCreation` draws a :class:`~mobject.mobject.Mobject` to the screen.--:class:`~animation.transform.Transform` morphs one :class:`~mobject.mobject.Mobject` into another.--:class:`~animation.creation.FadeOut` fades a :class:`~mobject.mobject.Mobject` out of the :class:`~scene.scene.Scene`.--.. note::-- Only the first argument to :class:`~animation.transform.Transform` is modified,- the second is not added to the :class:`~scene.scene.Scene`. :class:`~animation.tranform.Transform`- only changes the appearance but not the underlying properties.-- After the call to ``transform()`` ``square`` is still a :class:`~mobject.geometry.Square` instance- but with the shape of :class:`~mobject.geometry.Circle`.diff --git a/docs/source/getting_started/making_a_scene.rst b/docs/source/getting_started/making_a_scene.rstdeleted file mode 100644index 619cb571d..000000000--- a/docs/source/getting_started/making_a_scene.rst+++ /dev/null@@ -1,15 +0,0 @@-Making a Scene-==============--A scene is what renders when manim is executed. Each scene contains mobjects, which can then be animated as-previously explained. In code, a scene is a class that extends ``Scene`` and implements the ``construct``-function, like so. Manim will execute this function to render the scene.--.. code-block:: python- :linenos:-- from manimlib.imports import *-- class ExampleScene(Scene):- def construct(self):- # Add and animate mobjects here\ No newline at end of filediff --git a/docs/source/getting_started/mathematical_objects.rst b/docs/source/getting_started/mathematical_objects.rstdeleted file mode 100644index ebe595b6d..000000000--- a/docs/source/getting_started/mathematical_objects.rst+++ /dev/null@@ -1,13 +0,0 @@-Mathematical Objects-====================--Everything that appears on screen in a manim video is a-:class:`~mobject.mobject.Mobject`, or Mathematical Object. A-:class:`~mobject.mobject.Mobject`'s appearance is determined by 3-factors:--* ``m.points``, an Nx3 ``numpy.array`` specifying how to draw ``m``-* ``m``'s style attributes, such as ``m.color``, ``m.stroke_width``, and- ``m.fill_opacity``-* ``m.submobjects``, a list of :class:`~mobject.mobject.Mobject` instances that- are considered part of ``m``diff --git a/docs/source/index.rst b/docs/source/index.rstindex 865bd82c7..576cfffd1 100644--- a/docs/source/index.rst+++ b/docs/source/index.rst@@ -1,30 +1,29 @@-.. Manim documentation master file, created by- sphinx-quickstart on Mon May 27 14:19:19 2019.+.. manim documentation master file, created by+ sphinx-quickstart on Tue Aug 4 13:58:07 2020.You can adapt this file completely to your liking, but it should at leastcontain the root `toctree` directive.-Welcome to Manim's documentation!-=================================+Manim Community Overview+========================-These docs are generated from the master branch of the-`Manim repo <https://github.com/3b1b/manim>`_. You can contribute by submitting-a pull request there.+Animating technical concepts is traditionally pretty tedious, since it can be+difficult to make the animations precise enough to convey them accurately.+``Manim`` uses Python to generate animations programmatically, which makes it+possible to specify exactly how each one should run.-.. toctree::- :maxdepth: 2- :caption: Contents+This project is still very much a work in progress, but I hope that the+information here will make it easier for newcomers to get started using+``Manim``.- about- installation/index- getting_started/index- coordinate- animation- constants+.. toctree::+ :maxdepth: 2+ :caption: Documentation-Indices and tables-==================+ quickstart+ tutorial+ configuration+ reference* :ref:`genindex`* :ref:`modindex`-* :ref:`search`diff --git a/docs/source/installation/index.rst b/docs/source/installation/index.rstdeleted file mode 100644index 664d154d8..000000000--- a/docs/source/installation/index.rst+++ /dev/null@@ -1,12 +0,0 @@-Installation-============--Instructions on installing Manim--.. toctree::- :maxdepth: 2- :caption: Contents-- linux- mac- windowsdiff --git a/docs/source/installation/linux.rst b/docs/source/installation/linux.rstdeleted file mode 100644index ff11bc3cd..000000000--- a/docs/source/installation/linux.rst+++ /dev/null@@ -1,64 +0,0 @@-Linux-=====--Ubuntu---------Install system libraries::-- # apt install sox ffmpeg libcairo2 libcairo2-dev--Install Latex distribution::-- # apt install texlive-full--Install manim via pypi::-- # pip3 install manimlib--OR Install manim via the git repository with venv::-- $ git clone https://github.com/3b1b/manim- $ cd manim- $ python3 -m venv ./- $ source bin/activate- $ pip3 install -r requirement.txt--To use manim in virtual environment you need to activate the environment with-the ``activate`` binary by doing ``source bin/activate``, to exit use the ``deactivate`` command.--.. note:: The git repository is updated first before the one on pypi. The git repository also- includes project files used to produce 3b1b videos. Some of the old projects might not- work as due to api changes.---.. note:: The required latex packages are dictated by- ``manimlib/tex_template.tex`` which ``texlive-full`` will satisfy. The download size- can be quite large. If you wish to install only the packages required to use- manim, substitude ``texlive-full`` with::-- texlive texlive-latex-extra texlive-fonts-extra- texlive-latex-recommended texlive-science texlive-fonts-extra tipa--Arch Linux------------Install system libraries::-- # pacman -S cairo ffmpeg opencv sox--Install Latex distribution::-- # pacman -S texlive-most--OR install python-manimlib_:sup:`AUR` package::-- $ git clone https://aur.archlinux.org/python-manimlib.git- $ cd python-manimlib- $ makepkg -si--You can use AUR helpers such as yay_:sup:`AUR`::-- $ yay -S python-manimlib--.. _python-manimlib: https://aur.archlinux.org/packages/python-manimlib/-.. _yay: https://aur.archlinux.org/packages/yay/diff --git a/docs/source/installation/mac.rst b/docs/source/installation/mac.rstdeleted file mode 100644index 43c7bfdb6..000000000--- a/docs/source/installation/mac.rst+++ /dev/null@@ -1,12 +0,0 @@-Mac-===--The simplest way to install the system dependencies on Mac OS X is with Homebrew.-Mac come preinstalled with python2, but to use manim, python3 is required--1. Install python3 https://docs.python.org/3/using/mac.html-2. Install Cairo: ``brew install cairo``-3. Install Sox: ``brew install sox``-4. Install ffmpeg: ``brew install ffmpeg``-5. Install latex (MacTeX): ``brew cask install mactex``-6. Install manimlib ``pip install manimlib`` (or ``pip install --user manimlib`` to just yourself)diff --git a/docs/source/installation/windows.rst b/docs/source/installation/windows.rstdeleted file mode 100644index e58d125c7..000000000--- a/docs/source/installation/windows.rst+++ /dev/null@@ -1,60 +0,0 @@-Windows-=======--Install System Libraries---------------------------Make sure you have *Python 3* for Windows installed first:--https://www.python.org/downloads/windows/--Install ffmpeg:--https://ffmpeg.org/download.html#build-windows--Install sox:--http://sox.sourceforge.net/Main/HomePage--Install a latex distribution. On Windows MikTex is commonly used:--https://miktex.org/howto/install-miktex--Path configuration---------------------To invoke commandline without supplying path to the binary-the PATH environment needs to be configured. Below are template examples, please change-the path according to your username and specific python version. Assuming all the-softwares are installed with no alteration to the installation paths::-- C:\Users\$username\AppData\local\Programs\Python\Python$version\- C:\Users\$username\AppData\local\Programs\Python\Python$version\Scripts\- C:\MikTex\miktex\bin\x64\- C:\ffmpeg\bin\--The path entries should be separated by semicolon.--Installing python packages and manim---------------------------------------Make sure you can start pip using ``pip`` in your commandline. Then do-``pip install pyreadline`` for the ``readline`` package.--Grab the pycairo wheel binary ``pycairo‑1.18.0‑cp37‑cp37m‑win32.whl`` from https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycairo-and install it via ``python -m pip install C:\absolute\path\to\the\whl\file``--clone the manim repository if you have git ``git clone https://github.com/3b1b/manim`` or download the zip file from-the repository page with ``Clone or download`` button and unzip it.--Open the commandline within the manim directory with ``Shift + Right click`` on an empty space in the folder and select ``open command window here``--Install manim python dependencies with ``pip install -r requirements.txt``--Test the installation------------------------Type in ``python -m manim -h`` and if nothing went wrong during the installation process you should see the help text.--Use ``python -m manim example_scenes.py SquareToCircle -pl`` to render the example scene and the file should play after rendering. The movie file should be-in ``media/videos/example_scenes/480p15``diff --git a/docs/source/mobject.rst b/docs/source/mobject.rstnew file mode 100644index 000000000..c798c363f--- /dev/null+++ b/docs/source/mobject.rst@@ -0,0 +1,16 @@+MObject+=======++The MObject is Manim's main python class representing objects that will be+rendered on screen.+++.. automodule:: manim.mobject.mobject+ :members:+ :undoc-members:+ :show-inheritance:++.. automodule:: manim.mobject.geometry+ :members:+ :undoc-members:+ :show-inheritance:diff --git a/docs/source/quickstart.rst b/docs/source/quickstart.rstnew file mode 100644index 000000000..9f01c1734--- /dev/null+++ b/docs/source/quickstart.rst@@ -0,0 +1,4 @@+Quickstart+==========++This is a stub file.diff --git a/docs/source/reference.rst b/docs/source/reference.rstnew file mode 100644index 000000000..5bde2c4d6--- /dev/null+++ b/docs/source/reference.rst@@ -0,0 +1,14 @@+Manim Reference+===============++This reference manual details functions, modules, and objects included in+Manim, describing what they are and what they do. For learning how to use+Manim, see the quickstart and tutorial documents.+++.. toctree::+ :maxdepth: 0++ mobject+ config+ constantsdiff --git a/docs/source/tutorial.rst b/docs/source/tutorial.rstnew file mode 100644index 000000000..769a1ddb2--- /dev/null+++ b/docs/source/tutorial.rst@@ -0,0 +1,4 @@+Tutorial+========++This is a stub file.diff --git a/manim/mobject/geometry.py b/manim/mobject/geometry.pyindex 9c0008562..d56712841 100644--- a/manim/mobject/geometry.py+++ b/manim/mobject/geometry.py@@ -1,3 +1,10 @@+"""+geometry.py+-----------++Classes implementing geometric objects, mostly derived from MObject.++"""import warningsimport numpy as npimport mathdiff --git a/manim/mobject/mobject.py b/manim/mobject/mobject.pyindex d7947ab4d..ea90c2b3b 100644--- a/manim/mobject/mobject.py+++ b/manim/mobject/mobject.py@@ -1,3 +1,10 @@+"""+mobject.py+----------++Base classes for all MObjects.++"""from functools import reduceimport copyimport itertools as it