from manim import *
class Arrow3DStyle(ThreeDScene):
    """3.3 Arrow3D 在 Line3D 基础上加了锥形的箭头尖。
    thickness 是杆身粗细，height 是尖部高度，base_radius 是尖部底面半径。
    """
    def construct(self):
        self.set_camera_orientation(phi=65 * DEGREES, theta=-50 * DEGREES)
        title = Text("Arrow3D 的方向与样式", font="STLiti", font_size=32).to_edge(UP)
        self.add_fixed_in_frame_mobjects(title)
        axes = ThreeDAxes(x_range=[-3, 3, 1], y_range=[-3, 3, 1],
                          z_range=[-3, 3, 1], x_length=6, y_length=6, z_length=5)
        arrow = Arrow3D(start=[-1, -1, -2], end=[1, 2, 2],
                        thickness=0.05, height=0.3, base_radius=0.12,
                        color=GREEN)
        legend = VGroup(
            Text("thickness=0.05  杆身粗细", font="STLiti", font_size=21, color=GREEN),
            Text("height=0.3  箭头尖高度", font="STLiti", font_size=21, color=GREEN),
            Text("base_radius=0.12  尖部底半径", font="STLiti", font_size=21, color=GREEN),
        ).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(axes), run_time=1.2)
        self.play(FadeIn(arrow), run_time=1.4)
        self.play(FadeIn(legend), run_time=0.8)
        note = Text("start / end 都是三维坐标，箭头方向由两者决定",
                    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.6)
