From 285953b44dc66a8c0d3d4130cb1baab5041cdcb8 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Mon, 30 Jan 2023 11:57:01 -0800 Subject: [PATCH] Add FRAME_SHAPE constant --- manimlib/camera/camera_frame.py | 7 +++---- manimlib/constants.py | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manimlib/camera/camera_frame.py b/manimlib/camera/camera_frame.py index e33e4703..5f46e253 100644 --- a/manimlib/camera/camera_frame.py +++ b/manimlib/camera/camera_frame.py @@ -6,7 +6,7 @@ import numpy as np from scipy.spatial.transform import Rotation from manimlib.constants import DEGREES, RADIANS -from manimlib.constants import FRAME_HEIGHT, FRAME_WIDTH +from manimlib.constants import FRAME_SHAPE from manimlib.constants import DOWN, LEFT, ORIGIN, OUT, RIGHT, UP from manimlib.mobject.mobject import Mobject from manimlib.utils.space_ops import normalize @@ -20,7 +20,7 @@ if TYPE_CHECKING: class CameraFrame(Mobject): def __init__( self, - frame_shape: tuple[float, float] = (FRAME_WIDTH, FRAME_HEIGHT), + frame_shape: tuple[float, float] = FRAME_SHAPE, center_point: Vect3 = ORIGIN, focal_dist_to_height: float = 2.0, **kwargs, @@ -56,9 +56,8 @@ class CameraFrame(Mobject): return self def to_default_state(self): + self.set_shape(*FRAME_SHAPE) self.center() - self.set_height(FRAME_HEIGHT) - self.set_width(FRAME_WIDTH) self.set_orientation(self.default_orientation) return self diff --git a/manimlib/constants.py b/manimlib/constants.py index fbb14f1a..ac0345ec 100644 --- a/manimlib/constants.py +++ b/manimlib/constants.py @@ -11,6 +11,7 @@ if TYPE_CHECKING: ASPECT_RATIO: float = 16.0 / 9.0 FRAME_HEIGHT: float = 8.0 FRAME_WIDTH: float = FRAME_HEIGHT * ASPECT_RATIO +FRAME_SHAPE: tuple[float, float] = (FRAME_WIDTH, FRAME_HEIGHT) FRAME_Y_RADIUS: float = FRAME_HEIGHT / 2 FRAME_X_RADIUS: float = FRAME_WIDTH / 2