from manim import *
import numpy as np
def head(cn, en):
    t = Text(cn, font="STLiti", font_size=27).to_edge(UP)
    s = Text(en, font="Consolas", font_size=20, color=YELLOW).next_to(t, DOWN, buff=0.10)
    return VGroup(t, s)
def foot(cn):
    return Text(cn, font="STLiti", font_size=20, color=YELLOW).to_edge(DOWN)
class TracedPathDemo(Scene):
    def construct(self):
        self.add(head("高级特效：留下运动轨迹", "TracedPath"))
        d = Dot(RIGHT * 2.6, color=YELLOW, radius=0.14)
        trace = TracedPath(d.get_center, dissipating_time=None, stroke_color=BLUE, stroke_width=6)
        self.add(d, trace)
        self.play(d.animate(path_arc=PI / 2).shift(LEFT * 2.6), run_time=2.4)
        self.play(d.animate(path_arc=-PI / 2).shift(LEFT * 2.6), run_time=2.4)
        self.play(FadeIn(foot("TracedPath 也是一个 updater，逐帧追加当前位置")), run_time=0.4)
        self.wait(1.2)
