from manim import *
class DotMoveTo(Scene):
    """1. 最简单的动点：dot.animate.move_to(目标) 生成一段补间动画。
    .animate 会把方法调用转成动画，等价于把 mobject 从当前状态插值到新状态。
    """
    def construct(self):
        title = Text("1. dot.animate.move_to() 移动点", font="STLiti", font_size=32).to_edge(UP)
        start, end = LEFT * 3, RIGHT * 3
        guide = DashedLine(start, end, color=GREY, stroke_width=2)
        marks = VGroup(Dot(start, color=BLUE, radius=0.08),
                       Dot(end, color=GREEN, radius=0.08))
        dot = Dot(start, color=YELLOW, radius=0.25)
        self.play(FadeIn(title), run_time=0.6)
        self.play(Create(guide), FadeIn(marks), run_time=0.8)
        self.add(dot)
        self.play(dot.animate.move_to(end), run_time=2.2)
        note = Text(".animate 把方法调用变成补间动画，起止状态自动插值",
                    font="STLiti", font_size=22, color=YELLOW).to_edge(DOWN)
        self.play(FadeIn(note), run_time=0.6)
        self.wait(2.8)
