Moved more of animation cleanup handling to the animations themselves

This commit is contained in:
Grant Sanderson
2017-03-25 12:17:56 -07:00
parent 41b4483fd1
commit ff0c122d4d
4 changed files with 34 additions and 12 deletions

View File

@ -55,6 +55,12 @@ class Transform(Animation):
submob.interpolate(start, end, alpha, self.path_func)
return self
def clean_up(self, surrounding_scene = None):
Animation.clean_up(self, surrounding_scene)
if self.replace_mobject_with_target_in_scene and surrounding_scene is not None:
surrounding_scene.remove(self.mobject)
surrounding_scene.add(self.original_target_mobject)
class ReplacementTransform(Transform):
CONFIG = {
"replace_mobject_with_target_in_scene" : True,
@ -147,7 +153,8 @@ class FadeOut(Transform):
target.set_fill(opacity = 0)
Transform.__init__(self, mobject, target, **kwargs)
def clean_up(self):
def clean_up(self, surrounding_scene = None):
Transform.clean_up(self, surrounding_scene)
self.update(0)
class FadeIn(Transform):