Repository: ManimCommunity/manim
File: manim/animation/changing.py (Python)

Code before:
        class DissipatingPathExample(Scene):
            def construct(self):
                a = Dot(RIGHT * 2)
                b = TracedPath(a.get_center, dissipating_time=0.5, stroke_opacity=[0, 1])
                self.add(a, b)
                self.play(a.animate(path_arc=PI / 4).shift(LEFT * 2))
                self.play(a.animate(path_arc=-PI / 4).shift(LEFT * 2))
                self.wait()

    """

    def __init__(
        self,
        traced_point_func: Callable,
        stroke_width: float = 2,
        stroke_color: ParsableManimColor | None = WHITE,
        dissipating_time: float | None = None,
        **kwargs: Any,
    ) -> None:
        super().__init__(stroke_color=stroke_color, stroke_width=stroke_width, **kwargs)
        self.traced_point_func = traced_point_func
        self.dissipating_time = dissipating_time
        self.time: float | None = 1 if self.dissipating_time else None
        self.add_updater(self.update_path)

    def update_path(self, mob: Any, dt: float) -> None:
        new_point = self.traced_point_func()
        if not self.has_points():
            self.start_new_path(new_point)
        self.add_line_to(new_point)
        if self.dissipating_time:
            assert isinstance(self.time, float)
            self.time += dt
            if self.time - 1 > self.dissipating_time:
                nppcc = self.n_points_per_curve
                self.set_points(self.points[nppcc:])


Review comment (suggestion):
Although `mob` is, for some reason, not being used anywhere in this method and thus can technically be anything, `TracedPath.update_path()` is a `Mobject` updater which is being used as such in `TracedPath.__init__()`:
```py
self.add_updater(self.update_path)
```

Therefore, `mob` should be typed as `Mobject` anyways.
```suggestion
    def update_path(self, mob: Mobject, dt: float) -> None:
```

Code after:
    .. manim:: DissipatingPathExample

        class DissipatingPathExample(Scene):
            def construct(self):
                a = Dot(RIGHT * 2)
                b = TracedPath(a.get_center, dissipating_time=0.5, stroke_opacity=[0, 1])
                self.add(a, b)
                self.play(a.animate(path_arc=PI / 4).shift(LEFT * 2))
                self.play(a.animate(path_arc=-PI / 4).shift(LEFT * 2))
                self.wait()

    """

    def __init__(
        self,
        traced_point_func: Callable,
        stroke_width: float = 2,
        stroke_color: ParsableManimColor | None = WHITE,
        dissipating_time: float | None = None,
        **kwargs: Any,
    ) -> None:
        super().__init__(stroke_color=stroke_color, stroke_width=stroke_width, **kwargs)
        self.traced_point_func = traced_point_func
        self.dissipating_time = dissipating_time
        self.time = 1.0 if self.dissipating_time else None
        self.add_updater(self.update_path)

    def update_path(self, mob: Mobject, dt: float) -> None:
        new_point = self.traced_point_func()
        if not self.has_points():
            self.start_new_path(new_point)
        self.add_line_to(new_point)
        if self.dissipating_time:
            assert self.time is not None
            self.time += dt
            if self.time - 1 > self.dissipating_time:
                nppcc = self.n_points_per_curve
                self.set_points(self.points[nppcc:])