from manim import *
class SpeedRotateDemo(Scene):
    def construct(self):
        title = Text("ChangeSpeed：变速旋转的正方形", font="STLiti", font_size=30).to_edge(UP)
        self.play(FadeIn(title), run_time=0.6)
        square = Square(side_length=2.2, color=BLUE, stroke_width=8)
        self.play(FadeIn(square), run_time=0.6)
        self.play(ChangeSpeed(Rotate(square, angle=PI, run_time=3),
                              speedinfo={0.3: 0.5, 0.7: 2}, rate_func=linear))
        note = Text("speedinfo 的键是进度、值是该段速率倍数", font="STLiti", font_size=21, color=YELLOW).to_edge(DOWN)
        self.play(FadeIn(note), run_time=0.4)
        self.wait(1.4)
