PM对象

限定名称: manim.mobject.types.point\_cloud\_mobject.PMobject

class PMobject(stroke_width=4, **kwargs)[来源]

基础类: Mobject

由点云组成的圆盘

示例

示例:PMobjectExample

../_images/PMobjectExample-1.png
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)

方法

add_points

添加点。

align_points_with_larger

fade_to

filter_out

get_all_rgbas

get_array_attrs

get_color

返回Mobject的颜色

get_mobject_type_class

返回此mobject类型的基类。

get_point_mobject

最简单的 Mobject 可以转换为自身或从自身转换而来。

get_stroke_width

ingest_submobjects

interpolate_color

match_colors

point_from_proportion

pointwise_become_partial

reset_points

points设置为空数组。

set_color

条件是一个函数,它接受一个参数,(x, y, z)。

set_color_by_gradient

参数 colors:

用于渐变的颜色。使用方式如 set_color_by_gradient(RED, BLUE, GREEN)

set_colors_by_radial_gradient

set_stroke_width

sort_points

函数是从 R^3 到 R 的任何映射

thin_out

移除除了每第n个点之外的所有点,其中n = factor

属性

animate

用于动画化self的任何方法的应用。

animation_overrides

depth

mobject的深度。

height

mobject的高度。

width

mobject的宽度。

_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
static get_mobject_type_class()[来源]

返回此mobject类型的基类。

get_point_mobject(center=None)[来源]

最简单的Mobject可以转换为自身或从自身转换而来。应该是一个适当类型的点。

reset_points()[source]

points设置为空数组。

set_color(color=ManimColor('#FFFF00'), family=True)[来源]

条件是一个接受一个参数的函数,(x, y, z)。 这里它只是递归到子对象,但在子类中,这应该根据颜色的内部工作原理进一步实现。

set_color_by_gradient(*colors)[来源]
Parameters:
  • colors – 用于渐变的颜色。使用方式如 set_color_by_gradient(RED, BLUE, GREEN)

  • ManimColor.parse(color) (self.color =)

  • self (返回)

sort_points(function=<function PMobject.<lambda>>)[source]

函数是从 R^3 到 R 的任何映射

thin_out(factor=5)[source]

移除除了每第n个点之外的所有点,其中n = factor