From 2e9c89502d8ec2fc613bafdbc5f5341f8430afb1 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Thu, 7 Mar 2024 08:39:45 -0300 Subject: [PATCH] Restrict alpha in CountInFrom --- manimlib/animation/numbers.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/manimlib/animation/numbers.py b/manimlib/animation/numbers.py index 04db6188..c516b2e9 100644 --- a/manimlib/animation/numbers.py +++ b/manimlib/animation/numbers.py @@ -3,6 +3,7 @@ from __future__ import annotations from manimlib.animation.animation import Animation from manimlib.mobject.numbers import DecimalNumber from manimlib.utils.bezier import interpolate +from manimlib.utils.simple_functions import clip from typing import TYPE_CHECKING @@ -55,9 +56,9 @@ class CountInFrom(ChangingDecimal): source_number: float | complex = 0, **kwargs ): - start_number = decimal_mob.number + start_number = decimal_mob.get_value() super().__init__( decimal_mob, - lambda a: interpolate(source_number, start_number, a), + lambda a: interpolate(source_number, start_number, clip(a, 0, 1)), **kwargs )