Skip to content

Commit 1720a7d

Browse files
committed
Working 3DScene example
1 parent d9eab15 commit 1720a7d

File tree

4 files changed

+24
-15
lines changed

4 files changed

+24
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Here are a few things that I implemented (or that I'm planning to implement) on
123123
- [x] User can easily generate dummy config file
124124
- [x] Config file path can be manually set
125125
- [ ] Play animation in reverse [#9](https://github.com/galatolofederico/manim-presentation/issues/9)
126-
- [ ] Handle 3D scenes out of the box
126+
- [x] Handle 3D scenes out of the box
127127
- [ ] Can work with both community and 3b1b versions (not tested)
128128
- [ ] Generate docs online
129129
- [ ] Fix the quality problem on Windows platforms with `fullscreen` flag

example.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,34 @@ def construct(self):
3232
class ThreeDExample(ThreeDSlide):
3333
def construct(self):
3434
axes = ThreeDAxes()
35-
circle = Circle()
35+
circle = Circle(radius=3, color=BLUE)
36+
dot = Dot(color=RED)
3637

37-
# self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)
38-
self.add(circle, axes)
38+
self.add(axes)
3939

40-
# self.begin_ambient_camera_rotation(rate=0.1)
41-
self.pause()
40+
self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)
4241

43-
# self.stop_ambient_camera_rotation()
44-
# self.move_camera(phi=75 * DEGREES, theta=30 * DEGREES)
45-
self.wait()
42+
self.play(GrowFromCenter(circle))
43+
self.begin_ambient_camera_rotation(rate=75 * DEGREES / 4)
44+
45+
self.pause()
4646

4747
self.start_loop()
48-
self.play(circle.animate.move_to(ORIGIN + UP))
48+
self.play(MoveAlongPath(dot, circle), run_time=4, rate_func=linear)
4949
self.end_loop()
5050

51-
self.play(circle.animate.move_to(ORIGIN))
51+
self.stop_ambient_camera_rotation()
52+
self.move_camera(phi=75 * DEGREES, theta=30 * DEGREES)
5253

53-
# TODO: fixit
54+
self.play(dot.animate.move_to(ORIGIN))
55+
self.pause()
56+
57+
self.play(dot.animate.move_to(RIGHT * 3))
58+
self.pause()
59+
60+
self.start_loop()
61+
self.play(MoveAlongPath(dot, circle), run_time=2, rate_func=linear)
62+
self.end_loop()
63+
64+
# Each slide MUST end with an animation (a self.wait is considered an animation)
65+
self.play(dot.animate.move_to(ORIGIN))

manim_slides/present.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ def __init__(self, config, last_frame_next: bool = False):
4646
self.slides = config["slides"]
4747
self.files = config["files"]
4848

49-
print(self.slides)
50-
5149
self.lastframe = []
5250

5351
self.caps = [None for _ in self.files]

manim_slides/slide.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def __init__(self, *args, output_folder=FOLDER_PATH, **kwargs):
1818
self.pause_start_animation = 0
1919

2020
def play(self, *args, **kwargs):
21-
print("PLAY", *args, kwargs.items())
2221
super().play(*args, **kwargs)
2322
self.current_animation += 1
2423

0 commit comments

Comments
 (0)