from manim import *
class LaggedDotsDemo(Scene):
    def construct(self):
        title = Text("逐点错开：移动并同时变色", font="STLiti", font_size=30).to_edge(UP)
        self.play(FadeIn(title), run_time=0.6)
        dots = VGroup(*[Dot(radius=0.18, color=BLUE) for _ in range(5)])
        dots.arrange(RIGHT, buff=0.9).shift(UP * 0.6)
        self.play(FadeIn(dots), run_time=0.8)
        self.play(LaggedStart(*[d.animate(run_time=1.0).shift(DOWN * 1.8).set_color(YELLOW) for d in dots],
                              lag_ratio=0.2), run_time=2.8)
        note = Text("0.21 用 LaggedStart 包一组 animate，不必依赖 LaggedStartMap", font="STLiti", font_size=20, color=YELLOW).to_edge(DOWN)
        self.play(FadeIn(note), run_time=0.4)
        self.wait(1.2)
