from manim import *
class TorusBasic(ThreeDScene):
    """2.1 标准环面。Torus 是 Surface 的子类，属于三维对象，
    用 ThreeDScene + set_camera_orientation 转一下相机才能看出甜甜圈的立体形状；
    若用普通 Scene 从 +z 方向俯视，只会得到一个平面圆环。
    """
    def construct(self):
        self.set_camera_orientation(phi=65 * DEGREES, theta=-45 * DEGREES)
        title = Text("标准环面 Torus", font="STLiti", font_size=34).to_edge(UP)
        self.add_fixed_in_frame_mobjects(title)
        torus = Torus(major_radius=2.5, minor_radius=0.5, resolution=(30, 30),
                      checkerboard_colors=[BLUE_D, BLUE_E])
        self.play(FadeIn(title), run_time=0.6)
        self.play(FadeIn(torus), run_time=1.8)
        note = Text("major_radius=2.5 轮胎大小  |  minor_radius=0.5 管道厚度",
                    font="STLiti", font_size=22, color=YELLOW).to_edge(DOWN)
        self.add_fixed_in_frame_mobjects(note)
        self.play(FadeIn(note), run_time=0.6)
        self.wait(3.2)
