Finished Tau Poem

This commit is contained in:
Grant Sanderson
2015-06-27 04:49:10 -07:00
parent 1dc7a5421d
commit 400aa0aada
15 changed files with 872 additions and 110 deletions

View File

@ -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)