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

Code before:
            def construct(self):
                number_line = NumberLine()
                pointer = Vector(DOWN)
                label = MathTex("x").add_updater(lambda m: m.next_to(pointer, UP))

                pointer_tracker = ValueTracker(0)
                pointer.add_updater(
                    lambda m: m.next_to(
                                number_line.n2p(pointer_tracker.get_value()),
                                UP
                            )
                )
                self.add(number_line, pointer,label)
                pointer_tracker += 1.5
                self.wait(1)
                pointer_tracker -= 4
                self.wait(0.5)
                self.play(pointer_tracker.animate.set_value(5)),
                self.wait(0.5)
                self.play(pointer_tracker.animate.set_value(3))
                self.play(pointer_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 ``ad``

    .. manim:: ValueTrackerExample

        class ValueTrackerExample(Scene):
            def construct(self):
                pointer_tracker = ValueTracker(0)
                label = Dot(radius=3).add_updater(lambda x : x.set_x(pointer_tracker.get_value()))
                self.add(label)
                self.add(pointer_tracker)
                pointer_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 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"""

Review comment (suggestion):
```suggestion
        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``
```

Code after:
            def construct(self):
                number_line = NumberLine()
                pointer = Vector(DOWN)
                label = MathTex("x").add_updater(lambda m: m.next_to(pointer, UP))

                pointer_tracker = ValueTracker(0)
                pointer.add_updater(
                    lambda m: m.next_to(
                                number_line.n2p(pointer_tracker.get_value()),
                                UP
                            )
                )
                self.add(number_line, pointer,label)
                pointer_tracker += 1.5
                self.wait(1)
                pointer_tracker -= 4
                self.wait(0.5)
                self.play(pointer_tracker.animate.set_value(5)),
                self.wait(0.5)
                self.play(pointer_tracker.animate.set_value(3))
                self.play(pointer_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):
                pointer_tracker = ValueTracker(0)
                label = Dot(radius=3).add_updater(lambda x : x.set_x(pointer_tracker.get_value()))
                self.add(label)
                self.add(pointer_tracker)
                pointer_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 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"""