from manim import *
class NumberLineTips(Scene):
    """3.2 include_tip 打开箭头，tip_shape 接收 ArrowTip 的「类」而不是实例。
    tip_width / tip_height 控制箭头大小，默认 tip_shape=None 用三角箭头。
    """
    def construct(self):
        title = Text("include_tip 与 5 种 tip_shape", font="STLiti", font_size=32).to_edge(UP)
        specs = [
            ("默认三角", None),
            ("ArrowCircleTip 空心圆", ArrowCircleTip),
            ("ArrowCircleFilledTip 实心圆", ArrowCircleFilledTip),
            ("ArrowSquareTip 方头", ArrowSquareTip),
            ("StealthTip 隐形式", StealthTip),
        ]
        rows = VGroup()
        for name, shape in specs:
            kw = dict(x_range=[-5, 6], length=6, include_tip=True,
                      tip_width=0.18, tip_height=0.18, include_numbers=False)
            if shape is not None:
                kw["tip_shape"] = shape
            line = NumberLine(**kw)
            cap = Text(name, font="STLiti", font_size=19, color=YELLOW)
            rows.add(VGroup(cap, line).arrange(RIGHT, buff=0.35))
        rows.arrange(DOWN, buff=0.5).shift(DOWN * 0.3)
        self.play(FadeIn(title), run_time=0.6)
        self.play(LaggedStart(*[FadeIn(x) for x in rows],
                              lag_ratio=0.18, run_time=2.2))
        note = Text("tip_shape 传类本身，箭头尺寸用 tip_width / tip_height",
                    font="STLiti", font_size=20, color=GREY).to_edge(DOWN)
        self.play(FadeIn(note), run_time=0.6)
        self.wait(3.0)
