from manim import *
class ThreeDCombo(ThreeDScene):
    """3.4 综合：起点 Dot3D、路径 Line3D、终点方向 Arrow3D 一起上屏。
    老示例只 FadeIn 了 line，点丢了、正文说的 Arrow3D 根本没创建。
    """
    def construct(self):
        self.set_camera_orientation(phi=65 * DEGREES, theta=-50 * DEGREES)
        title = Text("Dot3D + Line3D + Arrow3D 综合场景", font="STLiti", font_size=30).to_edge(UP)
        self.add_fixed_in_frame_mobjects(title)
        start, end = [-1, -1, -1], [2, 2, 2]
        dot = Dot3D(point=start, color=BLUE, radius=0.14)
        line = Line3D(start=start, end=end, thickness=0.05, color=YELLOW)
        arrow = Arrow3D(start=[1.2, 1.2, 1.2], end=[2.9, 2.9, 2.9],
                        thickness=0.05, height=0.28, base_radius=0.11, color=RED)
        legend = VGroup(
            Text("蓝点：路径起点", font="STLiti", font_size=21, color=BLUE),
            Text("黄线：路径轨迹", font="STLiti", font_size=21, color=YELLOW),
            Text("红箭头：终点方向", font="STLiti", font_size=21, color=RED),
        ).arrange(DOWN, aligned_edge=LEFT, buff=0.16).to_corner(UL).shift(DOWN * 1.2)
        self.add_fixed_in_frame_mobjects(legend)
        self.play(FadeIn(title), run_time=0.6)
        self.play(FadeIn(dot), run_time=0.8)
        self.play(FadeIn(line), run_time=1.4)
        self.play(FadeIn(arrow), run_time=1.2)
        self.play(FadeIn(legend), run_time=0.8)
        note = Text("三个对象都要 self.add / self.play，缺一个就少一部分画面",
                    font="STLiti", font_size=20, color=YELLOW).to_edge(DOWN)
        self.add_fixed_in_frame_mobjects(note)
        self.play(FadeIn(note), run_time=0.6)
        self.wait(2.4)
