Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Fixed bug where nested AnimationGroups did not propagate configs correctly

Sridhar Ramesh4982a44fb6e1
diff --git a/animation/simple_animations.py b/animation/simple_animations.py
index 77af467e6..47e16a0fb 100644
--- a/animation/simple_animations.py
+++ b/animation/simple_animations.py
@@ -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,