Skip to content

armgit / manim

Public Imported from GitHub
0

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.css
new file mode 100644
index 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.rst
index 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.py
index 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.xml
extensions.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.py
index 329baec1b..1bd05dc40 100644
--- a/manim/animation/animation.py
+++ b/manim/animation/animation.py
@@ -1,3 +1,4 @@
+"""Animate mobjects."""
from copy import deepcopy
import numpy as np
diff --git a/manim/animation/composition.py b/manim/animation/composition.py
index 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 np
from ..animation.animation import Animation
diff --git a/manim/animation/creation.py b/manim/animation/creation.py
index 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 Animation
from ..animation.composition import Succession
from ..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.py
index 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 Animation
from ..animation.animation import DEFAULT_ANIMATION_LAG_RATIO
from ..animation.transform import Transform
diff --git a/manim/camera/camera.py b/manim/camera/camera.py
index 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 reduce
import itertools as it
import operator as op
diff --git a/manim/mobject/geometry.py b/manim/mobject/geometry.py
index 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 warnings
import numpy as np
import math
diff --git a/manim/mobject/mobject.py b/manim/mobject/mobject.py
index 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 reduce
import copy
import itertools as it
@@ -30,8 +28,13 @@ from ..utils.space_ops import rotation_matrix
class 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):
pass
def 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 self
def 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.py
index 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 op
from ..constants import *
diff --git a/manim/mobject/svg/svg_mobject.py b/manim/mobject/svg/svg_mobject.py
index 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 it
import re
import os
diff --git a/manim/mobject/types/vectorized_mobject.py b/manim/mobject/types/vectorized_mobject.py
index 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 it
import sys
diff --git a/manim/scene/scene.py b/manim/scene/scene.py
index 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 inspect
import random
import warnings