A community-maintained Python framework for creating mathematical animations.
Docs (#347)
Leo Torres662777bb96b1
diff --git a/docs/source/_static/custom.css b/docs/source/_static/custom.cssnew file mode 100644index 000000000..6e9c218ea--- /dev/null+++ b/docs/source/_static/custom.css@@ -0,0 +1,3 @@+td {+ padding: 0px 10px 0px 10px;+}diff --git a/docs/source/_templates/autosummary/class.rst b/docs/source/_templates/autosummary/class.rstindex 5944fc12f..1874ef9cf 100644--- a/docs/source/_templates/autosummary/class.rst+++ b/docs/source/_templates/autosummary/class.rst@@ -5,25 +5,25 @@.. autoclass:: {{ objname }}{% block methods %}- {% if methods %}+ {%- if methods %}.. rubric:: {{ _('Methods') }}.. autosummary:::nosignatures::toctree: .{% for item in methods if item != '__init__' and item not in inherited_members %}- ~{{ name }}.{{ item }}+ ~{{ name }}.{{ item }}{%- endfor %}- {% endif %}- {% endblock %}+ {%- endif %}+ {%- endblock %}{% block attributes %}- {% if attributes %}+ {%- if attributes %}.. rubric:: {{ _('Attributes') }}.. autosummary::- {% for item in attributes %}- ~{{ name }}.{{ item }}- {%- endfor %}- {% endif %}+ {% for item in attributes %}+ ~{{ name }}.{{ item }}+ {%- endfor %}+ {%- endif %}{% endblock %}diff --git a/docs/source/conf.py b/docs/source/conf.pyindex cb155c0dc..37e87a784 100644--- a/docs/source/conf.py+++ b/docs/source/conf.py@@ -66,8 +66,10 @@ html_sidebars = {'**': ['logo-text.html', 'globaltoc.html', 'searchbox.html']}# Register the theme as an extension to generate a sitemap.xmlextensions.append("guzzle_sphinx_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 = ['_static']++# This specifies any additional css files that will override the theme's+html_css_files = ['custom.css']diff --git a/manim/animation/animation.py b/manim/animation/animation.pyindex 329baec1b..1bd05dc40 100644--- a/manim/animation/animation.py+++ b/manim/animation/animation.py@@ -1,3 +1,4 @@+"""Animate mobjects."""from copy import deepcopyimport numpy as npdiff --git a/manim/animation/composition.py b/manim/animation/composition.pyindex 7c5c5f04b..942091a5f 100644--- a/manim/animation/composition.py+++ b/manim/animation/composition.py@@ -1,3 +1,4 @@+"""Tools for displaying multiple animations at once."""import numpy as npfrom ..animation.animation import Animationdiff --git a/manim/animation/creation.py b/manim/animation/creation.pyindex bcab8b5cc..22e8f3a5e 100644--- a/manim/animation/creation.py+++ b/manim/animation/creation.py@@ -1,3 +1,4 @@+"""Animate the display or removal of a mobject from a scene."""from ..animation.animation import Animationfrom ..animation.composition import Successionfrom ..mobject.types.vectorized_mobject import VMobject@@ -131,7 +132,7 @@ class ShowIncreasingSubsets(Animation):class AddTextLetterByLetter(ShowIncreasingSubsets):"""- Add a Text Object letter by letter on the scene. Use time_per_char to change frequency of appearance of the letters.+ Add a Text Object letter by letter on the scene. Use time_per_char to change frequency of appearance of the letters."""CONFIG = {diff --git a/manim/animation/fading.py b/manim/animation/fading.pyindex 5f66ec817..59e09134c 100644--- a/manim/animation/fading.py+++ b/manim/animation/fading.py@@ -1,3 +1,4 @@+"""Fading in and out of view."""from ..animation.animation import Animationfrom ..animation.animation import DEFAULT_ANIMATION_LAG_RATIOfrom ..animation.transform import Transformdiff --git a/manim/camera/camera.py b/manim/camera/camera.pyindex caa587b01..ee5cc6c3c 100644--- a/manim/camera/camera.py+++ b/manim/camera/camera.py@@ -1,3 +1,4 @@+"A Camera converts the mobjects contained in a Scene into an array of pixels"from functools import reduceimport itertools as itimport operator as opdiff --git a/manim/mobject/geometry.py b/manim/mobject/geometry.pyindex 3ef7ead28..b8d2ae253 100644--- a/manim/mobject/geometry.py+++ b/manim/mobject/geometry.py@@ -1,10 +1,4 @@-"""-geometry.py--------------Classes implementing geometric objects, mostly derived from MObject.--"""+"""Mobjects that are simple geometric shapes."""import warningsimport numpy as npimport mathdiff --git a/manim/mobject/mobject.py b/manim/mobject/mobject.pyindex 71d446e76..92a3de571 100644--- a/manim/mobject/mobject.py+++ b/manim/mobject/mobject.py@@ -1,6 +1,4 @@-"""-MObject: Base classes for all mathematical objects.-"""+"""Base classes for objects that can be displayed."""from functools import reduceimport copyimport itertools as it@@ -30,8 +28,13 @@ from ..utils.space_ops import rotation_matrixclass Mobject(Container):- """- Mathematical Object+ """Mathematical Object: base class for objects that can be displayed on screen.++ Attributes+ ----------+ submobjects : :class:`list`+ The contained objects.+"""CONFIG = {@@ -69,6 +72,37 @@ class Mobject(Container):passdef add(self, *mobjects):+ """Add mobjects as submobjects.++ The mobjects are added to self.submobjects.++ Parameters+ ----------+ mobjects : List[:class:`Mobject`]+ The mobjects to add.++ Returns+ -------+ :class:`Mobject`+ :code:`self`++ Raises+ ------+ :class:`ValueError`+ When a mobject tries to add itself.++ Notes+ -----+ A mobject cannot contain itself, and it cannot contain a submobject+ more than once. If the parent mobject is displayed, the newly-added+ submobjects will also be displayed (i.e. they are automatically added+ to the parent Scene).++ See Also+ --------+ :meth:`~Mobject.remove`++ """if self in mobjects:raise ValueError("Mobject cannot contain self")self.submobjects = list_update(self.submobjects, mobjects)@@ -80,6 +114,25 @@ class Mobject(Container):return selfdef remove(self, *mobjects):+ """Remove submobjects.++ The mobjects are removed from self.submobjects, if they exist.++ Parameters+ ----------+ mobjects : List[:class:`Mobject`]+ The mobjects to remove.++ Returns+ -------+ :class:`Mobject`+ :code:`self`++ See Also+ --------+ :meth:`~Mobject.add`++ """for mobject in mobjects:if mobject in self.submobjects:self.submobjects.remove(mobject)@@ -1097,6 +1150,8 @@ class Mobject(Container):class Group(Mobject):+ """Groups together multiple Mobjects."""+def __init__(self, *mobjects, **kwargs):if not all([isinstance(m, Mobject) for m in mobjects]):raise Exception("All submobjects must be of type Mobject")diff --git a/manim/mobject/number_line.py b/manim/mobject/number_line.pyindex da8f286ee..e2e6ff963 100644--- a/manim/mobject/number_line.py+++ b/manim/mobject/number_line.py@@ -1,3 +1,4 @@+"""Mobject representing a number line."""import operator as opfrom ..constants import *diff --git a/manim/mobject/svg/svg_mobject.py b/manim/mobject/svg/svg_mobject.pyindex 2a0e864e9..d78d8ac42 100644--- a/manim/mobject/svg/svg_mobject.py+++ b/manim/mobject/svg/svg_mobject.py@@ -1,3 +1,4 @@+"""Mobjects generated from an SVG file."""import itertools as itimport reimport osdiff --git a/manim/mobject/types/vectorized_mobject.py b/manim/mobject/types/vectorized_mobject.pyindex 0e0cbac07..864da5210 100644--- a/manim/mobject/types/vectorized_mobject.py+++ b/manim/mobject/types/vectorized_mobject.py@@ -1,3 +1,4 @@+"""Mobjects that use vector graphics."""import itertools as itimport sysdiff --git a/manim/scene/scene.py b/manim/scene/scene.pyindex b9584a8a8..217988b28 100644--- a/manim/scene/scene.py+++ b/manim/scene/scene.py@@ -1,3 +1,4 @@+"""A Scene is the canvas of the animation."""import inspectimport randomimport warnings