Reputation: 1833
I'm just learning manim and I'm trying to play a bunch of animations that have overlapping start and end times.
Suppose T is the length of time it takes each FadeIn to play. What I want is for them to start and finish in a staggered manner, e.g. the first animation starts at 0, the second starts at T/10, the third at 2T/10, ... , the 10th starts at 9T/10, and then the first one finishes at T, the second finishes at 11T/10, the third finishes at 12T/10, ..., the 10th finishes at 19T/10.
I know how to play animations one after another or in parallel like this, but neither of these has staggered start times:
from manim import *
class FadeInAllAtOnce(Scene):
def construct(self):
circles = [Circle(r / 10) for r in range(10)]
anims = [FadeIn(c) for c in circles]
self.play(*anims)
class FadeInOneAfterAnother(Scene):
def construct(self):
circles = [Circle(r / 10) for r in range(10)]
anims = [FadeIn(c) for c in circles]
for anim in anims:
self.play(anim)
Upvotes: 7
Views: 2308
Reputation: 1833
I found a probably-good-enough solution, LaggedStart (little documentation), which will play a bunch of animations one after another with a configurable lag given by the lag_ratio (default = .05) parameter.
from manim import *
class FadeInStaggeredMap(Scene):
def construct(self):
circles = [Circle(r / 10) for r in range(10)]
anims = [FadeIn(c) for c in circles]
self.play(LaggedStart(*anims))
Upvotes: 4