from manim import *
class BasicSurface(ThreeDScene):
    def construct(self):
        self.set_camera_orientation(phi=68 * DEGREES, theta=-48 * DEGREES)
        title = Text("Surface 基本曲面：z = u² - v²", font="STLiti", font_size=30).to_edge(UP)
        self.add_fixed_in_frame_mobjects(title)
        def func(u, v):
            return (u, v, u**2 - v**2)
        surf = Surface(func, u_range=[-1.4, 1.4], v_range=[-1.4, 1.4], resolution=(16, 16))
        surf.set_fill(BLUE_D, opacity=0.85).set_stroke(BLUE_B, width=1.0)
        note = Text("func 返回三维点，u_range / v_range 决定曲面的延伸范围", font="STLiti", font_size=21, color=YELLOW).to_edge(DOWN)
        self.add_fixed_in_frame_mobjects(note)
        self.play(FadeIn(title), run_time=0.6)
        self.play(FadeIn(surf), run_time=1.6)
        self.play(FadeIn(note), run_time=0.5)
        self.wait(3.6)
