mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Restrict alpha in CountInFrom
This commit is contained in:
parent
9432a73a9f
commit
2e9c89502d
1 changed files with 3 additions and 2 deletions
|
@ -3,6 +3,7 @@ from __future__ import annotations
|
||||||
from manimlib.animation.animation import Animation
|
from manimlib.animation.animation import Animation
|
||||||
from manimlib.mobject.numbers import DecimalNumber
|
from manimlib.mobject.numbers import DecimalNumber
|
||||||
from manimlib.utils.bezier import interpolate
|
from manimlib.utils.bezier import interpolate
|
||||||
|
from manimlib.utils.simple_functions import clip
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
@ -55,9 +56,9 @@ class CountInFrom(ChangingDecimal):
|
||||||
source_number: float | complex = 0,
|
source_number: float | complex = 0,
|
||||||
**kwargs
|
**kwargs
|
||||||
):
|
):
|
||||||
start_number = decimal_mob.number
|
start_number = decimal_mob.get_value()
|
||||||
super().__init__(
|
super().__init__(
|
||||||
decimal_mob,
|
decimal_mob,
|
||||||
lambda a: interpolate(source_number, start_number, a),
|
lambda a: interpolate(source_number, start_number, clip(a, 0, 1)),
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue