立方体

限定名称: manim.mobject.three\_d.three\_dimensions.Cube

class Cube(side_length=2, fill_opacity=0.75, fill_color=ManimColor('#58C4DD'), stroke_width=0, **kwargs)[来源]

基础类: VGroup

一个三维立方体。

Parameters:
  • side_length (float) – Cube 的每边长度。

  • fill_opacity (float) – Cube的不透明度,从0表示完全透明到1表示完全不透明。默认为0.75。

  • fill_color (ParsableManimColor) – Cube 的颜色。

  • stroke_width (float) – 围绕Cube每个面的描边宽度。

示例

示例:CubeExample

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

class CubeExample(ThreeDScene):
    def construct(self):
        self.set_camera_orientation(phi=75*DEGREES, theta=-45*DEGREES)

        axes = ThreeDAxes()
        cube = Cube(side_length=3, fill_opacity=0.7, fill_color=BLUE)
        self.add(cube)
class CubeExample(ThreeDScene):
    def construct(self):
        self.set_camera_orientation(phi=75*DEGREES, theta=-45*DEGREES)

        axes = ThreeDAxes()
        cube = Cube(side_length=3, fill_opacity=0.7, fill_color=BLUE)
        self.add(cube)

方法

generate_points

创建Cube的侧面。

init_points

创建Cube的侧面。

属性

animate

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

animation_overrides

color

depth

mobject的深度。

fill_color

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

height

mobject的高度。

n_points_per_curve

sheen_factor

stroke_color

width

mobject的宽度。

_original__init__(side_length=2, fill_opacity=0.75, fill_color=ManimColor('#58C4DD'), stroke_width=0, **kwargs)

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

Parameters:
  • side_length (float)

  • fill_opacity (float)

  • fill_color (ParsableManimColor)

  • stroke_width (float)

Return type:

generate_points()[来源]

创建Cube的侧面。

Return type:

init_points()

创建Cube的侧面。

Return type: