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):
|
||||
samples = 4
|
||||
|
||||
class SurfaceExample(ThreeDScene):
|
||||
def construct(self):
|
||||
surface_text = Text("For 3d scenes, try using surfaces")
|
||||
surface_text.fix_in_frame()
|
||||
|
@ -588,13 +586,6 @@ class SurfaceExample(Scene):
|
|||
mob.mesh = SurfaceMesh(mob)
|
||||
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]
|
||||
|
||||
self.play(
|
||||
|
@ -616,12 +607,12 @@ class SurfaceExample(Scene):
|
|||
self.play(
|
||||
Transform(surface, surfaces[2]),
|
||||
# Move camera frame during the transition
|
||||
frame.animate.increment_phi(-10 * DEGREES),
|
||||
frame.animate.increment_theta(-20 * DEGREES),
|
||||
self.frame.animate.increment_phi(-10 * DEGREES),
|
||||
self.frame.animate.increment_theta(-20 * DEGREES),
|
||||
run_time=3
|
||||
)
|
||||
# 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
|
||||
light_text = Text("You can move around the light source")
|
||||
|
|
Loading…
Add table
Reference in a new issue