diff --git a/manim/animation/animation.py b/manim/animation/animation.py index 491d573740..564ebffe83 100644 --- a/manim/animation/animation.py +++ b/manim/animation/animation.py @@ -121,7 +121,7 @@ def __new__( if func is not None: anim = func(mobject, *args, **kwargs) logger.debug( - f"The {cls.__name__} animation has been is overridden for " + f"The {cls.__name__} animation has been overridden for " f"{type(mobject).__name__} mobjects. use_override = False can " f" be used as keyword argument to prevent animation overriding.", ) @@ -141,7 +141,7 @@ def __init__( introducer: bool = False, *, _on_finish: Callable[[], None] = lambda _: None, - **kwargs, + use_override: bool = True, # included here to avoid TypeError if passed from a subclass's constructor ) -> None: self._typecheck_input(mobject) self.run_time: float = run_time @@ -161,8 +161,6 @@ def __init__( else: self.starting_mobject: Mobject = Mobject() self.mobject: Mobject = mobject if mobject is not None else Mobject() - if kwargs: - logger.debug("Animation received extra kwargs: %s", kwargs) if hasattr(self, "CONFIG"): logger.error( @@ -499,6 +497,8 @@ def __init_subclass__(cls, **kwargs) -> None: cls._original__init__ = cls.__init__ + _original__init__ = __init__ # needed if set_default() is called with no kwargs directly from Animation + @classmethod def set_default(cls, **kwargs) -> None: """Sets the default values of keyword arguments. diff --git a/manim/animation/creation.py b/manim/animation/creation.py index dc3ec69527..eba59262c6 100644 --- a/manim/animation/creation.py +++ b/manim/animation/creation.py @@ -120,7 +120,7 @@ def __init__( ): pointwise = getattr(mobject, "pointwise_become_partial", None) if not callable(pointwise): - raise NotImplementedError("This animation is not defined for this Mobject.") + raise TypeError(f"{self.__class__.__name__} only works for VMobjects.") super().__init__(mobject, **kwargs) def interpolate_submobject( @@ -133,7 +133,7 @@ def interpolate_submobject( starting_submobject, *self._get_bounds(alpha) ) - def _get_bounds(self, alpha: float) -> None: + def _get_bounds(self, alpha: float) -> tuple[float, float]: raise NotImplementedError("Please use Create or ShowPassingFlash") @@ -173,7 +173,7 @@ def __init__( ) -> None: super().__init__(mobject, lag_ratio=lag_ratio, introducer=introducer, **kwargs) - def _get_bounds(self, alpha: float) -> tuple[int, float]: + def _get_bounds(self, alpha: float) -> tuple[float, float]: return (0, alpha) @@ -229,8 +229,6 @@ def __init__( rate_func: Callable[[float], float] = double_smooth, stroke_width: float = 2, stroke_color: str = None, - draw_border_animation_config: dict = {}, # what does this dict accept? - fill_animation_config: dict = {}, introducer: bool = True, **kwargs, ) -> None: @@ -244,8 +242,6 @@ def __init__( ) self.stroke_width = stroke_width self.stroke_color = stroke_color - self.draw_border_animation_config = draw_border_animation_config - self.fill_animation_config = fill_animation_config self.outline = self.get_outline() def _typecheck_input(self, vmobject: VMobject | OpenGLVMobject) -> None: diff --git a/manim/animation/transform_matching_parts.py b/manim/animation/transform_matching_parts.py index dbf5dd294e..9535c4a3b4 100644 --- a/manim/animation/transform_matching_parts.py +++ b/manim/animation/transform_matching_parts.py @@ -96,7 +96,6 @@ def __init__( # target_map transform_source = group_type() transform_target = group_type() - kwargs["final_alpha_value"] = 0 for key in set(source_map).intersection(target_map): transform_source.add(source_map[key]) transform_target.add(target_map[key]) diff --git a/manim/mobject/mobject.py b/manim/mobject/mobject.py index 6ad3ece777..87f023eb83 100644 --- a/manim/mobject/mobject.py +++ b/manim/mobject/mobject.py @@ -1011,7 +1011,7 @@ def dot_position(mobject): label.add_updater(dot_position) self.add(dot, label) - self.play(Rotating(dot, about_point=ORIGIN, angle=TAU, run_time=TAU, rate_func=linear)) + self.play(Rotating(dot, about_point=ORIGIN, run_time=TAU, rate_func=linear)) .. manim:: DtUpdater