mirror of
https://github.com/jeertmans/manim-slides.git
synced 2025-05-20 12:05:56 +08:00
(WIP): Add 3D Scene example
This commit is contained in:
32
example.py
32
example.py
@ -1,5 +1,7 @@
|
|||||||
from manim import *
|
from manim import *
|
||||||
from manim_presentation import Slide
|
|
||||||
|
from manim_slides import Slide, ThreeDSlide
|
||||||
|
|
||||||
|
|
||||||
class Example(Slide):
|
class Example(Slide):
|
||||||
def construct(self):
|
def construct(self):
|
||||||
@ -16,13 +18,35 @@ class Example(Slide):
|
|||||||
self.play(dot.animate.move_to(ORIGIN))
|
self.play(dot.animate.move_to(ORIGIN))
|
||||||
self.pause()
|
self.pause()
|
||||||
|
|
||||||
self.play(dot.animate.move_to(RIGHT*3))
|
self.play(dot.animate.move_to(RIGHT * 3))
|
||||||
self.pause()
|
self.pause()
|
||||||
|
|
||||||
self.start_loop()
|
self.start_loop()
|
||||||
self.play(MoveAlongPath(dot, circle), run_time=2, rate_func=linear)
|
self.play(MoveAlongPath(dot, circle), run_time=2, rate_func=linear)
|
||||||
self.end_loop()
|
self.end_loop()
|
||||||
|
|
||||||
# Each slide MUST end with an animation (a self.wait is considered an animation)
|
# Each slide MUST end with an animation (a self.wait is considered an animation)
|
||||||
self.play(dot.animate.move_to(ORIGIN))
|
self.play(dot.animate.move_to(ORIGIN))
|
||||||
|
|
||||||
|
class ThreeDExample(ThreeDSlide):
|
||||||
|
def construct(self):
|
||||||
|
axes = ThreeDAxes()
|
||||||
|
circle=Circle()
|
||||||
|
|
||||||
|
self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)
|
||||||
|
self.add(circle,axes)
|
||||||
|
|
||||||
|
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.end_loop()
|
||||||
|
|
||||||
|
self.play(circle.animate.move_to(ORIGIN))
|
||||||
|
|
||||||
|
# TODO: fixit
|
||||||
|
Reference in New Issue
Block a user