A community-maintained Python framework for creating mathematical animations.
Add docstrings for `ChangingDecimal` and `ChangeDecimalToValue` (#4346)
gui martins83d430118444
diff --git a/manim/animation/numbers.py b/manim/animation/numbers.pyindex 05126fd91..07f21c8db 100644--- a/manim/animation/numbers.py+++ b/manim/animation/numbers.py@@ -16,6 +16,41 @@ from ..utils.bezier import interpolateclass ChangingDecimal(Animation):+ """Animate a :class:`~.DecimalNumber` to values specified by a user-supplied function.++ Parameters+ ----------+ decimal_mob+ The :class:`~.DecimalNumber` instance to animate.+ number_update_func+ A function that returns the number to display at each point in the animation.+ suspend_mobject_updating+ If ``True``, the mobject is not updated outside this animation.++ Raises+ ------+ TypeError+ If ``decimal_mob`` is not an instance of :class:`~.DecimalNumber`.++ Examples+ --------++ .. manim:: ChangingDecimalExample++ class ChangingDecimalExample(Scene):+ def construct(self):+ number = DecimalNumber(0)+ self.add(number)+ self.play(+ ChangingDecimal(+ number,+ lambda a: 5 * a,+ run_time=3+ )+ )+ self.wait()+ """+def __init__(self,decimal_mob: DecimalNumber,@@ -38,6 +73,28 @@ class ChangingDecimal(Animation):class ChangeDecimalToValue(ChangingDecimal):+ """Animate a :class:`~.DecimalNumber` to a target value using linear interpolation.++ Parameters+ ----------+ decimal_mob+ The :class:`~.DecimalNumber` instance to animate.+ target_number+ The target value to transition to.++ Examples+ --------++ .. manim:: ChangeDecimalToValueExample++ class ChangeDecimalToValueExample(Scene):+ def construct(self):+ number = DecimalNumber(0)+ self.add(number)+ self.play(ChangeDecimalToValue(number, 10, run_time=3))+ self.wait()+ """+def __init__(self, decimal_mob: DecimalNumber, target_number: int, **kwargs: Any) -> None: