Adds MovingCameraScene

This commit is contained in:
Grant Sanderson
2018-02-23 11:05:57 -08:00
parent 7518ff2861
commit bbfce118f2
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,23 @@
from helpers import *
from camera import MovingCamera
from scene import Scene
from topics.geometry import ScreenRectangle
class MovingCameraScene(Scene):
def setup(self):
self.camera_frame = ScreenRectangle(height = 2*SPACE_HEIGHT)
self.camera_frame.set_stroke(width = 0)
self.camera = MovingCamera(
self.camera_frame, **self.camera_config
)
return self
def get_moving_mobjects(self, *animations):
# TODO: Code repetition from ZoomedScene
moving_mobjects = Scene.get_moving_mobjects(self, *animations)
if self.camera_frame in moving_mobjects:
# When the camera is moving, so is everything,
return self.mobjects
else:
return moving_mobjects

View File

@ -122,6 +122,7 @@ class ZoomedScene(Scene):
self.zoomed_camera.capture_mobjects(
mobjects, **kwargs
)
def get_moving_mobjects(self, *animations):
moving_mobjects = Scene.get_moving_mobjects(self, *animations)
if self.zoom_activated and self.little_rectangle in moving_mobjects: