from manim import *
class GroupDemo(Scene):
    def construct(self):
        title = Text("AnimationGroup：多个动画同时播放", font="STLiti", font_size=30).to_edge(UP)
        self.play(FadeIn(title), run_time=0.6)
        c = Circle(radius=1.0, color=BLUE, stroke_width=8).shift(LEFT * 3)
        s = Square(side_length=1.8, color=WHITE, stroke_width=8).shift(RIGHT * 3)
        self.play(FadeIn(c), FadeIn(s), run_time=0.8)
        self.play(AnimationGroup(c.animate(run_time=2.2).shift(RIGHT * 2).set_color(YELLOW),
                                 s.animate(run_time=2.2).set_color(RED)), run_time=2.2)
        note = Text("组内的两个变换同一时刻开始、同一时刻结束", font="STLiti", font_size=21, color=YELLOW).to_edge(DOWN)
        self.play(FadeIn(note), run_time=0.4)
        self.wait(2.4)
