Skip to content

Commit b9dc655

Browse files
Add docs for images+functions
1 parent 0884bfc commit b9dc655

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docs/source/contributing/docs/types.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,21 @@ Béziers
9797

9898
Functions
9999
---------
100+
Throughout the codebase, many different types of functions are used. The most obvious example
101+
is a rate function, which takes in a float and outputs a float (``Callable[[float], float]``).
102+
Another example is for overriding animations. One will often need to map a :class:`.Mobject`
103+
to an overridden :class:`Animation`, and for that we have the ``FunctionOverride`` typehint.
104+
105+
``PathFuncType`` and ``MappingFunction`` are more niche, but are related to moving objects
106+
along a path, or applying functions. If you need to use it, you'll know.
107+
108+
109+
Images
110+
------
111+
There are several representations of images in manim. The most common is
112+
the representation as a numpy array of floats representing the pixels of an image.
113+
This is especially common when it comes to the OpenGL renderer.
114+
115+
This is the usecase of the ``Image`` typehint. Sometimes, manim may use ``PIL.Image``,
116+
in which case one should use that typehint instead.
117+
Of course if a more specific type of image is needed, it can be annotated as such.

0 commit comments

Comments
 (0)