From 426fb33b94c159e5ec76e1a0f28ae1ff2e0fce03 Mon Sep 17 00:00:00 2001 From: Sridhar Ramesh Date: Mon, 29 Jan 2018 18:12:51 -0800 Subject: [PATCH] Small improvements --- animation/simple_animations.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/animation/simple_animations.py b/animation/simple_animations.py index 94dad47d..268b7792 100644 --- a/animation/simple_animations.py +++ b/animation/simple_animations.py @@ -403,12 +403,17 @@ class Succession(Animation): for anim in animations: anim.update(0) + animations = filter (lambda x : x.run_time != 0, animations) + self.run_times = [anim.run_time for anim in animations] if "run_time" in kwargs: run_time = kwargs.pop("run_time") else: run_time = sum(self.run_times) - self.num_anims = len(animations) #TODO: If this is zero, some special handling below + self.num_anims = len(animations) + if self.num_anims == 0: + # TODO: Handle this; it should be easy enough, but requires some special cases below + print "Warning! Successions with zero animations are not currently handled!" self.animations = animations #Have to keep track of this run_time, because Scene.play #might very well mess with it. @@ -429,10 +434,8 @@ class Succession(Animation): self.current_alpha = 0 self.current_anim_index = 0 #TODO: What if self.num_anims == 0? - - self.mobject = Group() - self.current_anim_index = 0 - self.current_alpha = 0 + self.mobject = self.scene_mobjects_at_time[0] + self.mobject.add(self.animations[0].mobject) Animation.__init__(self, self.mobject, run_time = run_time, **kwargs)