mirror of
https://github.com/3b1b/manim.git
synced 2025-07-31 14:03:59 +08:00
Finished Tau Poem
This commit is contained in:
@ -68,9 +68,9 @@ class Animation(object):
|
||||
|
||||
def update(self, alpha):
|
||||
if alpha < 0:
|
||||
alpha = 0
|
||||
alpha = 0.0
|
||||
if alpha > 1:
|
||||
alpha = 1
|
||||
alpha = 1.0
|
||||
self.update_mobject(self.alpha_func(alpha))
|
||||
|
||||
def filter_out(self, *filter_functions):
|
||||
@ -111,5 +111,40 @@ class Animation(object):
|
||||
self.update(1)
|
||||
|
||||
|
||||
class Succession(Animation):
|
||||
def __init__(self, *animations, **kwargs):
|
||||
if "run_time" in kwargs:
|
||||
run_time = kwargs.pop("run_time")
|
||||
else:
|
||||
run_time = sum([anim.run_time for anim in animations])
|
||||
self.num_anims = len(animations)
|
||||
self.anims = animations
|
||||
mobject = animations[0].mobject
|
||||
Animation.__init__(self, mobject, run_time = run_time, **kwargs)
|
||||
|
||||
def __str__(self):
|
||||
return self.__class__.__name__ + \
|
||||
"".join(map(str, self.anims))
|
||||
|
||||
def update(self, alpha):
|
||||
scaled_alpha = alpha*self.num_anims
|
||||
self.mobject = self.anims
|
||||
for index in range(len(self.anims)):
|
||||
self.anims[index].update(scaled_alpha - index)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user