from manim import *
class DotColor(Scene):
    """2.2 color 决定点的填充色。
    Dot 默认 stroke_width=0，所以整颗点就是 color 指定的颜色。
    """
    def construct(self):
        title = Text("点的颜色 color", font="STLiti", font_size=34).to_edge(UP)
        self.play(Write(title), run_time=0.8)
        specs = [
            (RED, "红"), (GREEN, "绿"), (BLUE, "蓝"),
            (YELLOW, "黄"), (PURPLE, "紫"),
        ]
        dots = VGroup(*[Dot(radius=0.32, color=c) for c, _ in specs])
        dots.arrange(RIGHT, buff=1.35)
        labels = VGroup(*[Text(n, font="STLiti", font_size=28)
                          for _, n in specs])
        for lab, dot in zip(labels, dots):
            lab.next_to(dot, DOWN, buff=0.55)
        self.play(LaggedStart(*[FadeIn(d) for d in dots], lag_ratio=0.25),
                  run_time=2.0)
        self.play(FadeIn(labels), run_time=0.6)
        self.wait(2.8)
