Skip to content

Commit

Permalink
Added example to documentation for moving_camera_scene module (#3972)
Browse files Browse the repository at this point in the history
Co-authored-by: Xiuyuan <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tianxiong Dai <[email protected]>
  • Loading branch information
4 people authored Oct 24, 2024
1 parent d5b8b41 commit 327db11
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions manim/scene/moving_camera_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,25 @@ def construct(self):
self.play(Restore(self.camera.frame))
self.wait()
.. manim:: SlidingMultipleScenes
class SlidingMultipleScenes(MovingCameraScene):
def construct(self):
def create_scene(number):
frame = Rectangle(width=16,height=9)
circ = Circle().shift(LEFT)
text = Tex(f"This is Scene {str(number)}").next_to(circ, RIGHT)
frame.add(circ,text)
return frame
group = VGroup(*(create_scene(i) for i in range(4))).arrange_in_grid(buff=4)
self.add(group)
self.camera.auto_zoom(group[0], animate=False)
for scene in group:
self.play(self.camera.auto_zoom(scene))
self.wait()
self.play(self.camera.auto_zoom(group, margin=2))
"""

from __future__ import annotations
Expand All @@ -83,8 +102,12 @@ class MovingCameraScene(Scene):
This is a Scene, with special configurations and properties that
make it suitable for cases where the camera must be moved around.
Note: Examples are included in the moving_camera_scene module
documentation, see below in the 'see also' section.
.. SEEALSO::
:mod:`.moving_camera_scene`
:class:`.MovingCamera`
"""

Expand Down

0 comments on commit 327db11

Please sign in to comment.