diff --git a/manimlib/animation/animation.py b/manimlib/animation/animation.py index ec49a226..b97255d4 100644 --- a/manimlib/animation/animation.py +++ b/manimlib/animation/animation.py @@ -17,6 +17,8 @@ class Animation(object): "name": None, # Does this animation add or remove a mobject form the screen "remover": False, + # What to enter into the update function upon completion + "final_alpha_value": 1, # If 0, the animation is applied to all submobjects # at the same time # If 1, it is applied to each successively. @@ -55,7 +57,7 @@ class Animation(object): self.interpolate(0) def finish(self): - self.interpolate(1) + self.interpolate(self.final_alpha_value) self.mobject.cleanup_from_animation() if self.suspend_mobject_updating: self.mobject.resume_updating() diff --git a/manimlib/animation/fading.py b/manimlib/animation/fading.py index 373d22a3..37a846ac 100644 --- a/manimlib/animation/fading.py +++ b/manimlib/animation/fading.py @@ -14,6 +14,8 @@ class FadeOut(Transform): CONFIG = { "remover": True, "lag_ratio": DEFAULT_FADE_LAG_RATIO, + # Put it back in original state when done + "final_alpha_value": 0, } def __init__(self, mobject, to_vect=ORIGIN, **kwargs): @@ -26,9 +28,9 @@ class FadeOut(Transform): result.shift(self.to_vect) return result - def clean_up_from_scene(self, scene=None): - super().clean_up_from_scene(scene) - self.interpolate(0) + # def clean_up_from_scene(self, scene=None): + # super().clean_up_from_scene(scene) + # self.interpolate(0) class FadeIn(Transform): @@ -113,7 +115,9 @@ class VFadeIn(Animation): class VFadeOut(VFadeIn): CONFIG = { - "remover": True + "remover": True, + # Put it back in original state when done + "final_alpha_value": 0, } def interpolate_submobject(self, submob, start, alpha): @@ -124,4 +128,6 @@ class VFadeInThenOut(VFadeIn): CONFIG = { "rate_func": there_and_back, "remover": True, + # Put it back in original state when done + "final_alpha_value": 0.5, }