mirror of
https://github.com/jeertmans/manim-slides.git
synced 2025-05-17 18:55:53 +08:00
Working 3DScene example
This commit is contained in:
@ -123,7 +123,7 @@ Here are a few things that I implemented (or that I'm planning to implement) on
|
||||
- [x] User can easily generate dummy config file
|
||||
- [x] Config file path can be manually set
|
||||
- [ ] Play animation in reverse [#9](https://github.com/galatolofederico/manim-presentation/issues/9)
|
||||
- [ ] Handle 3D scenes out of the box
|
||||
- [x] Handle 3D scenes out of the box
|
||||
- [ ] Can work with both community and 3b1b versions (not tested)
|
||||
- [ ] Generate docs online
|
||||
- [ ] Fix the quality problem on Windows platforms with `fullscreen` flag
|
||||
|
34
example.py
34
example.py
@ -32,22 +32,34 @@ class Example(Slide):
|
||||
class ThreeDExample(ThreeDSlide):
|
||||
def construct(self):
|
||||
axes = ThreeDAxes()
|
||||
circle = Circle()
|
||||
circle = Circle(radius=3, color=BLUE)
|
||||
dot = Dot(color=RED)
|
||||
|
||||
# self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)
|
||||
self.add(circle, axes)
|
||||
self.add(axes)
|
||||
|
||||
self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)
|
||||
|
||||
self.play(GrowFromCenter(circle))
|
||||
self.begin_ambient_camera_rotation(rate=75 * DEGREES / 4)
|
||||
|
||||
# self.begin_ambient_camera_rotation(rate=0.1)
|
||||
self.pause()
|
||||
|
||||
# self.stop_ambient_camera_rotation()
|
||||
# self.move_camera(phi=75 * DEGREES, theta=30 * DEGREES)
|
||||
self.wait()
|
||||
|
||||
self.start_loop()
|
||||
self.play(circle.animate.move_to(ORIGIN + UP))
|
||||
self.play(MoveAlongPath(dot, circle), run_time=4, rate_func=linear)
|
||||
self.end_loop()
|
||||
|
||||
self.play(circle.animate.move_to(ORIGIN))
|
||||
self.stop_ambient_camera_rotation()
|
||||
self.move_camera(phi=75 * DEGREES, theta=30 * DEGREES)
|
||||
|
||||
# TODO: fixit
|
||||
self.play(dot.animate.move_to(ORIGIN))
|
||||
self.pause()
|
||||
|
||||
self.play(dot.animate.move_to(RIGHT * 3))
|
||||
self.pause()
|
||||
|
||||
self.start_loop()
|
||||
self.play(MoveAlongPath(dot, circle), run_time=2, rate_func=linear)
|
||||
self.end_loop()
|
||||
|
||||
# Each slide MUST end with an animation (a self.wait is considered an animation)
|
||||
self.play(dot.animate.move_to(ORIGIN))
|
||||
|
@ -46,8 +46,6 @@ class Presentation:
|
||||
self.slides = config["slides"]
|
||||
self.files = config["files"]
|
||||
|
||||
print(self.slides)
|
||||
|
||||
self.lastframe = []
|
||||
|
||||
self.caps = [None for _ in self.files]
|
||||
|
@ -18,7 +18,6 @@ class Slide(Scene):
|
||||
self.pause_start_animation = 0
|
||||
|
||||
def play(self, *args, **kwargs):
|
||||
print("PLAY", *args, kwargs.items())
|
||||
super().play(*args, **kwargs)
|
||||
self.current_animation += 1
|
||||
|
||||
|
Reference in New Issue
Block a user