typing¶
Custom type definitions used in Manim.
Note for developers
Around the source code there are multiple strings which look like this:
'''
[CATEGORY]
<category_name>
'''
All type aliases defined under those strings will be automatically classified under that category.
If you need to define a new category, respect the format described above.
Type Aliases
Primitive data types¶
- class ManimFloat¶
np.float64
A double-precision floating-point value (64 bits, or 8 bytes), according to the IEEE 754 standard.
- class ManimInt¶
np.int64
A long integer (64 bits, or 8 bytes).
It can take values between \(-2^{63}\) and \(+2^{63} - 1\), which expressed in base 10 is a range between around \(-9.223 \cdot 10^{18}\) and \(+9.223 \cdot 10^{18}\).
Color types¶
- class ManimColorDType¶
ManimFloatData type used in
ManimColorInternal: a double-precision float between 0 and 1.
- class FloatRGB¶
NDArray[
ManimColorDType]shape: (3,)A
numpy.ndarrayof 3 floats between 0 and 1, representing a color in RGB format.Its components describe, in order, the intensity of Red, Green, and Blue in the represented color.
- class FloatRGB_Array¶
NDArray[
ManimColorDType]shape: (M, 3)A
numpy.ndarrayof many rows of 3 floats representing RGB colors.
- class FloatRGBLike_Array¶
FloatRGB_Array| Sequence[FloatRGBLike]shape: (M, 3)An array of many rows of 3 floats representing RGB colors.
This represents anything which can be converted to a
FloatRGB_ArrayNumPy array.
- class FloatRGBA¶
NDArray[
ManimColorDType]shape: (4,)A
numpy.ndarrayof 4 floats between 0 and 1, representing a color in RGBA format.Its components describe, in order, the intensity of Red, Green, Blue and Alpha (opacity) in the represented color.
- class FloatRGBA_Array¶
NDArray[
ManimColorDType]shape: (M, 4)A
numpy.ndarrayof many rows of 4 floats representing RGBA colors.
- class FloatRGBALike_Array¶
FloatRGBA_Array| Sequence[FloatRGBALike]shape: (M, 4)An array of many rows of 4 floats representing RGBA colors.
This represents anything which can be converted to a
FloatRGBA_ArrayNumPy array.
- class FloatHSVLike¶
FloatRGBLikeshape: (3,)An array of 3 floats between 0 and 1, representing a color in HSV (or HSB) format.
This represents anything which can be converted to a
FloatHSVNumPy array.
- class FloatHSVALike¶
FloatRGBALikeshape: (4,)An array of 4 floats between 0 and 1, representing a color in HSVA (or HSBA) format.
This represents anything which can be converted to a
FloatHSVANumPy array.
- class FloatHSLLike¶
FloatRGBLikeshape: (3,)An array of 3 floats between 0 and 1, representing a color in HSL format.
This represents anything which can be converted to a
FloatHSLNumPy array.
- class ManimColorInternal¶
FloatRGBAshape: (4,)Internal color representation used by
ManimColor, following the RGBA format.It is a
numpy.ndarrayconsisting of 4 floats between 0 and 1, describing respectively the intensities of Red, Green, Blue and Alpha (opacity) in the represented color.
Point types¶
- class PointDType¶
ManimFloatDefault type for arrays representing points: a double-precision floating point value.
- class Point2D¶
NDArray[
PointDType]shape: (2,)A NumPy array representing a 2-dimensional point:
[float, float].
- class Point2D_Array¶
NDArray[
PointDType]shape: (M, 2)A NumPy array representing a sequence of
Point2Dobjects:[[float, float], ...].
- class Point2DLike_Array¶
Point2D_Array| Sequence[Point2DLike]shape: (M, 2)An array of
Point2DLikeobjects:[[float, float], ...].This represents anything which can be converted to a
Point2D_ArrayNumPy array.Please refer to the documentation of the function you are using for further type information.
- class Point3D¶
NDArray[
PointDType]shape: (3,)A NumPy array representing a 3-dimensional point:
[float, float, float].
- class Point3D_Array¶
NDArray[
PointDType]shape: (M, 3)A NumPy array representing a sequence of
Point3Dobjects:[[float, float, float], ...].
- class Point3DLike_Array¶
Point3D_Array| Sequence[Point3DLike]shape: (M, 3)An array of
Point3DLikeobjects:[[float, float, float], ...].This represents anything which can be converted to a
Point3D_ArrayNumPy array.Please refer to the documentation of the function you are using for further type information.
- class PointND¶
NDArray[
PointDType]shape: (N,)A NumPy array representing an N-dimensional point:
[float, ...].
- class PointND_Array¶
NDArray[
PointDType]shape: (M, N)A NumPy array representing a sequence of
PointNDobjects:[[float, ...], ...].
- class PointNDLike_Array¶
PointND_Array| Sequence[PointNDLike]shape: (M, N)An array of
PointNDLikeobjects:[[float, ...], ...].This represents anything which can be converted to a
PointND_ArrayNumPy array.Please refer to the documentation of the function you are using for further type information.
Vector types¶
- class Vector2D¶
NDArray[
PointDType]shape: (2,)A NumPy array representing a 2-dimensional vector:
[float, float].
- class Vector2DLike¶
NDArray[
PointDType] | tuple[float, float]shape: (2,)A 2-dimensional vector:
[float, float].This represents anything which can be converted to a
Vector2DNumPy array.
- class Vector2D_Array¶
NDArray[
PointDType]shape: (M, 2)A NumPy array representing a sequence of
Vector2Dobjects:[[float, float], ...].
- class Vector2DLike_Array¶
Vector2D_Array| Sequence[Vector2DLike]shape: (M, 2)An array of
Vector2DLikeobjects:[[float, float], ...].This represents anything which can be converted to a
Vector2D_ArrayNumPy array.
- class Vector3D¶
NDArray[
PointDType]shape: (3,)A NumPy array representing a 3-dimensional vector:
[float, float, float].
- class Vector3DLike¶
NDArray[
PointDType] | tuple[float, float, float]shape: (3,)A 3-dimensional vector:
[float, float, float].This represents anything which can be converted to a
Vector3DNumPy array.
- class Vector3D_Array¶
NDArray[
PointDType]shape: (M, 3)An NumPy array representing a sequence of
Vector3Dobjects:[[float, float, float], ...].
- class Vector3DLike_Array¶
NDArray[
PointDType] | Sequence[Vector3DLike]shape: (M, 3)An array of
Vector3DLikeobjects:[[float, float, float], ...].This represents anything which can be converted to a
Vector3D_ArrayNumPy array.
- class VectorND¶
NDArray[
PointDType]shape (N,)A NumPy array representing an \(N\)-dimensional vector:
[float, ...].Caution
Do not confuse with the
VectorVMobject! This type alias is named “VectorND” instead of “Vector” to avoid potential name collisions.
- class VectorNDLike¶
NDArray[
PointDType] | Sequence[float]shape (N,)An \(N\)-dimensional vector:
[float, ...].This represents anything which can be converted to a
VectorNDNumPy array.Caution
Do not confuse with the
VectorVMobject! This type alias is named “VectorND” instead of “Vector” to avoid potential name collisions.
- class VectorND_Array¶
NDArray[
PointDType]shape (M, N)A NumPy array representing a sequence of
VectorNDobjects:[[float, ...], ...].
- class VectorNDLike_Array¶
NDArray[
PointDType] | Sequence[VectorNDLike]shape (M, N)An array of
VectorNDLikeobjects:[[float, ...], ...].This represents anything which can be converted to a
VectorND_ArrayNumPy array.
- class RowVector¶
NDArray[
PointDType]shape: (1, N)A row vector:
[[float, ...]].
- class ColVector¶
NDArray[
PointDType]shape: (N, 1)A column vector:
[[float], [float], ...].
Matrix types¶
- class MatrixMN¶
NDArray[
PointDType]shape: (M, N)A matrix:
[[float, ...], [float, ...], ...].
Bézier types¶
- class QuadraticBezierPoints¶
Point3D_Arrayshape: (3, 3)A
Point3D_Arrayof three 3D control points for a single quadratic Bézier curve:[[float, float, float], [float, float, float], [float, float, float]].
- class QuadraticBezierPointsLike¶
QuadraticBezierPoints| tuple[Point3DLike,Point3DLike,Point3DLike]shape: (3, 3)A
Point3DLike_Arrayof three 3D control points for a single quadratic Bézier curve:[[float, float, float], [float, float, float], [float, float, float]].This represents anything which can be converted to a
QuadraticBezierPointsNumPy array.
- class QuadraticBezierPoints_Array¶
NDArray[
PointDType]shape: (N, 3, 3)A NumPy array containing \(N\)
QuadraticBezierPointsobjects:[[[float, float, float], [float, float, float], [float, float, float]], ...].
- class QuadraticBezierPointsLike_Array¶
QuadraticBezierPoints_Array| Sequence[QuadraticBezierPointsLike]shape: (N, 3, 3)A sequence of \(N\)
QuadraticBezierPointsLikeobjects:[[[float, float, float], [float, float, float], [float, float, float]], ...].This represents anything which can be converted to a
QuadraticBezierPoints_ArrayNumPy array.
- class QuadraticBezierPath¶
Point3D_Arrayshape: (3*N, 3)A
Point3D_Arrayof \(3N\) points, where each one of the \(N\) consecutive blocks of 3 points represents a quadratic Bézier curve:[[float, float, float], ...], ...].Please refer to the documentation of the function you are using for further type information.
- class QuadraticBezierPathLike¶
Point3DLike_Arrayshape: (3*N, 3)A
Point3DLike_Arrayof \(3N\) points, where each one of the \(N\) consecutive blocks of 3 points represents a quadratic Bézier curve:[[float, float, float], ...], ...].This represents anything which can be converted to a
QuadraticBezierPathNumPy array.Please refer to the documentation of the function you are using for further type information.
- class QuadraticSpline¶
QuadraticBezierPathshape: (3*N, 3)A special case of
QuadraticBezierPathwhere all the \(N\) quadratic Bézier curves are connected, forming a quadratic spline:[[float, float, float], ...], ...].Please refer to the documentation of the function you are using for further type information.
- class QuadraticSplineLike¶
QuadraticBezierPathLikeshape: (3*N, 3)A special case of
QuadraticBezierPathLikewhere all the \(N\) quadratic Bézier curves are connected, forming a quadratic spline:[[float, float, float], ...], ...].This represents anything which can be converted to a
QuadraticSplineNumPy array.Please refer to the documentation of the function you are using for further type information.
- class CubicBezierPoints¶
Point3D_Arrayshape: (4, 3)A
Point3D_Arrayof four 3D control points for a single cubic Bézier curve:[[float, float, float], [float, float, float], [float, float, float], [float, float, float]].
- class CubicBezierPointsLike¶
CubicBezierPoints| tuple[Point3DLike,Point3DLike,Point3DLike,Point3DLike]shape: (4, 3)A
Point3DLike_Arrayof 4 control points for a single cubic Bézier curve:[[float, float, float], [float, float, float], [float, float, float], [float, float, float]].This represents anything which can be converted to a
CubicBezierPointsNumPy array.
- class CubicBezierPoints_Array¶
NDArray[
PointDType]shape: (N, 4, 3)A NumPy array containing \(N\)
CubicBezierPointsobjects:[[[float, float, float], [float, float, float], [float, float, float], [float, float, float]], ...].
- class CubicBezierPointsLike_Array¶
CubicBezierPoints_Array| Sequence[CubicBezierPointsLike]shape: (N, 4, 3)A sequence of \(N\)
CubicBezierPointsLikeobjects:[[[float, float, float], [float, float, float], [float, float, float], [float, float, float]], ...].This represents anything which can be converted to a
CubicBezierPoints_ArrayNumPy array.
- class CubicBezierPath¶
Point3D_Arrayshape: (4*N, 3)A
Point3D_Arrayof \(4N\) points, where each one of the \(N\) consecutive blocks of 4 points represents a cubic Bézier curve:[[float, float, float], ...], ...].Please refer to the documentation of the function you are using for further type information.
- class CubicBezierPathLike¶
Point3DLike_Arrayshape: (4*N, 3)A
Point3DLike_Arrayof \(4N\) points, where each one of the \(N\) consecutive blocks of 4 points represents a cubic Bézier curve:[[float, float, float], ...], ...].This represents anything which can be converted to a
CubicBezierPathNumPy array.Please refer to the documentation of the function you are using for further type information.
- class CubicSpline¶
CubicBezierPathshape: (4*N, 3)A special case of
CubicBezierPathwhere all the \(N\) cubic Bézier curves are connected, forming a quadratic spline:[[float, float, float], ...], ...].Please refer to the documentation of the function you are using for further type information.
- class CubicSplineLike¶
CubicBezierPathLikeshape: (4*N, 3)A special case of
CubicBezierPathwhere all the \(N\) cubic Bézier curves are connected, forming a quadratic spline:[[float, float, float], ...], ...].This represents anything which can be converted to a
CubicSplineNumPy array.Please refer to the documentation of the function you are using for further type information.
- class BezierPoints¶
Point3D_Arrayshape: (PPC, 3)A
Point3D_Arrayof \(\text{PPC}\) control points (\(\text{PPC: Points Per Curve} = n + 1\)) for a single \(n\)-th degree Bézier curve:[[float, float, float], ...].Please refer to the documentation of the function you are using for further type information.
- class BezierPointsLike¶
Point3DLike_Arrayshape: (PPC, 3)A
Point3DLike_Arrayof \(\text{PPC}\) control points (\(\text{PPC: Points Per Curve} = n + 1\)) for a single \(n\)-th degree Bézier curve:[[float, float, float], ...].This represents anything which can be converted to a
BezierPointsNumPy array.Please refer to the documentation of the function you are using for further type information.
- class BezierPoints_Array¶
NDArray[
PointDType]shape: (N, PPC, 3)A NumPy array of \(N\)
BezierPointsobjects containing \(\text{PPC}\)Point3Dobjects each (\(\text{PPC: Points Per Curve} = n + 1\)):[[[float, float, float], ...], ...].Please refer to the documentation of the function you are using for further type information.
- class BezierPointsLike_Array¶
BezierPoints_Array| Sequence[BezierPointsLike]shape: (N, PPC, 3)A sequence of \(N\)
BezierPointsLikeobjects containing \(\text{PPC}\)Point3DLikeobjects each (\(\text{PPC: Points Per Curve} = n + 1\)):[[[float, float, float], ...], ...].This represents anything which can be converted to a
BezierPoints_ArrayNumPy array.Please refer to the documentation of the function you are using for further type information.
- class BezierPath¶
Point3D_Arrayshape: (PPC*N, 3)A
Point3D_Arrayof \(\text{PPC} \cdot N\) points, where each one of the \(N\) consecutive blocks of \(\text{PPC}\) control points (\(\text{PPC: Points Per Curve} = n + 1\)) represents a Bézier curve of \(n\)-th degree:[[float, float, float], ...], ...].Please refer to the documentation of the function you are using for further type information.
- class BezierPathLike¶
Point3DLike_Arrayshape: (PPC*N, 3)A
Point3DLike_Arrayof \(\text{PPC} \cdot N\) points, where each one of the \(N\) consecutive blocks of \(\text{PPC}\) control points (\(\text{PPC: Points Per Curve} = n + 1\)) represents a Bézier curve of \(n\)-th degree:[[float, float, float], ...], ...].This represents anything which can be converted to a
BezierPathNumPy array.Please refer to the documentation of the function you are using for further type information.
- class Spline¶
BezierPathshape: (PPC*N, 3)A special case of
BezierPathwhere all the \(N\) Bézier curves consisting of \(\text{PPC}\)Point3Dobjects (\(\text{PPC: Points Per Curve} = n + 1\)) are connected, forming an \(n\)-th degree spline:[[float, float, float], ...], ...].Please refer to the documentation of the function you are using for further type information.
- class SplineLike¶
BezierPathLikeshape: (PPC*N, 3)A special case of
BezierPathLikewhere all the \(N\) Bézier curves consisting of \(\text{PPC}\)Point3Dobjects (\(\text{PPC: Points Per Curve} = n + 1\)) are connected, forming an \(n\)-th degree spline:[[float, float, float], ...], ...].This represents anything which can be converted to a
SplineNumPy array.Please refer to the documentation of the function you are using for further type information.
- class FlatBezierPoints¶
NDArray[
PointDType] | tuple[float, ...]shape: (3*PPC*N,)A flattened array of Bézier control points:
[float, ...].
Function types¶
- class PathFuncType¶
Callable[[
Point3DLike,Point3DLike, float],Point3DLike]Function mapping two
Point3Dobjects and an alpha value to a newPoint3D.
- class MultiMappingFunction¶
Callable[[
Point3D_Array],Point3D_Array]A function mapping a
Point3D_Arrayto anotherPoint3D_Array.
Image types¶
- class PixelArray¶
NDArray[
ManimInt]shape: (height, width) | (height, width, 3) | (height, width, 4)A rasterized image with a height of
heightpixels and a width ofwidthpixels.Every value in the array is an integer from 0 to 255.
Every pixel is represented either by a single integer indicating its lightness (for greyscale images), an
RGB_Array_Intor an RGBA_Array_Int.
- class GrayscalePixelArray¶
PixelArrayshape: (height, width)A 100% opaque grayscale
PixelArray, where every pixel value is aManimIntindicating its lightness (black -> gray -> white).
- class RGBPixelArray¶
PixelArrayshape: (height, width, 3)A 100% opaque
PixelArrayin color, where every pixel value is an RGB_Array_Int object.
- class RGBAPixelArray¶
PixelArrayshape: (height, width, 4)A
PixelArrayin color where pixels can be transparent. Every pixel value is anRGBA_Array_Intobject.