Skip to content

Commit c4a7208

Browse files
Handle user-defined centers for Wiggle animation (#2648)
* Handle user-defined centers for Wiggle animation * Add unit tests for wiggle attributes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent f43f543 commit c4a7208

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

manim/animation/indication.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,10 +535,12 @@ def __init__(
535535
def get_scale_about_point(self) -> np.ndarray:
536536
if self.scale_about_point is None:
537537
return self.mobject.get_center()
538+
return self.scale_about_point
538539

539540
def get_rotate_about_point(self) -> np.ndarray:
540541
if self.rotate_about_point is None:
541542
return self.mobject.get_center()
543+
return self.rotate_about_point
542544

543545
def interpolate_submobject(
544546
self,

tests/test_graphical_units/test_indication.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,14 @@ def test_Wiggle(scene):
6161
square = Square()
6262
scene.add(square)
6363
scene.play(Wiggle(square))
64+
65+
66+
def test_Wiggle_custom_about_points():
67+
square = Square()
68+
wiggle = Wiggle(
69+
square,
70+
scale_about_point=[1.0, 2.0, 3.0],
71+
rotate_about_point=[4.0, 5.0, 6.0],
72+
)
73+
assert wiggle.get_scale_about_point() == [1.0, 2.0, 3.0]
74+
assert wiggle.get_rotate_about_point() == [4.0, 5.0, 6.0]

0 commit comments

Comments
 (0)