from manim import *
import numpy as np
def head(cn, en):
    t = Text(cn, font="STLiti", font_size=28).to_edge(UP)
    s = Text(en, font="Consolas", font_size=21, color=YELLOW).next_to(t, DOWN, buff=0.10)
    return VGroup(t, s)
def foot(cn):
    return Text(cn, font="STLiti", font_size=20, color=YELLOW).to_edge(DOWN)
class ShapeDemo(Scene):
    def construct(self):
        self.add(head("基础图形：点（3×3 点阵）", "Dot"))
        shape = VGroup(*[Dot(np.array([x, y, 0]), color=BLUE, radius=0.16) for x in (-2, 0, 2) for y in (-2, 0, 2)])
        self.play(Create(shape), run_time=2.2)
        self.play(shape.animate.set_stroke(YELLOW, width=7), run_time=1.2)
        self.play(FadeIn(foot("坐标是 [x, y, z]，二维图形把 z 固定为 0")), run_time=0.4)
        self.wait(2.2)
