ChangingDecimal¶
Qualified name: manim.animation.numbers.ChangingDecimal
- class ChangingDecimal(mobject=None, *args, use_override=True, **kwargs)[source]¶
Bases:
AnimationAnimate a
DecimalNumberto values specified by a user-supplied function.- Parameters:
decimal_mob (DecimalNumber) – The
DecimalNumberinstance to animate.number_update_func (Callable[[float], float]) – A function that returns the number to display at each point in the animation.
suspend_mobject_updating (bool) – If
True, the mobject is not updated outside this animation.kwargs (Any)
- Raises:
TypeError – If
decimal_mobis not an instance ofDecimalNumber.
Examples
Example: ChangingDecimalExample ¶
from manim import * 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()
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()Methods
check_validity_of_inputInterpolates the mobject of the
Animationbased on alpha value.Attributes
run_time- _original__init__(decimal_mob, number_update_func, suspend_mobject_updating=False, **kwargs)¶
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
decimal_mob (DecimalNumber)
number_update_func (Callable[[float], float])
suspend_mobject_updating (bool)
kwargs (Any)
- Return type:
None
- interpolate_mobject(alpha)[source]¶
Interpolates the mobject of the
Animationbased on alpha value.- Parameters:
alpha (float) – A float between 0 and 1 expressing the ratio to which the animation is completed. For example, alpha-values of 0, 0.5, and 1 correspond to the animation being completed 0%, 50%, and 100%, respectively.
- Return type:
None