3b1b-manim/scene/moving_camera_scene.py

28 lines
864 B
Python
Raw Normal View History

from __future__ import absolute_import
from scene.scene import Scene
2018-03-31 15:20:30 -07:00
from camera.moving_camera import MovingCamera
2018-02-23 11:05:57 -08:00
2018-02-23 11:05:57 -08:00
class MovingCameraScene(Scene):
2018-05-11 11:23:08 -07:00
CONFIG = {
"camera_class": MovingCamera
}
2018-02-23 11:05:57 -08:00
def setup(self):
2018-05-11 11:23:08 -07:00
Scene.setup(self)
assert(isinstance(self.camera, MovingCamera))
self.camera_frame = self.camera.frame
# Hmm, this currently relies on the fact that MovingCamera
# willd default to a full-sized frame. Is that okay?
2018-02-23 11:05:57 -08:00
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