PM对象¶
限定名称: manim.mobject.types.point\_cloud\_mobject.PMobject
- class PMobject(stroke_width=4, **kwargs)[来源]¶
基础类:
Mobject由点云组成的圆盘
示例
示例: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)方法
添加点。
align_points_with_largerfade_tofilter_outget_all_rgbasget_array_attrs返回
Mobject的颜色返回此mobject类型的基类。
最简单的
Mobject可以转换为自身或从自身转换而来。get_stroke_widthingest_submobjectsinterpolate_colormatch_colorspoint_from_proportionpointwise_become_partial将
points设置为空数组。条件是一个函数,它接受一个参数,(x, y, z)。
- 参数 colors:
用于渐变的颜色。使用方式如 set_color_by_gradient(RED, BLUE, GREEN)。
set_colors_by_radial_gradientset_stroke_width函数是从 R^3 到 R 的任何映射
移除除了每第n个点之外的所有点,其中n = factor
属性
animate用于动画化
self的任何方法的应用。animation_overridesdepthmobject的深度。
heightmobject的高度。
widthmobject的宽度。
- _original__init__(stroke_width=4, **kwargs)¶
初始化自身。有关准确的签名,请参阅 help(type(self))。
- add_points(points, rgbas=None, color=None, alpha=1)[来源]¶
添加点。
点必须是一个Nx3的numpy数组。 如果Rgbas不是None,则必须是一个Nx4的numpy数组。
- get_color()[来源]¶
返回
Mobject的颜色示例
>>> from manim import Square, RED >>> Square(color=RED).get_color() == RED True
- set_color(color=ManimColor('#FFFF00'), family=True)[来源]¶
条件是一个接受一个参数的函数,(x, y, z)。 这里它只是递归到子对象,但在子类中,这应该根据颜色的内部工作原理进一步实现。