Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Deprecated redundant methods of Mobject (#2024)

icedcoffeeee268da5045a76
diff --git a/docs/source/examples.rst b/docs/source/examples.rst
index 9ee5aa41b..2172c522f 100644
--- a/docs/source/examples.rst
+++ b/docs/source/examples.rst
@@ -591,7 +591,7 @@ Special Camera Settings
u_range=[-2, +2]
)
- gauss_plane.scale_about_point(2, ORIGIN)
+ gauss_plane.scale(2, about_point=ORIGIN)
gauss_plane.set_style(fill_opacity=1,stroke_color=GREEN)
gauss_plane.set_fill_by_checkerboard(ORANGE, BLUE, opacity=0.5)
axes = ThreeDAxes()
diff --git a/manim/animation/indication.py b/manim/animation/indication.py
index 5de30a048..bc8db19dd 100644
--- a/manim/animation/indication.py
+++ b/manim/animation/indication.py
@@ -160,7 +160,7 @@ class Indicate(Transform):
def create_target(self) -> "Mobject":
target = self.mobject.copy()
- target.scale_in_place(self.scale_factor)
+ target.scale(self.scale_factor)
target.set_color(self.color)
return target
diff --git a/manim/mobject/coordinate_systems.py b/manim/mobject/coordinate_systems.py
index 5dd071e7f..cf6c814ab 100644
--- a/manim/mobject/coordinate_systems.py
+++ b/manim/mobject/coordinate_systems.py
@@ -1344,7 +1344,7 @@ class CoordinateSystem:
if include_secant_line:
group.secant_line = Line(p1, p2, color=secant_line_color)
- group.secant_line.scale_in_place(
+ group.secant_line.scale(
secant_line_length / group.secant_line.get_length(),
)
group.add(group.secant_line)
diff --git a/manim/mobject/mobject.py b/manim/mobject/mobject.py
index a49b0d747..c949793eb 100644
--- a/manim/mobject/mobject.py
+++ b/manim/mobject/mobject.py
@@ -1268,14 +1268,29 @@ class Mobject:
mob.points += about_point
return self
+ @deprecated(
+ since="v0.11.0",
+ until="v0.12.0",
+ replacement="rotate",
+ )
def rotate_in_place(self, angle, axis=OUT):
# redundant with default behavior of rotate now.
return self.rotate(angle, axis=axis)
+ @deprecated(
+ since="v0.11.0",
+ until="v0.12.0",
+ replacement="scale",
+ )
def scale_in_place(self, scale_factor, **kwargs):
# Redundant with default behavior of scale now.
return self.scale(scale_factor, **kwargs)
+ @deprecated(
+ since="v0.11.0",
+ until="v0.12.0",
+ replacement="scale",
+ )
def scale_about_point(self, scale_factor, point):
# Redundant with default behavior of scale now.
return self.scale(scale_factor, about_point=point)
@@ -1385,6 +1400,11 @@ class Mobject:
def stretch_about_point(self, factor, dim, point):
return self.stretch(factor, dim, about_point=point)
+ @deprecated(
+ since="v0.11.0",
+ until="v0.12.0",
+ replacement="stretch",
+ )
def stretch_in_place(self, factor, dim):
# Now redundant with stretch
return self.stretch(factor, dim)
@@ -1577,7 +1597,7 @@ class Mobject:
):
self.replace(mobject, dim_to_match, stretch)
length = mobject.length_over_dim(dim_to_match)
- self.scale_in_place((length + buff) / length)
+ self.scale((length + buff) / length)
return self
def put_start_and_end_on(self, start, end):
diff --git a/manim/mobject/svg/opengl_text_mobject.py b/manim/mobject/svg/opengl_text_mobject.py
index aace5b26e..2e5f41d7b 100644
--- a/manim/mobject/svg/opengl_text_mobject.py
+++ b/manim/mobject/svg/opengl_text_mobject.py
@@ -20,7 +20,7 @@ Examples
class TextAlignment(Scene):
def construct(self):
title = Text("K-means clustering and Logistic Regression", color=WHITE)
- title.scale_in_place(0.75)
+ title.scale(0.75)
self.add(title.to_edge(UP))
t1 = Text("1. Measuring").set_color(WHITE)
@@ -35,7 +35,7 @@ Examples
t4 = Text("4. Prediction").set_color(WHITE)
t4.next_to(t3, direction=DOWN, aligned_edge=LEFT)
- x = VGroup(t1, t2, t3, t4).scale_in_place(0.7)
+ x = VGroup(t1, t2, t3, t4).scale(0.7)
x.set_opacity(0.5)
x.submobjects[1].set_opacity(1)
self.add(x)
diff --git a/manim/mobject/svg/text_mobject.py b/manim/mobject/svg/text_mobject.py
index e36765680..df2dd7705 100644
--- a/manim/mobject/svg/text_mobject.py
+++ b/manim/mobject/svg/text_mobject.py
@@ -29,7 +29,7 @@ Examples
class TextAlignment(Scene):
def construct(self):
title = Text("K-means clustering and Logistic Regression", color=WHITE)
- title.scale_in_place(0.75)
+ title.scale(0.75)
self.add(title.to_edge(UP))
t1 = Text("1. Measuring").set_color(WHITE)
@@ -40,7 +40,7 @@ Examples
t4 = Text("4. Prediction").set_color(WHITE)
- x = VGroup(t1, t2, t3, t4).arrange(direction=DOWN, aligned_edge=LEFT).scale_in_place(0.7).next_to(ORIGIN,DR)
+ x = VGroup(t1, t2, t3, t4).arrange(direction=DOWN, aligned_edge=LEFT).scale(0.7).next_to(ORIGIN,DR)
x.set_opacity(0.5)
x.submobjects[1].set_opacity(1)
self.add(x)
diff --git a/manim/scene/vector_space_scene.py b/manim/scene/vector_space_scene.py
index b4b6efb84..6de9654df 100644
--- a/manim/scene/vector_space_scene.py
+++ b/manim/scene/vector_space_scene.py
@@ -1006,7 +1006,7 @@ class LinearTransformationScene(VectorScene):
v.target = Vector(func(v.get_end()), color=v.get_color())
norm = np.linalg.norm(v.target.get_end())
if norm < 0.1:
- v.target.get_tip().scale_in_place(norm)
+ v.target.get_tip().scale(norm)
return self.get_piece_movement(self.moving_vectors)
def get_transformable_label_movement(self):