mirror of
https://github.com/3b1b/manim.git
synced 2025-08-30 05:02:28 +00:00
Kill CONFIG in frame.py
This commit is contained in:
parent
5b5b3a7d20
commit
a05820b7c7
1 changed files with 41 additions and 36 deletions
|
@ -1,51 +1,56 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from manimlib.constants import BLACK, GREY_E
|
from manimlib.constants import BLACK, GREY_E
|
||||||
from manimlib.constants import FRAME_HEIGHT
|
from manimlib.constants import FRAME_HEIGHT
|
||||||
from manimlib.mobject.geometry import Rectangle
|
from manimlib.mobject.geometry import Rectangle
|
||||||
from manimlib.utils.config_ops import digest_config
|
from manimlib.utils.config_ops import digest_config
|
||||||
|
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from manimlib.constants import ManimColor
|
||||||
|
|
||||||
|
|
||||||
class ScreenRectangle(Rectangle):
|
class ScreenRectangle(Rectangle):
|
||||||
CONFIG = {
|
def __init__(
|
||||||
"aspect_ratio": 16.0 / 9.0,
|
self,
|
||||||
"height": 4
|
aspect_ratio: float = 16.0 / 9.0,
|
||||||
}
|
height: float = 4,
|
||||||
|
**kwargs
|
||||||
def __init__(self, **kwargs):
|
):
|
||||||
Rectangle.__init__(self, **kwargs)
|
super().__init__(
|
||||||
self.set_width(
|
width=aspect_ratio * height,
|
||||||
self.aspect_ratio * self.get_height(),
|
height=height,
|
||||||
stretch=True
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class FullScreenRectangle(ScreenRectangle):
|
class FullScreenRectangle(ScreenRectangle):
|
||||||
CONFIG = {
|
def __init__(
|
||||||
"height": FRAME_HEIGHT,
|
self,
|
||||||
"fill_color": GREY_E,
|
height: float = FRAME_HEIGHT,
|
||||||
"fill_opacity": 1,
|
fill_color: ManimColor = GREY_E,
|
||||||
"stroke_width": 0,
|
fill_opacity: float = 1,
|
||||||
}
|
stroke_width: float = 0,
|
||||||
|
**kwargs,
|
||||||
|
):
|
||||||
|
super().__init__(
|
||||||
|
height=height,
|
||||||
|
fill_color=fill_color,
|
||||||
|
fill_opacity=fill_opacity,
|
||||||
|
stroke_width=stroke_width,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class FullScreenFadeRectangle(FullScreenRectangle):
|
class FullScreenFadeRectangle(FullScreenRectangle):
|
||||||
CONFIG = {
|
def __init__(
|
||||||
"stroke_width": 0,
|
self,
|
||||||
"fill_color": BLACK,
|
stroke_width: float = 0.0,
|
||||||
"fill_opacity": 0.7,
|
fill_color: ManimColor = BLACK,
|
||||||
}
|
fill_opacity: float = 0.7,
|
||||||
|
**kwargs,
|
||||||
|
):
|
||||||
class PictureInPictureFrame(Rectangle):
|
super().__init__(
|
||||||
CONFIG = {
|
stroke_width=stroke_width,
|
||||||
"height": 3,
|
fill_color=fill_color,
|
||||||
"aspect_ratio": 16.0 / 9.0
|
fill_opacity=fill_opacity,
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
|
||||||
digest_config(self, kwargs)
|
|
||||||
Rectangle.__init__(
|
|
||||||
self,
|
|
||||||
width=self.aspect_ratio * self.height,
|
|
||||||
height=self.height,
|
|
||||||
**kwargs
|
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue