Have Animation keep track of whether a mobject had had it's updating suspended before resuming it at the end

This commit is contained in:
Grant Sanderson 2023-11-06 12:31:16 -05:00
parent 916ab94efd
commit f4778b57ef

View file

@ -74,6 +74,7 @@ class Animation(object):
# It is, however, okay and desirable to call # It is, however, okay and desirable to call
# the internal updaters of self.starting_mobject, # the internal updaters of self.starting_mobject,
# or any others among self.get_all_mobjects() # or any others among self.get_all_mobjects()
self.mobject_was_updating = not self.mobject.updating_suspended
self.mobject.suspend_updating() self.mobject.suspend_updating()
self.families = list(self.get_all_families_zipped()) self.families = list(self.get_all_families_zipped())
self.interpolate(0) self.interpolate(0)
@ -81,7 +82,7 @@ class Animation(object):
def finish(self) -> None: def finish(self) -> None:
self.interpolate(self.final_alpha_value) self.interpolate(self.final_alpha_value)
self.mobject.set_animating_status(False) self.mobject.set_animating_status(False)
if self.suspend_mobject_updating: if self.suspend_mobject_updating and self.mobject_was_updating:
self.mobject.resume_updating() self.mobject.resume_updating()
def clean_up_from_scene(self, scene: Scene) -> None: def clean_up_from_scene(self, scene: Scene) -> None: