Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Handle user-defined centers for Wiggle animation (#2648)

David Millardc4a72083f9cf
diff --git a/manim/animation/indication.py b/manim/animation/indication.py
index 55bf6b409..53f8b8ad6 100644
--- a/manim/animation/indication.py
+++ b/manim/animation/indication.py
@@ -535,10 +535,12 @@ class Wiggle(Animation):
def get_scale_about_point(self) -> np.ndarray:
if self.scale_about_point is None:
return self.mobject.get_center()
+ return self.scale_about_point
def get_rotate_about_point(self) -> np.ndarray:
if self.rotate_about_point is None:
return self.mobject.get_center()
+ return self.rotate_about_point
def interpolate_submobject(
self,
diff --git a/tests/test_graphical_units/test_indication.py b/tests/test_graphical_units/test_indication.py
index f134f4e9c..47db2e49a 100644
--- a/tests/test_graphical_units/test_indication.py
+++ b/tests/test_graphical_units/test_indication.py
@@ -61,3 +61,14 @@ def test_Wiggle(scene):
square = Square()
scene.add(square)
scene.play(Wiggle(square))
+
+
+def test_Wiggle_custom_about_points():
+ square = Square()
+ wiggle = Wiggle(
+ square,
+ scale_about_point=[1.0, 2.0, 3.0],
+ rotate_about_point=[4.0, 5.0, 6.0],
+ )
+ assert wiggle.get_scale_about_point() == [1.0, 2.0, 3.0]
+ assert wiggle.get_rotate_about_point() == [4.0, 5.0, 6.0]