diff --git a/manim/animation/composition.py b/manim/animation/composition.py index 82488425f8..9af4be48c2 100644 --- a/manim/animation/composition.py +++ b/manim/animation/composition.py @@ -33,7 +33,7 @@ class AnimationGroup(Animation): Parameters ---------- animations - Sequence of :class:`~.Animation` objects to be played. + The animations to be played. Should be passed as individual arguments. group A group of multiple :class:`~.Mobject`. run_time @@ -42,13 +42,18 @@ class AnimationGroup(Animation): The function defining the animation progress based on the relative runtime (see :mod:`~.rate_functions`) . lag_ratio - Defines the delay after which the animation is applied to submobjects. A lag_ratio of - ``n.nn`` means the next animation will play when ``nnn%`` of the current animation has played. - Defaults to 0.0, meaning that all animations will be played together. + Defines the delay after which each subsequent animation begins, relative to the previous animation's duration. - This does not influence the total runtime of the animation. Instead the runtime - of individual animations is adjusted so that the complete animation has the defined - run time. + Example: With `lag_ratio=0.5`, animation 2 starts when animation 1 is 50% complete, + animation 3 starts when animation 2 is 50% complete, and so on. + + This is analogous to how `lag_ratio` works for submobjects in other Manim animations. + (e.g., `self.play(animation, lag_ratio=x)`): + - `lag_ratio=0.0` (default): All animations play together (parallel) + - `lag_ratio=1.0`: Animations play sequentially (current submobject's animation finishes before next starts) + + Note: The total runtime (`run_time`) is preserved. Each individual animation's run_time is scaled + to fit the user-provided `run_time` duration, with overlaps determined by the `lag_ratio`. """ def __init__( diff --git a/manim/animation/creation.py b/manim/animation/creation.py index f79b6ec197..5781a20236 100644 --- a/manim/animation/creation.py +++ b/manim/animation/creation.py @@ -125,8 +125,8 @@ def __init__( def interpolate_submobject( self, - submobject: Mobject, - starting_submobject: Mobject, + submobject: VMobject | OpenGLVMobject | OpenGLSurface, + starting_submobject: VMobject | OpenGLVMobject | OpenGLSurface, alpha: float, ) -> None: submobject.pointwise_become_partial( diff --git a/manim/animation/indication.py b/manim/animation/indication.py index 98694af726..123bf13811 100644 --- a/manim/animation/indication.py +++ b/manim/animation/indication.py @@ -132,11 +132,11 @@ class Indicate(Transform): scale_factor The factor by which the mobject will be temporally scaled color - The color the mobject temporally takes. + The color the mobject temporarily takes. rate_func The function defining the animation progress at every point in time. kwargs - Additional arguments to be passed to the :class:`~.Succession` constructor + Additional arguments to be passed to the :class:`~.Transform` initializer. Examples -------- @@ -190,7 +190,7 @@ class Flash(AnimationGroup): run_time The duration of the animation. kwargs - Additional arguments to be passed to the :class:`~.Succession` constructor + Additional arguments to be passed to the :class:`~.ShowPassingFlash` initializer. Examples -------- @@ -232,7 +232,7 @@ def __init__( **kwargs: Any, ): if isinstance(point, Mobject): - self.point: Point3D = point.get_center() + self.point = point.get_center() else: self.point = np.asarray(point) self.color = color @@ -279,7 +279,8 @@ class ShowPassingFlash(ShowPartial): mobject The mobject whose stroke is animated. time_width - The length of the sliver relative to the length of the stroke. + The fraction of the stroke length that is visible at any given moment. + For example, a value of ``0.1`` means only 10% of the stroke is visible at any moment of time. Examples --------