mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Add Self type to shape_matchers.py
This commit is contained in:
parent
576d8c996b
commit
0452012d54
1 changed files with 5 additions and 5 deletions
|
@ -14,7 +14,7 @@ from manimlib.utils.customization import get_customization
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Sequence
|
from typing import Sequence, Self
|
||||||
from manimlib.mobject.mobject import Mobject
|
from manimlib.mobject.mobject import Mobject
|
||||||
from manimlib.typing import ManimColor
|
from manimlib.typing import ManimColor
|
||||||
|
|
||||||
|
@ -60,20 +60,20 @@ class BackgroundRectangle(SurroundingRectangle):
|
||||||
)
|
)
|
||||||
self.original_fill_opacity = fill_opacity
|
self.original_fill_opacity = fill_opacity
|
||||||
|
|
||||||
def pointwise_become_partial(self, mobject: Mobject, a: float, b: float):
|
def pointwise_become_partial(self, mobject: Mobject, a: float, b: float) -> Self:
|
||||||
self.set_fill(opacity=b * self.original_fill_opacity)
|
self.set_fill(opacity=b * self.original_fill_opacity)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def set_style_data(
|
def set_style(
|
||||||
self,
|
self,
|
||||||
stroke_color: ManimColor | None = None,
|
stroke_color: ManimColor | None = None,
|
||||||
stroke_width: float | None = None,
|
stroke_width: float | None = None,
|
||||||
fill_color: ManimColor | None = None,
|
fill_color: ManimColor | None = None,
|
||||||
fill_opacity: float | None = None,
|
fill_opacity: float | None = None,
|
||||||
family: bool = True
|
family: bool = True
|
||||||
):
|
) -> Self:
|
||||||
# Unchangeable style, except for fill_opacity
|
# Unchangeable style, except for fill_opacity
|
||||||
VMobject.set_style_data(
|
VMobject.set_style(
|
||||||
self,
|
self,
|
||||||
stroke_color=BLACK,
|
stroke_color=BLACK,
|
||||||
stroke_width=0,
|
stroke_width=0,
|
||||||
|
|
Loading…
Add table
Reference in a new issue