Repository: ManimCommunity/manim
File: manim/mobject/value_tracker.py (Python)

Code before:
                pointer.add_updater(
                    lambda m: m.next_to(
                                number_line.n2p(pointer_value.get_value()),
                                UP
                            )
                )
                self.add(number_line, pointer,label)
                pointer_value += 1.5
                self.wait(1)
                pointer_value -= 4
                self.wait(0.5)
                self.play(pointer_value.animate.set_value(5)),
                self.wait(0.5)
                self.play(pointer_value.animate.set_value(3))
                self.play(pointer_value.animate.increment_value(-2))
                self.wait(0.5)
    """

    def __init__(self, value=0, **kwargs):
        Mobject.__init__(self, **kwargs)
        self.points = np.zeros((1, 3))
        self.set_value(value)

    def get_value(self) -> float:
        """Get the current value of the ValueTracker. This value changes continuously
        when :attr:`animate` for the ValueTracker is called."""
        return self.points[0, 0]

    def set_value(self, value: Union[float, int]):
        """Sets a new scalar value to the ValueTracker"""
        self.points[0, 0] = value
        return self

    def increment_value(self, d_value: Union[float, int]):
        """Increments (adds) a scalar value  to the ValueTracker"""
        self.set_value(self.get_value() + d_value)
        return self

    def __bool__(self):
        """Allows ValueTracker to be tested directly in boolean expressions. True if the value of the ValueTracker is nonzero."""
        return bool(self.get_value())

    def __iadd__(self, d_value: Union[float, int]):
        """adds ``+=`` syntax to increment the value of the ValueTracker"""
        self.increment_value(d_value)
        return self

    def __ifloordiv__(self, d_value: Union[float, int]):
        """adds ``//=`` syntax to floor divide the value of the ValueTracker"""
        self.set_value(self.get_value() // d_value)
        return self

Review comment (suggestion):
The short summaries should be a line on their own. Also: while the second part of the docstring is true (assuming you know how to call `.animate` for value trackers), I am not sure it is actually helpful at that point.

(It is certainly useful information for the ValueTracker in general, and I think I would like to see a specific paragraph stating something along the lines of "A change of the value of a ValueTracker can be animated by `my_tracker.animate.set_value(...)`" in the class docstring of ValueTracker, but I'm not convinced the information is useful in the documentation of `get_value`.)

```suggestion
        """Get the current value of this value tracker. 
        
        The value changes continuously when :attr:`animate`
        for the ValueTracker is called."""
```

Code after:

                tracker = ValueTracker(0)
                pointer.add_updater(
                    lambda m: m.next_to(
                                number_line.n2p(tracker.get_value()),
                                UP
                            )
                )
                self.add(number_line, pointer,label)
                tracker += 1.5
                self.wait(1)
                tracker -= 4
                self.wait(0.5)
                self.play(tracker.animate.set_value(5)),
                self.wait(0.5)
                self.play(tracker.animate.set_value(3))
                self.play(tracker.animate.increment_value(-2))
                self.wait(0.5)

    .. note::

        You can also link ValueTrackers to updaters. In this case, you have to make sure that the
        ValueTracker is added to the scene by ``add``

    .. manim:: ValueTrackerExample

        class ValueTrackerExample(Scene):
            def construct(self):
                tracker = ValueTracker(0)
                label = Dot(radius=3).add_updater(lambda x : x.set_x(tracker.get_value()))
                self.add(label)
                self.add(tracker)
                tracker.add_updater(lambda mobject, dt: mobject.increment_value(dt))
                self.wait(2)

    """

    def __init__(self, value=0, **kwargs):
        Mobject.__init__(self, **kwargs)
        self.points = np.zeros((1, 3))
        self.set_value(value)

    def get_value(self) -> float:
        """Get the current value of this ValueTracker."""
        return self.points[0, 0]

    def set_value(self, value: float):
        """Sets a new scalar value to the ValueTracker"""
        self.points[0, 0] = value
        return self