正多边形

限定名称: manim.mobject.geometry.polygram.RegularPolygon

class RegularPolygon(n=6, **kwargs)[source]

基础类:RegularPolygram

一个n边的规则Polygon

Parameters:
  • n (int) – RegularPolygon的边数。

  • kwargs – 转发给父构造函数。

示例

示例:RegularPolygonExample

../_images/RegularPolygonExample-1.png
from manim import *

class RegularPolygonExample(Scene):
    def construct(self):
        poly_1 = RegularPolygon(n=6)
        poly_2 = RegularPolygon(n=6, start_angle=30*DEGREES, color=GREEN)
        poly_3 = RegularPolygon(n=10, color=RED)

        poly_group = Group(poly_1, poly_2, poly_3).scale(1.5).arrange(buff=1)
        self.add(poly_group)
class RegularPolygonExample(Scene):
    def construct(self):
        poly_1 = RegularPolygon(n=6)
        poly_2 = RegularPolygon(n=6, start_angle=30*DEGREES, color=GREEN)
        poly_3 = RegularPolygon(n=10, color=RED)

        poly_group = Group(poly_1, poly_2, poly_3).scale(1.5).arrange(buff=1)
        self.add(poly_group)

方法

属性

animate

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

animation_overrides

color

depth

mobject的深度。

fill_color

如果有多种颜色(用于渐变),则返回第一个颜色

height

mobject的高度。

n_points_per_curve

sheen_factor

stroke_color

width

mobject的宽度。

_original__init__(n=6, **kwargs)

初始化自身。有关准确的签名,请参阅 help(type(self))。

Parameters:

n (int)

Return type: