Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Remove all classes and functions that were deprecated until `v0.7.0` and `v0.8.0` (#1773)

Jared Hughese9f84f89e4d8
diff --git a/manim/animation/fading.py b/manim/animation/fading.py
index f57f3df39..a317fb7d8 100644
--- a/manim/animation/fading.py
+++ b/manim/animation/fading.py
@@ -16,14 +16,6 @@
__all__ = [
"FadeOut",
"FadeIn",
- "FadeInFrom",
- "FadeOutAndShift",
- "FadeOutToPoint",
- "FadeInFromPoint",
- "FadeInFromLarge",
- "VFadeIn",
- "VFadeOut",
- "VFadeInThenOut",
]
from typing import Callable, Optional, Union
@@ -199,89 +191,3 @@ class FadeOut(_Fade):
def clean_up_from_scene(self, scene: Scene = None) -> None:
super().clean_up_from_scene(scene)
self.interpolate(0)
-
-
-@deprecated(
- since="v0.6.0",
- until="v0.8.0",
- replacement="FadeIn",
- message="You can set a shift amount there.",
-)
-class FadeInFrom(FadeIn):
- def __init__(
- self, mobject: "Mobject", direction: np.ndarray = DOWN, **kwargs
- ) -> None:
- super().__init__(mobject, shift=-direction, **kwargs)
-
-
-@deprecated(
- since="v0.6.0",
- until="v0.8.0",
- replacement="FadeOut",
- message="You can set a shift amount there.",
-)
-class FadeOutAndShift(FadeIn):
- def __init__(
- self, mobject: "Mobject", direction: np.ndarray = DOWN, **kwargs
- ) -> None:
- super().__init__(mobject, shift=direction, **kwargs)
-
-
-@deprecated(
- since="v0.6.0",
- until="v0.8.0",
- replacement="FadeOut",
- message="You can set a target position there.",
-)
-class FadeOutToPoint(FadeOut):
- def __init__(
- self, mobject: "Mobject", point: Union["Mobject", np.ndarray] = ORIGIN, **kwargs
- ) -> None:
- super().__init__(mobject, target_position=point, **kwargs)
-
-
-@deprecated(
- since="v0.6.0",
- until="v0.8.0",
- replacement="FadeIn",
- message="You can set a target position and scaling factor there.",
-)
-class FadeInFromPoint(FadeIn):
- def __init__(
- self, mobject: "Mobject", point: Union["Mobject", np.ndarray], **kwargs
- ) -> None:
- super().__init__(mobject, target_position=point, scale=0, **kwargs)
-
-
-@deprecated(
- since="v0.6.0",
- until="v0.8.0",
- replacement="FadeIn",
- message="You can set a scaling factor there.",
-)
-class FadeInFromLarge(FadeIn):
- def __init__(self, mobject: "Mobject", scale_factor: float = 2, **kwargs) -> None:
- super().__init__(mobject, scale=scale_factor, **kwargs)
-
-
-@deprecated(since="v0.6.0", until="v0.8.0", replacement="FadeIn")
-class VFadeIn(FadeIn):
- def __init__(self, mobject: "Mobject", **kwargs) -> None:
- super().__init__(mobject, **kwargs)
-
-
-@deprecated(since="v0.6.0", until="v0.8.0", replacement="FadeOut")
-class VFadeOut(FadeOut):
- def __init__(self, mobject: "Mobject", **kwargs) -> None:
- super().__init__(mobject, **kwargs)
-
-
-@deprecated(since="v0.6.0", until="v0.8.0")
-class VFadeInThenOut(FadeIn):
- def __init__(
- self,
- mobject: "Mobject",
- rate_func: Callable[[float], float] = there_and_back,
- **kwargs
- ):
- super().__init__(mobject, remover=True, rate_func=rate_func, **kwargs)
diff --git a/manim/animation/indication.py b/manim/animation/indication.py
index e6b9eabc5..8cd18f0f6 100644
--- a/manim/animation/indication.py
+++ b/manim/animation/indication.py
@@ -29,18 +29,10 @@ __all__ = [
"FocusOn",
"Indicate",
"Flash",
- "CircleIndicate",
"ShowPassingFlash",
"ShowPassingFlashWithThinningStrokeWidth",
- "ShowCreationThenDestruction",
"ShowCreationThenFadeOut",
- "AnimationOnSurroundingRectangle",
- "ShowPassingFlashAround",
- "ShowCreationThenDestructionAround",
- "ShowCreationThenFadeAround",
"ApplyWave",
- "WiggleOutThenIn",
- "TurnInsideOut",
"Circumscribe",
"Wiggle",
]
@@ -278,32 +270,6 @@ class Flash(AnimationGroup):
]
-@deprecated(since="v0.5.0", until="v0.7.0", replacement="Circumscribe")
-class CircleIndicate(Indicate):
- def __init__(
- self,
- mobject: "Mobject",
- circle_config: typing.Dict[str, typing.Any] = {"color": YELLOW},
- rate_func: typing.Callable[
- [float, typing.Optional[float]], np.ndarray
- ] = there_and_back,
- remover: bool = True,
- **kwargs
- ) -> None:
- self.circle_config = circle_config
- circle = self.get_circle(mobject)
- super().__init__(circle, rate_func=rate_func, remover=remover, **kwargs)
-
- def get_circle(self, mobject: "Mobject") -> Circle:
- circle = Circle(**self.circle_config)
- circle.add_updater(lambda c: c.surround(mobject))
- return circle
-
- def interpolate_mobject(self, alpha: float) -> None:
- super().interpolate_mobject(alpha)
- self.mobject.set_stroke(opacity=alpha)
-
-
class ShowPassingFlash(ShowPartial):
"""Show only a sliver of the VMobject each frame.
@@ -379,14 +345,6 @@ class ShowPassingFlashWithThinningStrokeWidth(AnimationGroup):
)
-@deprecated(since="v0.5.0", until="v0.7.0", replacement="ShowPassingFlash")
-class ShowCreationThenDestruction(ShowPassingFlash):
- def __init__(
- self, mobject: "Mobject", time_width: float = 2.0, run_time: float = 1, **kwargs
- ) -> None:
- super().__init__(mobject, time_width=time_width, run_time=run_time, **kwargs)
-
-
# TODO Decide what to do with this class:
# Remove?
# Deprecate?
@@ -396,64 +354,6 @@ class ShowCreationThenFadeOut(Succession):
super().__init__(Create(mobject), FadeOut(mobject), remover=remover, **kwargs)
-@deprecated(since="v0.5.0", until="v0.7.0", replacement="Circumscribe")
-class AnimationOnSurroundingRectangle(AnimationGroup):
- def __init__(
- self,
- mobject: "Mobject",
- rect_animation: Animation = Animation,
- surrounding_rectangle_config: typing.Dict[str, typing.Any] = {},
- **kwargs
- ) -> None:
- # Callable which takes in a rectangle, and spits out some animation. Could be
- # some animation class, could be something more
- self.rect_animation = rect_animation
- self.surrounding_rectangle_config = surrounding_rectangle_config
- self.mobject_to_surround = mobject
-
- rect = self.get_rect()
- rect.add_updater(lambda r: r.move_to(mobject))
-
- super().__init__(
- self.rect_animation(rect, **kwargs),
- )
-
- def get_rect(self) -> SurroundingRectangle:
- return SurroundingRectangle(
- self.mobject_to_surround, **self.surrounding_rectangle_config
- )
-
-
-@deprecated(since="v0.5.0", until="v0.7.0", replacement="Circumscribe")
-class ShowPassingFlashAround(AnimationOnSurroundingRectangle):
- def __init__(
- self, mobject: "Mobject", rect_animation: Animation = ShowPassingFlash, **kwargs
- ) -> None:
- super().__init__(mobject, rect_animation=rect_animation, **kwargs)
-
-
-@deprecated(since="v0.5.0", until="v0.7.0", replacement="Circumscribe")
-class ShowCreationThenDestructionAround(AnimationOnSurroundingRectangle):
- def __init__(
- self,
- mobject: "Mobject",
- rect_animation: Animation = ShowCreationThenDestruction,
- **kwargs
- ) -> None:
- super().__init__(mobject, rect_animation=rect_animation, **kwargs)
-
-
-@deprecated(since="v0.5.0", until="v0.7.0", replacement="Circumscribe")
-class ShowCreationThenFadeAround(AnimationOnSurroundingRectangle):
- def __init__(
- self,
- mobject: "Mobject",
- rect_animation: Animation = ShowCreationThenFadeOut,
- **kwargs
- ) -> None:
- super().__init__(mobject, rect_animation=rect_animation, **kwargs)
-
-
class ApplyWave(Homotopy):
"""Send a wave through the Mobject distorting it temporarily.
@@ -653,25 +553,6 @@ class Wiggle(Animation):
)
-@deprecated(since="v0.5.0", until="v0.7.0", replacement="Wiggle")
-class WiggleOutThenIn(Wiggle):
- def __init__(*args, **kwargs):
- super().__init(*args, **kwargs)
-
-
-@deprecated(
- since="v0.5.0",
- until="v0.7.0",
- message="Use :code:`mobject.animate.become(mobject.copy().reverse_points())` instead if you have to.",
-)
-class TurnInsideOut(Transform):
- def __init__(self, mobject: "Mobject", path_arc: float = TAU / 4, **kwargs) -> None:
- super().__init__(mobject, path_arc=path_arc, **kwargs)
-
- def create_target(self) -> "Mobject":
- return self.mobject.copy().reverse_points()
-
-
class Circumscribe(Succession):
"""Draw a temporary line surrounding the mobject.
diff --git a/manim/mobject/svg/opengl_tex_mobject.py b/manim/mobject/svg/opengl_tex_mobject.py
index b7e1b351a..3c89c4e26 100644
--- a/manim/mobject/svg/opengl_tex_mobject.py
+++ b/manim/mobject/svg/opengl_tex_mobject.py
@@ -163,8 +163,6 @@ __all__ = [
"OpenGLTex",
"OpenGLBulletedList",
"OpenGLTitle",
- "OpenGLTexMobject",
- "OpenGLTextMobject",
]
@@ -599,15 +597,3 @@ class OpenGLTitle(OpenGLTex):
underline.width = underline_width
self.add(underline)
self.underline = underline
-
-
-@deprecated(until="v0.7.0", replacement="MathTex")
-class OpenGLTexMobject(OpenGLMathTex):
- def __init__(self, *tex_strings, **kwargs):
- MathTex.__init__(self, *tex_strings, **kwargs)
-
-
-@deprecated(until="v0.7.0", replacement="Tex")
-class OpenGLTextMobject(OpenGLTex):
- def __init__(self, *text_parts, **kwargs):
- Tex.__init__(self, *text_parts, **kwargs)
diff --git a/manim/mobject/svg/svg_mobject.py b/manim/mobject/svg/svg_mobject.py
index 754decefd..3c8c78618 100644
--- a/manim/mobject/svg/svg_mobject.py
+++ b/manim/mobject/svg/svg_mobject.py
@@ -251,7 +251,7 @@ class SVGMobject(VMobject, metaclass=ConvertToOpenGL):
Returns
-------
- VMobjectFromSVGPathstring
+ SVGPathMobject
A VMobject from the given path string, or d attribute.
"""
return SVGPathMobject(
@@ -454,7 +454,7 @@ class SVGMobject(VMobject, metaclass=ConvertToOpenGL):
Returns
-------
- VMobjectFromSVGPathstring
+ SVGPathMobject
A VMobject representing the polygon.
"""
# This seems hacky... yes it is.
diff --git a/manim/mobject/svg/svg_path.py b/manim/mobject/svg/svg_path.py
index 5bc60a9e5..99277b354 100644
--- a/manim/mobject/svg/svg_path.py
+++ b/manim/mobject/svg/svg_path.py
@@ -1,7 +1,7 @@
"""Mobjects generated from an SVG pathstring."""
-__all__ = ["SVGPathMobject", "string_to_numbers", "VMobjectFromSVGPathstring"]
+__all__ = ["SVGPathMobject", "string_to_numbers"]
import re
@@ -467,9 +467,3 @@ class SVGPathMobject(VMobject, metaclass=ConvertToOpenGL):
self.current_path_start = point
super().start_new_path(point)
return self
-
-
-@deprecated(until="v0.7.0", replacement="SVGPathMobject")
-class VMobjectFromSVGPathstring(SVGPathMobject):
- def __init__(self, *args, **kwargs):
- super().__init__(self, *args, **kwargs)
diff --git a/manim/utils/space_ops.py b/manim/utils/space_ops.py
index 33f2937ac..35a468258 100644
--- a/manim/utils/space_ops.py
+++ b/manim/utils/space_ops.py
@@ -1,7 +1,6 @@
"""Utility functions for two- and three-dimensional vectors."""
__all__ = [
- "get_norm",
"quaternion_mult",
"quaternion_from_angle_axis",
"angle_axis_from_quaternion",
@@ -11,12 +10,10 @@ __all__ = [
"rotation_matrix",
"rotation_about_z",
"z_to_vector",
- "angle_between",
"angle_of_vector",
"angle_between_vectors",
"project_along_vector",
"normalize",
- "cross",
"get_unit_normal",
"compass_directions",
"regular_vertices",
@@ -47,11 +44,6 @@ from ..utils.deprecation import deprecated
from ..utils.iterables import adjacent_pairs
-@deprecated(since="v0.6.0", until="v0.8.0", replacement="np.linalg.norm")
-def get_norm(vect):
- return np.linalg.norm(vect)
-
-
def norm_squared(v: float) -> float:
return np.dot(v, v)
@@ -321,11 +313,6 @@ def z_to_vector(vector: np.ndarray) -> np.ndarray:
return np.dot(rotation_about_z(theta), phi_down)
-@deprecated(since="v0.6.0", until="v0.8.0", replacement="angle_between_vectors")
-def angle_between(v1, v2):
- return np.arccos(np.dot(v1 / np.linalg.norm(v1), v2 / np.linalg.norm(v2)))
-
-
def angle_of_vector(vector: Sequence[float]) -> float:
"""Returns polar coordinate theta when vector is projected on xy plane.
@@ -426,11 +413,6 @@ def normalize_along_axis(array: np.ndarray, axis: np.ndarray) -> np.ndarray:
return array
-@deprecated(since="v0.6.0", until="v0.8.0", replacement="np.cross")
-def cross(v1, v2):
- return np.cross(v1, v2)
-
-
def get_unit_normal(v1: np.ndarray, v2: np.ndarray, tol: float = 1e-6) -> np.ndarray:
"""Gets the unit normal of the vectors.