from manim import *
class FollowDemo(MovingCameraScene):
    def construct(self):
        title = Text("MovingCameraScene：相机跟随移动对象", font="STLiti", font_size=28).to_edge(UP)
        self.add(title)
        path = Line(LEFT * 3, RIGHT * 3, color=GREY_B, stroke_width=3)
        dot = Dot(LEFT * 3, radius=0.18, color=RED)
        self.play(Create(path), FadeIn(dot), run_time=0.8)
        self.play(MoveAlongPath(dot, path), run_time=3.0, rate_func=linear)
        self.play(self.camera.frame.animate.move_to(dot).set_width(7), run_time=1.2)
        self.wait(1.2)
