Fixed bug where nested AnimationGroups did not propagate configs correctly

This commit is contained in:
Sridhar Ramesh
2018-02-20 09:42:43 -08:00
parent d509335210
commit 4982a44fb6

View File

@ -491,16 +491,14 @@ class AnimationGroup(Animation):
"rate_func" : None
}
def __init__(self, *sub_anims, **kwargs):
digest_config(self, kwargs, locals())
sub_anims = filter (lambda x : not(x.empty), sub_anims)
digest_config(self, locals())
self.update_config(**kwargs) # Handles propagation to self.sub_anims
if len(sub_anims) == 0:
self.empty = True
self.run_time = 0
else:
for anim in sub_anims:
# If AnimationGroup is called with any configuration,
# it is propagated to the sub_animations
anim.update_config(**kwargs)
self.run_time = max([a.run_time for a in sub_anims])
everything = Mobject(*[a.mobject for a in sub_anims])
Animation.__init__(self, everything, **kwargs)
@ -513,6 +511,14 @@ class AnimationGroup(Animation):
for anim in self.sub_anims:
anim.clean_up(*args, **kwargs)
def update_config(self, **kwargs):
Animation.update_config(self, **kwargs)
# If AnimationGroup is called with any configuration,
# it is propagated to the sub_animations
for anim in self.sub_anims:
anim.update_config(**kwargs)
class EmptyAnimation(Animation):
CONFIG = {
"run_time" : 0,