2022-12-15 16:28:15 -08:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2022-04-12 19:19:59 +08:00
|
|
|
from manimlib.constants import BLACK, GREY_E
|
|
|
|
from manimlib.constants import FRAME_HEIGHT
|
2018-12-24 12:37:51 -08:00
|
|
|
from manimlib.mobject.geometry import Rectangle
|
2018-03-31 18:05:02 -07:00
|
|
|
|
2022-12-15 16:28:15 -08:00
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
if TYPE_CHECKING:
|
2022-12-16 20:19:18 -08:00
|
|
|
from manimlib.typing import ManimColor
|
2022-12-15 16:28:15 -08:00
|
|
|
|
2018-04-06 13:58:59 -07:00
|
|
|
|
2018-03-31 18:05:02 -07:00
|
|
|
class ScreenRectangle(Rectangle):
|
2022-12-15 16:28:15 -08:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
aspect_ratio: float = 16.0 / 9.0,
|
|
|
|
height: float = 4,
|
|
|
|
**kwargs
|
|
|
|
):
|
|
|
|
super().__init__(
|
|
|
|
width=aspect_ratio * height,
|
|
|
|
height=height,
|
|
|
|
**kwargs
|
2019-02-05 16:16:18 -08:00
|
|
|
)
|
2018-03-31 18:05:02 -07:00
|
|
|
|
2018-04-06 13:58:59 -07:00
|
|
|
|
2018-03-31 18:05:02 -07:00
|
|
|
class FullScreenRectangle(ScreenRectangle):
|
2022-12-15 16:28:15 -08:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
height: float = FRAME_HEIGHT,
|
|
|
|
fill_color: ManimColor = GREY_E,
|
|
|
|
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,
|
|
|
|
)
|
2018-03-31 18:05:02 -07:00
|
|
|
|
2018-04-06 13:58:59 -07:00
|
|
|
|
2018-03-31 18:05:02 -07:00
|
|
|
class FullScreenFadeRectangle(FullScreenRectangle):
|
2022-12-15 16:28:15 -08:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
stroke_width: float = 0.0,
|
|
|
|
fill_color: ManimColor = BLACK,
|
|
|
|
fill_opacity: float = 0.7,
|
|
|
|
**kwargs,
|
|
|
|
):
|
|
|
|
super().__init__(
|
|
|
|
stroke_width=stroke_width,
|
|
|
|
fill_color=fill_color,
|
|
|
|
fill_opacity=fill_opacity,
|
2018-03-31 18:05:02 -07:00
|
|
|
)
|