环形扇区

限定名称: manim.mobject.geometry.arc.AnnularSector

class AnnularSector(inner_radius=1, outer_radius=2, angle=1.5707963267948966, start_angle=0, fill_opacity=1, stroke_width=0, color=ManimColor('#FFFFFF'), **kwargs)[来源]

基础类: Arc

环形的一个扇形。

Parameters:
  • inner_radius (float) – 环形扇形的内半径。

  • outer_radius (float) – 环形扇区的外半径。

  • angle (float) – 环形扇区的顺时针角度。

  • start_angle (float) – 环形扇区的起始顺时针角度。

  • fill_opacity (float) – 填充在环形扇区中的颜色的不透明度。

  • stroke_width (float) – 环形扇形的描边宽度。

  • color (ParsableManimColor) – 填充到环形扇区的颜色。

示例

示例:AnnularSectorExample

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

class AnnularSectorExample(Scene):
    def construct(self):
        # Changes background color to clearly visualize changes in fill_opacity.
        self.camera.background_color = WHITE

        # The default parameter start_angle is 0, so the AnnularSector starts from the +x-axis.
        s1 = AnnularSector(color=YELLOW).move_to(2 * UL)

        # Different inner_radius and outer_radius than the default.
        s2 = AnnularSector(inner_radius=1.5, outer_radius=2, angle=45 * DEGREES, color=RED).move_to(2 * UR)

        # fill_opacity is typically a number > 0 and <= 1. If fill_opacity=0, the AnnularSector is transparent.
        s3 = AnnularSector(inner_radius=1, outer_radius=1.5, angle=PI, fill_opacity=0.25, color=BLUE).move_to(2 * DL)

        # With a negative value for the angle, the AnnularSector is drawn clockwise from the start value.
        s4 = AnnularSector(inner_radius=1, outer_radius=1.5, angle=-3 * PI / 2, color=GREEN).move_to(2 * DR)

        self.add(s1, s2, s3, s4)
class AnnularSectorExample(Scene):
    def construct(self):
        # Changes background color to clearly visualize changes in fill_opacity.
        self.camera.background_color = WHITE

        # The default parameter start_angle is 0, so the AnnularSector starts from the +x-axis.
        s1 = AnnularSector(color=YELLOW).move_to(2 * UL)

        # Different inner_radius and outer_radius than the default.
        s2 = AnnularSector(inner_radius=1.5, outer_radius=2, angle=45 * DEGREES, color=RED).move_to(2 * UR)

        # fill_opacity is typically a number > 0 and <= 1. If fill_opacity=0, the AnnularSector is transparent.
        s3 = AnnularSector(inner_radius=1, outer_radius=1.5, angle=PI, fill_opacity=0.25, color=BLUE).move_to(2 * DL)

        # With a negative value for the angle, the AnnularSector is drawn clockwise from the start value.
        s4 = AnnularSector(inner_radius=1, outer_radius=1.5, angle=-3 * PI / 2, color=GREEN).move_to(2 * DR)

        self.add(s1, s2, s3, s4)

方法

generate_points

初始化 points 并因此确定形状。

init_points

初始化 points 并因此确定形状。

属性

animate

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

animation_overrides

color

depth

mobject的深度。

fill_color

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

height

mobject的高度。

n_points_per_curve

sheen_factor

stroke_color

width

mobject的宽度。

_original__init__(inner_radius=1, outer_radius=2, angle=1.5707963267948966, start_angle=0, fill_opacity=1, stroke_width=0, color=ManimColor('#FFFFFF'), **kwargs)

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

Parameters:
  • inner_radius (float)

  • outer_radius (float)

  • 角度 (浮点数)

  • start_angle (float)

  • fill_opacity (float)

  • stroke_width (float)

  • 颜色 (ParsableManimColor)

Return type:

generate_points()[来源]

初始化 points 并因此确定形状。

在创建时调用。这是一个可以由子类实现的空方法。

Return type:

init_points()

初始化 points 并因此确定形状。

在创建时调用。这是一个可以由子类实现的空方法。

Return type: