Skip to content

Commit 327db11

Browse files
Jackyuanxu7678992pre-commit-ci[bot]TahitiX
authored
Added example to documentation for moving_camera_scene module (#3972)
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]>
1 parent d5b8b41 commit 327db11

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

manim/scene/moving_camera_scene.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,25 @@ def construct(self):
6464
self.play(Restore(self.camera.frame))
6565
self.wait()
6666
67+
.. manim:: SlidingMultipleScenes
68+
69+
class SlidingMultipleScenes(MovingCameraScene):
70+
def construct(self):
71+
def create_scene(number):
72+
frame = Rectangle(width=16,height=9)
73+
circ = Circle().shift(LEFT)
74+
text = Tex(f"This is Scene {str(number)}").next_to(circ, RIGHT)
75+
frame.add(circ,text)
76+
return frame
77+
78+
group = VGroup(*(create_scene(i) for i in range(4))).arrange_in_grid(buff=4)
79+
self.add(group)
80+
self.camera.auto_zoom(group[0], animate=False)
81+
for scene in group:
82+
self.play(self.camera.auto_zoom(scene))
83+
self.wait()
84+
85+
self.play(self.camera.auto_zoom(group, margin=2))
6786
"""
6887

6988
from __future__ import annotations
@@ -83,8 +102,12 @@ class MovingCameraScene(Scene):
83102
This is a Scene, with special configurations and properties that
84103
make it suitable for cases where the camera must be moved around.
85104
105+
Note: Examples are included in the moving_camera_scene module
106+
documentation, see below in the 'see also' section.
107+
86108
.. SEEALSO::
87109
110+
:mod:`.moving_camera_scene`
88111
:class:`.MovingCamera`
89112
"""
90113

0 commit comments

Comments
 (0)