from manim import *
class CheckerSurface(ThreeDScene):
    def construct(self):
        self.set_camera_orientation(phi=68 * DEGREES, theta=-48 * DEGREES)
        title = Text("set_fill_by_checkerboard：棋盘交替填充", font="STLiti", font_size=30).to_edge(UP)
        self.add_fixed_in_frame_mobjects(title)
        def func(u, v):
            return (u, v, u * v)
        surf = Surface(func, u_range=[-1.4, 1.4], v_range=[-1.4, 1.4], resolution=(16, 16))
        surf.set_fill_by_checkerboard(RED, BLUE)
        note = Text("红蓝交替的小方格便于区分曲面不同部分", 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)
