mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
Allow LaggedStart to accept an iterable as an argument
This commit is contained in:
parent
1372cf101c
commit
2380ffd616
1 changed files with 4 additions and 2 deletions
|
@ -13,7 +13,8 @@ from manimlib.utils.bezier import interpolate
|
|||
from manimlib.utils.iterables import remove_list_redundancies
|
||||
from manimlib.utils.simple_functions import clip
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, Union, Iterable
|
||||
AnimationType = Union[Animation, _AnimationBuilder]
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Callable, Optional
|
||||
|
@ -28,13 +29,14 @@ DEFAULT_LAGGED_START_LAG_RATIO = 0.05
|
|||
class AnimationGroup(Animation):
|
||||
def __init__(
|
||||
self,
|
||||
*animations: Animation | _AnimationBuilder,
|
||||
*args: AnimationType | Iterable[AnimationType],
|
||||
run_time: float = -1, # If negative, default to sum of inputed animation runtimes
|
||||
lag_ratio: float = 0.0,
|
||||
group: Optional[Mobject] = None,
|
||||
group_type: Optional[type] = None,
|
||||
**kwargs
|
||||
):
|
||||
animations = args[0] if isinstance(args[0], Iterable) else args
|
||||
self.animations = [prepare_animation(anim) for anim in animations]
|
||||
self.build_animations_with_timings(lag_ratio)
|
||||
self.max_end_time = max((awt[2] for awt in self.anims_with_timings), default=0)
|
||||
|
|
Loading…
Add table
Reference in a new issue