PMobject¶
限定名称: manim.mobject.types.point\_cloud\_mobject.PMobject
- class PMobject(stroke_width=4, **kwargs)[源]¶
基类:
Mobject
由点云构成的圆盘
示例
示例: PMobject示例 ¶
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)
方法
添加点。
与较大的点对齐
淡化到
过滤掉
获取所有RGBA值
获取数组属性
返回
Mobject
的颜色返回此 mobject 类型的基类。
最简单的
Mobject
,可用于转换到或转换自自身。获取笔触宽度
吸收子对象
插值颜色
匹配颜色
从比例获取点
逐点局部变形
将
points
设置为空数组。条件是一个接受一个参数 (x, y, z) 的函数。
按径向渐变设置颜色
设置笔触宽度
函数是R^3到R的任意映射
移除除每第n个点(n=因子)之外的所有点
属性
animate (动画)
用于动画化
self
的任何方法的应用。animation_overrides (动画覆盖)
depth (深度)
mobject 的深度。
height (高度)
mobject 的高度。
width (宽度)
mobject 的宽度。
- 参数:
stroke_width (int)
kwargs (Any)
- _original__init__(stroke_width=4, **kwargs)¶
初始化自身。有关准确签名,请参阅 help(type(self))。
- 参数:
stroke_width (int)
kwargs (Any)
- 返回类型:
无
- add_points(points, rgbas=None, color=None, alpha=1)[源]¶
添加点。
点必须是Nx3的numpy数组。如果rgbas不是None,则必须是Nx4的numpy数组。
- 参数:
points (npt.NDArray)
rgbas (npt.NDArray | None)
color (ParsableManimColor | None)
alpha (float)
- 返回类型:
自身
- get_color()[源]¶
返回
Mobject
的颜色示例
>>> from manim import Square, RED >>> Square(color=RED).get_color() == RED True
- 返回类型:
- get_point_mobject(center=None)[源]¶
最简单的
Mobject
,可用于转换到或转换自自身。应该是相应类型的点- 参数:
center (Point3DLike | None)
- 返回类型:
- set_color(color=ManimColor('#FFFF00'), family=True)[源]¶
条件是一个函数,它接受一个参数 (x, y, z)。这里它只是递归地作用于子对象,但在子类中,这应该根据颜色的内部工作原理进一步实现。
- 参数:
color (ParsableManimColor)
家族 (bool)
- 返回类型:
自身
- set_color_by_gradient(*colors)[源]¶
- 参数:
colors (ParsableManimColor) – 用于渐变的颜色。用法如 set_color_by_gradient(RED, BLUE, GREEN)。
ManimColor.parse(color) (self.color =)
self (return)
- 返回类型:
自身
- sort_points(function=<function PMobject.<lambda>>)[源]¶
函数是R^3到R的任意映射
- 参数:
function (Callable[[npt.NDArray[ManimFloat]], float])
- 返回类型:
自身