示例#1
0
 def __init__(self, frame=None, **kwargs):
     """
     frame is a Mobject, (should almost certainly be a rectangle)
     determining which region of space the camera displys
     """
     digest_config(self, kwargs)
     if frame is None:
         frame = ScreenRectangle(height=FRAME_HEIGHT)
         frame.set_stroke(
             self.default_frame_stroke_color,
             self.default_frame_stroke_width,
         )
     self.frame = frame
     Camera.__init__(self, **kwargs)
示例#2
0
class MovingCameraScene(Scene):
    def setup(self):
        self.camera_frame = ScreenRectangle(height=FRAME_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