2018-12-24 12:37:51 -08:00
|
|
|
from manimlib.camera.moving_camera import MovingCamera
|
|
|
|
from manimlib.scene.scene import Scene
|
|
|
|
from manimlib.utils.iterables import list_update
|
2018-02-23 11:05:57 -08:00
|
|
|
|
2018-04-06 13:58:59 -07:00
|
|
|
|
2018-02-23 11:05:57 -08:00
|
|
|
class MovingCameraScene(Scene):
|
Added DocStrings for all methods in Container, Scene, GraphScene, MovingCameraScene, SceneFileWriter, ThreeDScene, SpecialThreeDScene, ZoomedScene, VectorScene, and LinearTransformationScene. (#1040)
* Added DocStrings for methods in Container and Scene.
Removed 2 unused imports from scene.py.
* Added DocStrings for all methods in GraphScene, MovingCameraScene, SceneFileWriter, ThreeDScene, SpecialThreeDScene and ZoomedScene.
* Added DocStrings for all methods in `VectorScene` and LinearTransformationScene...
...except `position_x_coordinate` and `position_y_coordinate`
Co-authored-by: Aathish Sivasubrahmanian <aathishs@Aathishs-MacBook-Air.local>
2020-05-14 11:11:22 +05:30
|
|
|
"""
|
|
|
|
This is a Scene, with special configurations and properties that
|
|
|
|
make it suitable for cases where the camera must be moved around.
|
|
|
|
"""
|
2018-05-21 12:11:46 -07:00
|
|
|
CONFIG = {
|
|
|
|
"camera_class": MovingCamera
|
|
|
|
}
|
|
|
|
|
2018-02-23 11:05:57 -08:00
|
|
|
def setup(self):
|
Added DocStrings for all methods in Container, Scene, GraphScene, MovingCameraScene, SceneFileWriter, ThreeDScene, SpecialThreeDScene, ZoomedScene, VectorScene, and LinearTransformationScene. (#1040)
* Added DocStrings for methods in Container and Scene.
Removed 2 unused imports from scene.py.
* Added DocStrings for all methods in GraphScene, MovingCameraScene, SceneFileWriter, ThreeDScene, SpecialThreeDScene and ZoomedScene.
* Added DocStrings for all methods in `VectorScene` and LinearTransformationScene...
...except `position_x_coordinate` and `position_y_coordinate`
Co-authored-by: Aathish Sivasubrahmanian <aathishs@Aathishs-MacBook-Air.local>
2020-05-14 11:11:22 +05:30
|
|
|
"""
|
|
|
|
This method is used internally by Manim
|
|
|
|
to set up the scene for proper use.
|
|
|
|
"""
|
2018-05-21 12:11:46 -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):
|
Added DocStrings for all methods in Container, Scene, GraphScene, MovingCameraScene, SceneFileWriter, ThreeDScene, SpecialThreeDScene, ZoomedScene, VectorScene, and LinearTransformationScene. (#1040)
* Added DocStrings for methods in Container and Scene.
Removed 2 unused imports from scene.py.
* Added DocStrings for all methods in GraphScene, MovingCameraScene, SceneFileWriter, ThreeDScene, SpecialThreeDScene and ZoomedScene.
* Added DocStrings for all methods in `VectorScene` and LinearTransformationScene...
...except `position_x_coordinate` and `position_y_coordinate`
Co-authored-by: Aathish Sivasubrahmanian <aathishs@Aathishs-MacBook-Air.local>
2020-05-14 11:11:22 +05:30
|
|
|
"""
|
|
|
|
This method returns a list of all of the Mobjects in the Scene that
|
|
|
|
are moving, that are also in the animations passed.
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
----------
|
|
|
|
*animations (Animation)
|
|
|
|
The animations whose mobjects will be checked.
|
|
|
|
"""
|
2018-02-23 11:05:57 -08:00
|
|
|
moving_mobjects = Scene.get_moving_mobjects(self, *animations)
|
2018-05-21 12:11:46 -07:00
|
|
|
all_moving_mobjects = self.camera.extract_mobject_family_members(
|
|
|
|
moving_mobjects
|
|
|
|
)
|
|
|
|
movement_indicators = self.camera.get_mobjects_indicating_movement()
|
|
|
|
for movement_indicator in movement_indicators:
|
|
|
|
if movement_indicator in all_moving_mobjects:
|
|
|
|
# When one of these is moving, the camera should
|
|
|
|
# consider all mobjects to be moving
|
|
|
|
return list_update(self.mobjects, moving_mobjects)
|
|
|
|
return moving_mobjects
|