diff --git a/manimlib/animation/movement.py b/manimlib/animation/movement.py index 6e7d4428..5a2bac3b 100644 --- a/manimlib/animation/movement.py +++ b/manimlib/animation/movement.py @@ -1,5 +1,4 @@ from manimlib.animation.animation import Animation -from manimlib.constants import * from manimlib.utils.config_ops import digest_config from manimlib.utils.rate_functions import linear @@ -12,13 +11,14 @@ class Homotopy(Animation): def __init__(self, homotopy, mobject, **kwargs): """ - Homotopy a function from (x, y, z, t) to (x', y', z') + Homotopy is a function from + (x, y, z, t) to (x', y', z') """ - def function_at_time_t(t): - return lambda p: homotopy(p[0], p[1], p[2], t) - self.function_at_time_t = function_at_time_t - digest_config(self, kwargs) - Animation.__init__(self, mobject, **kwargs) + self.homotopy = homotopy + super().__init__(mobject, **kwargs) + + def function_at_time_t(self, t): + return lambda p: self.homotopy(*p, t) def interpolate_submobject(self, submob, start, alpha): submob.points = start.points @@ -49,11 +49,12 @@ class PhaseFlow(Animation): CONFIG = { "virtual_time": 1, "rate_func": linear, + "suspend_mobject_updating": False, } def __init__(self, function, mobject, **kwargs): - digest_config(self, kwargs, locals()) - Animation.__init__(self, mobject, **kwargs) + self.function = function + super().__init__(mobject, **kwargs) def interpolate_mobject(self, alpha): if hasattr(self, "last_alpha"): @@ -65,9 +66,13 @@ class PhaseFlow(Animation): class MoveAlongPath(Animation): + CONFIG = { + "suspend_mobject_updating": False, + } + def __init__(self, mobject, path, **kwargs): - digest_config(self, kwargs, locals()) - Animation.__init__(self, mobject, **kwargs) + self.path = path + super().__init__(mobject, **kwargs) def interpolate_mobject(self, alpha): point = self.path.point_from_proportion(alpha)