PMobject¶
Qualified name: manim.mobject.types.point\_cloud\_mobject.PMobject
- class PMobject(stroke_width=4, **kwargs)[source]¶
Bases:
MobjectA disc made of a cloud of Dots
Examples
Example: PMobjectExample ¶
from manim import * class PMobjectExample(Scene): def construct(self): pG = PGroup() # This is just a collection of PMobject's # As the scale factor increases, the number of points # removed increases. for sf in range(1, 9 + 1): p = PointCloudDot(density=20, radius=1).thin_out(sf) # PointCloudDot is a type of PMobject # and can therefore be added to a PGroup pG.add(p) # This organizes all the shapes in a grid. pG.arrange_in_grid() self.add(pG)
class PMobjectExample(Scene): def construct(self): pG = PGroup() # This is just a collection of PMobject's # As the scale factor increases, the number of points # removed increases. for sf in range(1, 9 + 1): p = PointCloudDot(density=20, radius=1).thin_out(sf) # PointCloudDot is a type of PMobject # and can therefore be added to a PGroup pG.add(p) # This organizes all the shapes in a grid. pG.arrange_in_grid() self.add(pG)Methods
Add points.
align_points_with_largerfade_tofilter_outget_all_rgbasget_array_attrsReturns the color of the
MobjectReturn the base class of this mobject type.
The simplest
Mobjectto be transformed to or from self.get_stroke_widthingest_submobjectsinterpolate_colormatch_colorspoint_from_proportionpointwise_become_partialSets
pointsto be an empty array.Condition is function which takes in one arguments, (x, y, z).
set_colors_by_radial_gradientset_stroke_widthFunction is any map from R^3 to R
Removes all but every nth point for n = factor
Attributes
alwaysCall a method on a mobject every frame.
animateUsed to animate the application of any method of
self.animation_overridesdepthThe depth of the mobject.
heightThe height of the mobject.
widthThe width of the mobject.
- Parameters:
stroke_width (int)
kwargs (Any)
- _original__init__(stroke_width=4, **kwargs)¶
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
stroke_width (int)
kwargs (Any)
- Return type:
None
- add_points(points, rgbas=None, color=None, alpha=1.0)[source]¶
Add points.
Points must be a Nx3 numpy array. Rgbas must be a Nx4 numpy array if it is not None.
- Parameters:
points (Point3DLike_Array)
rgbas (FloatRGBALike_Array | None)
color (ParsableManimColor | None)
alpha (float)
- Return type:
Self
- get_color()[source]¶
Returns the color of the
MobjectExamples
>>> from manim import Square, RED >>> Square(color=RED).get_color() == RED True
- Return type:
- static get_mobject_type_class()[source]¶
Return the base class of this mobject type.
- Return type:
type[PMobject]
- get_point_mobject(center=None)[source]¶
The simplest
Mobjectto be transformed to or from self. Should by a point of the appropriate type- Parameters:
center (TypeAliasForwardRef('~manim.typing.Point3DLike') | None)
- Return type:
- set_color(color=ManimColor('#FFFF00'), family=True)[source]¶
Condition is function which takes in one arguments, (x, y, z). Here it just recurses to submobjects, but in subclasses this should be further implemented based on the the inner workings of color
- Parameters:
color (ParsableManimColor)
family (bool)
- Return type:
Self
- set_color_by_gradient(*colors)[source]¶
- Parameters:
colors (ParsableManimColor) – The colors to use for the gradient. Use like set_color_by_gradient(RED, BLUE, GREEN).
ManimColor.parse(color) (self.color =)
self (return)
- Return type:
Self
- sort_points(function=<function PMobject.<lambda>>)[source]¶
Function is any map from R^3 to R
- Parameters:
function (Callable[[npt.NDArray[ManimFloat]], float])
- Return type:
Self