from manim import *
class OrbitDemo(Scene):
    def construct(self):
        title = Text("MoveAlongPath：沿椭圆轨道公转", font="STLiti", font_size=32).to_edge(UP)
        self.play(FadeIn(title), run_time=0.6)
        sun = Dot(color=YELLOW, radius=0.42)
        path = Ellipse(width=7.0, height=3.4, color=GREY_B, stroke_width=3)
        planet = Dot(color=BLUE, radius=0.20).move_to(path.get_start())
        self.play(FadeIn(sun), Create(path), FadeIn(planet), run_time=1.0)
        self.play(MoveAlongPath(planet, path), run_time=3.6, rate_func=linear)
        note = Text("rate_func=linear 保证匀速，路径由 VMobject 给出", font="STLiti", font_size=21, color=YELLOW).to_edge(DOWN)
        self.play(FadeIn(note), run_time=0.4)
        self.wait(1.2)
