Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Added ApplyPointwiseFunctionToCenter

Grant Sanderson153799a4e33c
diff --git a/animation/transform.py b/animation/transform.py
index 83e564624..3da8eeff0 100644
--- a/animation/transform.py
+++ b/animation/transform.py
@@ -140,6 +140,13 @@ class ApplyPointwiseFunction(ApplyMethod):
)
+class ApplyPointwiseFunctionToCenter(ApplyPointwiseFunction):
+ def __init__(self, function, mobject, **kwargs):
+ ApplyMethod.__init__(
+ self, mobject.move_to, function(mobject.get_center()), **kwargs
+ )
+
+
class FadeToColor(ApplyMethod):
def __init__(self, mobject, color, **kwargs):
ApplyMethod.__init__(self, mobject.set_color, color, **kwargs)