2018-12-24 12:37:51 -08:00
|
|
|
from manimlib.constants import *
|
|
|
|
from manimlib.mobject.geometry import Rectangle
|
|
|
|
from manimlib.utils.config_ops import digest_config
|
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 ScreenRectangle(Rectangle):
|
|
|
|
CONFIG = {
|
2019-02-06 22:43:45 -08:00
|
|
|
"aspect_ratio": 16.0 / 9.0,
|
2019-02-05 16:16:18 -08:00
|
|
|
"height": 4
|
2018-03-31 18:05:02 -07:00
|
|
|
}
|
2018-04-06 13:58:59 -07:00
|
|
|
|
2019-02-05 16:16:18 -08:00
|
|
|
def __init__(self, **kwargs):
|
2019-02-05 16:22:25 -08:00
|
|
|
Rectangle.__init__(self, **kwargs)
|
|
|
|
self.set_width(
|
2019-02-06 22:43:45 -08:00
|
|
|
self.aspect_ratio * self.get_height(),
|
2019-02-05 16:22:25 -08:00
|
|
|
stretch=True
|
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):
|
|
|
|
CONFIG = {
|
2018-04-06 13:58:59 -07:00
|
|
|
"height": FRAME_HEIGHT,
|
2021-03-18 17:42:19 -07:00
|
|
|
"fill_color": GREY_E,
|
|
|
|
"fill_opacity": 1,
|
|
|
|
"stroke_width": 0,
|
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):
|
|
|
|
CONFIG = {
|
2018-04-06 13:58:59 -07:00
|
|
|
"stroke_width": 0,
|
|
|
|
"fill_color": BLACK,
|
|
|
|
"fill_opacity": 0.7,
|
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 PictureInPictureFrame(Rectangle):
|
|
|
|
CONFIG = {
|
2018-04-06 13:58:59 -07:00
|
|
|
"height": 3,
|
2019-02-06 22:43:45 -08:00
|
|
|
"aspect_ratio": 16.0 / 9.0
|
2018-03-31 18:05:02 -07:00
|
|
|
}
|
2018-04-06 13:58:59 -07:00
|
|
|
|
2018-03-31 18:05:02 -07:00
|
|
|
def __init__(self, **kwargs):
|
|
|
|
digest_config(self, kwargs)
|
|
|
|
Rectangle.__init__(
|
|
|
|
self,
|
2019-02-06 22:43:45 -08:00
|
|
|
width=self.aspect_ratio * self.height,
|
|
|
|
height=self.height,
|
2018-03-31 18:05:02 -07:00
|
|
|
**kwargs
|
|
|
|
)
|