立方体¶
限定名称: 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 ¶
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)方法
属性
animate用于动画化
self的任何方法的应用。animation_overridescolordepthmobject的深度。
fill_color如果有多种颜色(用于渐变),则返回第一个颜色
heightmobject的高度。
n_points_per_curvesheen_factorstroke_colorwidthmobject的宽度。
- _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:
无