Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Remove deprecations up to `v0.12.0` (#2331)

Laith Bahodi45e8b10fd9cf
diff --git a/docs/source/reference.rst b/docs/source/reference.rst
index aa16564a6..cf9e9b989 100644
--- a/docs/source/reference.rst
+++ b/docs/source/reference.rst
@@ -85,8 +85,6 @@ Scenes
.. inheritance-diagram::
manim.scene.moving_camera_scene
- manim.scene.reconfigurable_scene
- manim.scene.sample_space_scene
manim.scene.scene
manim.scene.scene_file_writer
manim.scene.three_d_scene
diff --git a/docs/source/reference_index/scenes.rst b/docs/source/reference_index/scenes.rst
index c290474a1..38f09119d 100644
--- a/docs/source/reference_index/scenes.rst
+++ b/docs/source/reference_index/scenes.rst
@@ -7,8 +7,6 @@ Scenes
:toctree: ../reference
~scene.moving_camera_scene
- ~scene.reconfigurable_scene
- ~scene.sample_space_scene
~scene.section
~scene.scene
~scene.scene_file_writer
diff --git a/manim/__init__.py b/manim/__init__.py
index 1dd9f91e4..0a6d8a480 100644
--- a/manim/__init__.py
+++ b/manim/__init__.py
@@ -85,8 +85,6 @@ from .mobject.value_tracker import *
from .mobject.vector_field import *
from .renderer.cairo_renderer import *
from .scene.moving_camera_scene import *
-from .scene.reconfigurable_scene import *
-from .scene.sample_space_scene import *
from .scene.scene import *
from .scene.scene_file_writer import *
from .scene.section import *
diff --git a/manim/camera/three_d_camera.py b/manim/camera/three_d_camera.py
index 86f6fa3b6..f3835e27d 100644
--- a/manim/camera/three_d_camera.py
+++ b/manim/camera/three_d_camera.py
@@ -17,7 +17,6 @@ from ..mobject.three_d_utils import (
from ..mobject.types.point_cloud_mobject import Point
from ..mobject.value_tracker import ValueTracker
from ..utils.color import get_shaded_rgb
-from ..utils.deprecation import deprecated
from ..utils.family import extract_mobject_family_members
from ..utils.space_ops import rotation_about_z, rotation_matrix
@@ -164,14 +163,6 @@ class ThreeDCamera(Camera):
"""
return self.theta_tracker.get_value()
- @deprecated(
- since="v0.11.0",
- until="v0.12.0",
- message="use focal_distance instead.",
- )
- def get_distance(self):
- return self.get_focal_distance()
-
def get_focal_distance(self):
"""Returns focal_distance of the Camera.
@@ -223,14 +214,6 @@ class ThreeDCamera(Camera):
"""
self.theta_tracker.set_value(value)
- @deprecated(
- since="v0.11.0",
- until="v0.12.0",
- message="use focal_distance instead.",
- )
- def set_distance(self, value):
- return self.set_focal_distance(value)
-
def set_focal_distance(self, value):
"""Sets the focal_distance of the Camera.
diff --git a/manim/mobject/changing.py b/manim/mobject/changing.py
index fa0d3c1de..f8f30f2fa 100644
--- a/manim/mobject/changing.py
+++ b/manim/mobject/changing.py
@@ -10,7 +10,6 @@ from .._config import config
from ..constants import *
from ..mobject.types.vectorized_mobject import VGroup, VMobject
from ..utils.color import BLUE_B, BLUE_D, BLUE_E, GREY_BROWN, WHITE
-from ..utils.deprecation import deprecated_params
from ..utils.rate_functions import smooth
from .opengl_compatibility import ConvertToOpenGL
@@ -136,11 +135,6 @@ class TracedPath(VMobject, metaclass=ConvertToOpenGL):
"""
- @deprecated_params(
- params="min_distance_to_new_point",
- since="v0.10.0",
- until="v0.12.0",
- )
def __init__(
self,
traced_point_func: Callable,
@@ -149,7 +143,6 @@ class TracedPath(VMobject, metaclass=ConvertToOpenGL):
dissipating_time: Optional[float] = None,
**kwargs
):
- kwargs.pop("min_distance_to_new_point", None) #
super().__init__(stroke_color=stroke_color, stroke_width=stroke_width, **kwargs)
self.traced_point_func = traced_point_func
self.dissipating_time = dissipating_time
diff --git a/manim/mobject/geometry.py b/manim/mobject/geometry.py
index 760677a3b..518861a28 100644
--- a/manim/mobject/geometry.py
+++ b/manim/mobject/geometry.py
@@ -80,7 +80,6 @@ from ..constants import *
from ..mobject.mobject import Mobject
from ..mobject.types.vectorized_mobject import DashedVMobject, VGroup, VMobject
from ..utils.color import *
-from ..utils.deprecation import deprecated_params
from ..utils.iterables import adjacent_n_tuples, adjacent_pairs
from ..utils.space_ops import (
angle_between_vectors,
@@ -1125,12 +1124,6 @@ class DashedLine(Line):
:class:`~.DashedVMobject`
"""
- @deprecated_params(
- params="positive_space_ratio dash_spacing",
- since="v0.9.0",
- message="Use dashed_ratio instead of positive_space_ratio.",
- redirections=[("positive_space_ratio", "dashed_ratio")],
- )
def __init__(
self,
*args,
@@ -1138,10 +1131,6 @@ class DashedLine(Line):
dashed_ratio=0.5,
**kwargs,
):
- self.dash_spacing = kwargs.pop(
- "dash_spacing",
- None,
- ) # Unused param, remove with deprecation warning
self.dash_length = dash_length
self.dashed_ratio = dashed_ratio
super().__init__(*args, **kwargs)
diff --git a/manim/mobject/mobject.py b/manim/mobject/mobject.py
index 6b10e7c9c..a79f23cdd 100644
--- a/manim/mobject/mobject.py
+++ b/manim/mobject/mobject.py
@@ -41,7 +41,6 @@ from ..utils.color import (
color_gradient,
interpolate_color,
)
-from ..utils.deprecation import deprecated
from ..utils.exceptions import MultiAnimationOverrideException
from ..utils.iterables import list_update, remove_list_redundancies
from ..utils.paths import straight_path
@@ -1312,33 +1311,6 @@ 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)
-
def pose_at_angle(self, **kwargs):
self.rotate(TAU / 14, RIGHT + UP, **kwargs)
return self
@@ -1444,15 +1416,6 @@ 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)
-
def rescale_to_fit(self, length, dim, stretch=False, **kwargs):
old_length = self.length_over_dim(dim)
if old_length == 0:
diff --git a/manim/mobject/opengl_geometry.py b/manim/mobject/opengl_geometry.py
index 52bd0f53c..34d2f3736 100644
--- a/manim/mobject/opengl_geometry.py
+++ b/manim/mobject/opengl_geometry.py
@@ -9,7 +9,6 @@ from ..mobject.types.opengl_vectorized_mobject import (
OpenGLVMobject,
)
from ..utils.color import *
-from ..utils.deprecation import deprecated_params
from ..utils.iterables import adjacent_n_tuples, adjacent_pairs
from ..utils.simple_functions import clip, fdiv
from ..utils.space_ops import (
@@ -518,17 +517,10 @@ class OpenGLLine(OpenGLTipableVMobject):
class OpenGLDashedLine(OpenGLLine):
- @deprecated_params(
- params="positive_space_ratio dash_spacing",
- since="v0.9.0",
- message="Use dashed_ratio instead of positive_space_ratio.",
- )
def __init__(
self, *args, dash_length=DEFAULT_DASH_LENGTH, dashed_ratio=0.5, **kwargs
):
- # Simplify with removal of deprecation warning
- self.dash_spacing = kwargs.pop("dash_spacing", None) # Unused param
- self.dashed_ratio = kwargs.pop("positive_space_ratio", None) or dashed_ratio
+ self.dashed_ratio = dashed_ratio
self.dash_length = dash_length
super().__init__(*args, **kwargs)
dashed_ratio = self.dashed_ratio
diff --git a/manim/mobject/opengl_mobject.py b/manim/mobject/opengl_mobject.py
index 876d3b3ff..8fc03517a 100644
--- a/manim/mobject/opengl_mobject.py
+++ b/manim/mobject/opengl_mobject.py
@@ -335,10 +335,6 @@ class OpenGLMobject:
def match_points(self, mobject):
self.set_points(mobject.points)
- @deprecated(since="0.11.0", replacement="self.points")
- def get_points(self):
- return self.points
-
def clear_points(self):
self.resize_points(0)
diff --git a/manim/mobject/types/opengl_vectorized_mobject.py b/manim/mobject/types/opengl_vectorized_mobject.py
index 35e9fbda6..f3e6006e8 100644
--- a/manim/mobject/types/opengl_vectorized_mobject.py
+++ b/manim/mobject/types/opengl_vectorized_mobject.py
@@ -20,7 +20,6 @@ from ...utils.bezier import (
)
from ...utils.color import *
from ...utils.config_ops import _Data
-from ...utils.deprecation import deprecated_params
from ...utils.iterables import listify, make_even, resize_with_interpolation
from ...utils.space_ops import (
angle_between_vectors,
@@ -1283,17 +1282,10 @@ class OpenGLCurvesAsSubmobjects(OpenGLVGroup):
class OpenGLDashedVMobject(OpenGLVMobject):
- @deprecated_params(
- params="positive_space_ratio dash_spacing",
- since="v0.9.0",
- message="Use dashed_ratio instead of positive_space_ratio.",
- )
def __init__(
self, vmobject, num_dashes=15, dashed_ratio=0.5, color=WHITE, **kwargs
):
- # Simplify with removal of deprecation warning
- self.dash_spacing = kwargs.pop("dash_spacing", None) # Unused param
- self.dashed_ratio = kwargs.pop("positive_space_ratio", None) or dashed_ratio
+ self.dashed_ratio = dashed_ratio
self.num_dashes = num_dashes
super().__init__(color=color, **kwargs)
r = self.dashed_ratio
diff --git a/manim/mobject/types/vectorized_mobject.py b/manim/mobject/types/vectorized_mobject.py
index f56108d16..1df043e42 100644
--- a/manim/mobject/types/vectorized_mobject.py
+++ b/manim/mobject/types/vectorized_mobject.py
@@ -34,7 +34,7 @@ from ...utils.bezier import (
proportions_along_bezier_curve_for_point,
)
from ...utils.color import BLACK, WHITE, color_to_rgba
-from ...utils.deprecation import deprecated, deprecated_params
+from ...utils.deprecation import deprecated
from ...utils.iterables import make_even, stretch_array_to_length, tuplify
from ...utils.simple_functions import clip_in_place
from ...utils.space_ops import rotate_vector, shoelace_direction
@@ -2228,17 +2228,11 @@ class DashedVMobject(VMobject, metaclass=ConvertToOpenGL):
"""
- @deprecated_params(
- params="positive_space_ratio dash_spacing",
- since="v0.9.0",
- message="Use dashed_ratio instead of positive_space_ratio.",
- )
def __init__(
self, vmobject, num_dashes=15, dashed_ratio=0.5, color=WHITE, **kwargs
):
- # Simplify with removal of deprecation warning
- self.dash_spacing = kwargs.pop("dash_spacing", None) # Unused param
- self.dashed_ratio = kwargs.pop("positive_space_ratio", None) or dashed_ratio
+
+ self.dashed_ratio = dashed_ratio
self.num_dashes = num_dashes
super().__init__(color=color, **kwargs)
r = self.dashed_ratio
diff --git a/manim/scene/reconfigurable_scene.py b/manim/scene/reconfigurable_scene.py
deleted file mode 100644
index 82146bc79..000000000
--- a/manim/scene/reconfigurable_scene.py
+++ /dev/null
@@ -1,71 +0,0 @@
-__all__ = ["ReconfigurableScene"]
-
-from manim.utils.deprecation import deprecated
-
-from ..animation.transform import Transform
-from ..constants import *
-from ..mobject.mobject import Mobject
-from ..scene.scene import Scene
-
-
-@deprecated(
- since="0.11.0",
- until="0.12.0",
- message="Does not seem to work, and no plans to maintain it.",
-)
-class ReconfigurableScene(Scene):
- """
- Note, this seems to no longer work as intended.
- """
-
- def __init__(self, allow_recursion=True, **kwargs):
- super().__init__(**kwargs)
- self.allow_recursion = allow_recursion
-
- def setup(self):
- self.states = []
- self.num_recursions = 0
-
- def transition_to_alt_config(
- self,
- return_to_original_configuration=True,
- transformation_kwargs=None,
- **new_config,
- ):
- if transformation_kwargs is None:
- transformation_kwargs = {}
- original_state = self.get_state()
- state_copy = original_state.copy()
- self.states.append(state_copy)
- if not self.allow_recursion:
- return
- alt_scene = self.__class__(
- skip_animations=True, allow_recursion=False, **new_config
- )
- alt_state = alt_scene.states[len(self.states) - 1]
-
- if return_to_original_configuration:
- self.clear()
- self.transition_between_states(
- state_copy, alt_state, **transformation_kwargs
- )
- self.transition_between_states(
- state_copy, original_state, **transformation_kwargs
- )
- self.clear()
- self.add(*original_state)
- else:
- self.transition_between_states(
- original_state, alt_state, **transformation_kwargs
- )
- self.__dict__.update(new_config)
-
- def get_state(self):
- # Want to return a mobject that maintains the most
- # structure. The way to do that is to extract only
- # those that aren't inside another.
- return Mobject(*self.get_top_level_mobjects())
-
- def transition_between_states(self, start_state, target_state, **kwargs):
- self.play(Transform(start_state, target_state, **kwargs))
- self.wait()
diff --git a/manim/scene/sample_space_scene.py b/manim/scene/sample_space_scene.py
deleted file mode 100644
index 756b89954..000000000
--- a/manim/scene/sample_space_scene.py
+++ /dev/null
@@ -1,142 +0,0 @@
-"""A scene suitable for usage with :class:`.SampleSpace`."""
-
-__all__ = ["SampleSpaceScene"]
-
-
-from manim.utils.deprecation import deprecated
-
-from ..animation.animation import Animation
-from ..animation.transform import MoveToTarget, Transform
-from ..animation.update import UpdateFromFunc
-from ..constants import *
-from ..mobject.probability import SampleSpace
-from ..mobject.types.vectorized_mobject import VGroup
-from ..scene.scene import Scene
-
-
-@deprecated(since="0.11.0", until="0.12.0", message="Out of scope of the library.")
-class SampleSpaceScene(Scene):
- def get_sample_space(self, **config):
- self.sample_space = SampleSpace(**config)
- return self.sample_space
-
- def add_sample_space(self, **config):
- self.add(self.get_sample_space(**config))
-
- def get_division_change_animations(
- self, sample_space, parts, p_list, dimension=1, new_label_kwargs=None, **kwargs
- ):
- if new_label_kwargs is None:
- new_label_kwargs = {}
- anims = []
- p_list = sample_space.complete_p_list(p_list)
- space_copy = sample_space.copy()
-
- vect = DOWN if dimension == 1 else RIGHT
- parts.generate_target()
- for part, p in zip(parts.target, p_list):
- part.replace(space_copy, stretch=True)
- part.stretch(p, dimension)
- parts.target.arrange(vect, buff=0)
- parts.target.move_to(space_copy)
- anims.append(MoveToTarget(parts))
- if hasattr(parts, "labels") and parts.labels is not None:
- label_kwargs = parts.label_kwargs
- label_kwargs.update(new_label_kwargs)
- new_braces, new_labels = sample_space.get_subdivision_braces_and_labels(
- parts.target, **label_kwargs
- )
- anims += [
- Transform(parts.braces, new_braces),
- Transform(parts.labels, new_labels),
- ]
- return anims
-
- def get_horizontal_division_change_animations(self, p_list, **kwargs):
- assert hasattr(self.sample_space, "horizontal_parts")
- return self.get_division_change_animations(
- self.sample_space,
- self.sample_space.horizontal_parts,
- p_list,
- dimension=1,
- **kwargs,
- )
-
- def get_vertical_division_change_animations(self, p_list, **kwargs):
- assert hasattr(self.sample_space, "vertical_parts")
- return self.get_division_change_animations(
- self.sample_space,
- self.sample_space.vertical_parts,
- p_list,
- dimension=0,
- **kwargs,
- )
-
- def get_conditional_change_anims(
- self, sub_sample_space_index, value, post_rects=None, **kwargs
- ):
- parts = self.sample_space.horizontal_parts
- sub_sample_space = parts[sub_sample_space_index]
- anims = self.get_division_change_animations(
- sub_sample_space,
- sub_sample_space.vertical_parts,
- value,
- dimension=0,
- **kwargs,
- )
- if post_rects is not None:
- anims += self.get_posterior_rectangle_change_anims(post_rects)
- return anims
-
- def get_top_conditional_change_anims(self, *args, **kwargs):
- return self.get_conditional_change_anims(0, *args, **kwargs)
-
- def get_bottom_conditional_change_anims(self, *args, **kwargs):
- return self.get_conditional_change_anims(1, *args, **kwargs)
-
- def get_prior_rectangles(self):
- return VGroup(
- *(self.sample_space.horizontal_parts[i].vertical_parts[0] for i in range(2))
- )
-
- def get_posterior_rectangles(self, buff=MED_LARGE_BUFF):
- prior_rects = self.get_prior_rectangles()
- areas = [rect.width * rect.height for rect in prior_rects]
- total_area = sum(areas)
- total_height = prior_rects.height
-
- post_rects = prior_rects.copy()
- for rect, area in zip(post_rects, areas):
- rect.stretch_to_fit_height(total_height * area / total_area)
- rect.stretch_to_fit_width(area / rect.height)
- post_rects.arrange(DOWN, buff=0)
- post_rects.next_to(self.sample_space, RIGHT, buff)
- return post_rects
-
- def get_posterior_rectangle_braces_and_labels(
- self, post_rects, labels, direction=RIGHT, **kwargs
- ):
- return self.sample_space.get_subdivision_braces_and_labels(
- post_rects, labels, direction, **kwargs
- )
-
- def update_posterior_braces(self, post_rects):
- braces = post_rects.braces
- labels = post_rects.labels
- for rect, brace, label in zip(post_rects, braces, labels):
- brace.stretch_to_fit_height(rect.height)
- brace.next_to(rect, RIGHT, SMALL_BUFF)
- label.next_to(brace, RIGHT, SMALL_BUFF)
-
- def get_posterior_rectangle_change_anims(self, post_rects):
- def update_rects(rects):
- new_rects = self.get_posterior_rectangles()
- Transform(rects, new_rects).update(1)
- if hasattr(rects, "braces"):
- self.update_posterior_braces(rects)
- return rects
-
- anims = [UpdateFromFunc(post_rects, update_rects)]
- if hasattr(post_rects, "braces"):
- anims += list(map(Animation, [post_rects.labels, post_rects.braces]))
- return anims
diff --git a/manim/scene/three_d_scene.py b/manim/scene/three_d_scene.py
index 452de0809..5d1d55006 100644
--- a/manim/scene/three_d_scene.py
+++ b/manim/scene/three_d_scene.py
@@ -23,7 +23,6 @@ from ..mobject.value_tracker import ValueTracker
from ..renderer.opengl_renderer import OpenGLCamera
from ..scene.scene import Scene
from ..utils.config_ops import merge_dicts_recursively
-from ..utils.deprecation import deprecated_params
class ThreeDScene(Scene):
@@ -50,12 +49,6 @@ class ThreeDScene(Scene):
)
super().__init__(camera_class=camera_class, **kwargs)
- @deprecated_params(
- params="distance",
- since="v0.11.0",
- until="v0.12.0",
- message="Use focal_distance instead.",
- )
def set_camera_orientation(
self,
phi: Optional[float] = None,
@@ -90,7 +83,7 @@ class ThreeDScene(Scene):
The new center of the camera frame in cartesian coordinates.
"""
- focal_distance = kwargs.pop("distance", focal_distance)
+
if phi is not None:
self.renderer.camera.set_phi(phi)
if theta is not None:
@@ -197,12 +190,6 @@ class ThreeDScene(Scene):
self.renderer.camera.phi_tracker.clear_updaters()
self.remove(self.renderer.camera.phi_tracker)
- @deprecated_params(
- params="distance",
- since="v0.11.0",
- until="v0.12.0",
- message="Use focal_distance instead.",
- )
def move_camera(
self,
phi: Optional[float] = None,
@@ -243,7 +230,6 @@ class ThreeDScene(Scene):
"""
anims = []
- focal_distance = kwargs.pop("distance", focal_distance)
if config.renderer != "opengl":
self.camera: ThreeDCamera