mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Update SurfaceExample to use ThreeDScene
This commit is contained in:
parent
5deef1c249
commit
dec5089777
1 changed files with 4 additions and 13 deletions
|
@ -554,9 +554,7 @@ class TexAndNumbersExample(Scene):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SurfaceExample(Scene):
|
class SurfaceExample(ThreeDScene):
|
||||||
samples = 4
|
|
||||||
|
|
||||||
def construct(self):
|
def construct(self):
|
||||||
surface_text = Text("For 3d scenes, try using surfaces")
|
surface_text = Text("For 3d scenes, try using surfaces")
|
||||||
surface_text.fix_in_frame()
|
surface_text.fix_in_frame()
|
||||||
|
@ -588,13 +586,6 @@ class SurfaceExample(Scene):
|
||||||
mob.mesh = SurfaceMesh(mob)
|
mob.mesh = SurfaceMesh(mob)
|
||||||
mob.mesh.set_stroke(BLUE, 1, opacity=0.5)
|
mob.mesh.set_stroke(BLUE, 1, opacity=0.5)
|
||||||
|
|
||||||
# Set perspective
|
|
||||||
frame = self.camera.frame
|
|
||||||
frame.set_euler_angles(
|
|
||||||
theta=-30 * DEGREES,
|
|
||||||
phi=70 * DEGREES,
|
|
||||||
)
|
|
||||||
|
|
||||||
surface = surfaces[0]
|
surface = surfaces[0]
|
||||||
|
|
||||||
self.play(
|
self.play(
|
||||||
|
@ -616,12 +607,12 @@ class SurfaceExample(Scene):
|
||||||
self.play(
|
self.play(
|
||||||
Transform(surface, surfaces[2]),
|
Transform(surface, surfaces[2]),
|
||||||
# Move camera frame during the transition
|
# Move camera frame during the transition
|
||||||
frame.animate.increment_phi(-10 * DEGREES),
|
self.frame.animate.increment_phi(-10 * DEGREES),
|
||||||
frame.animate.increment_theta(-20 * DEGREES),
|
self.frame.animate.increment_theta(-20 * DEGREES),
|
||||||
run_time=3
|
run_time=3
|
||||||
)
|
)
|
||||||
# Add ambient rotation
|
# Add ambient rotation
|
||||||
frame.add_updater(lambda m, dt: m.increment_theta(-0.1 * dt))
|
self.frame.add_updater(lambda m, dt: m.increment_theta(-0.1 * dt))
|
||||||
|
|
||||||
# Play around with where the light is
|
# Play around with where the light is
|
||||||
light_text = Text("You can move around the light source")
|
light_text = Text("You can move around the light source")
|
||||||
|
|
Loading…
Add table
Reference in a new issue