|
3 | 3 | import os
|
4 | 4 | from pathlib import Path
|
5 | 5 |
|
| 6 | + |
6 | 7 | # Copied from https://3b1b.github.io/manim/getting_started/example_scenes.html#surfaceexample.
|
7 | 8 | # Lines that do not yet work with the Community Version are commented.
|
| 9 | + |
| 10 | + |
| 11 | +class InteractiveDevelopment(Scene): |
| 12 | + def construct(self): |
| 13 | + circle = OpenGLCircle() |
| 14 | + circle.set_fill(BLUE, opacity=0.5) |
| 15 | + circle.set_stroke(BLUE_E, width=4) |
| 16 | + square = OpenGLSquare() |
| 17 | + |
| 18 | + self.play(ShowCreation(square)) |
| 19 | + self.wait() |
| 20 | + |
| 21 | + # This opens an iPython termnial where you can keep writing |
| 22 | + # lines as if they were part of this construct method. |
| 23 | + # In particular, 'square', 'circle' and 'self' will all be |
| 24 | + # part of the local namespace in that terminal. |
| 25 | + self.embed() |
| 26 | + |
| 27 | + # Try copying and pasting some of the lines below into |
| 28 | + # the interactive shell |
| 29 | + self.play(ReplacementTransform(square, circle)) |
| 30 | + self.wait() |
| 31 | + self.play(circle.animate.stretch(4, 0)) |
| 32 | + self.play(Rotate(circle, 90 * DEGREES)) |
| 33 | + self.play(circle.animate.shift(2 * RIGHT).scale(0.25)) |
| 34 | + |
| 35 | + # text = Text(""" |
| 36 | + # In general, using the interactive shell |
| 37 | + # is very helpful when developing new scenes |
| 38 | + # """) |
| 39 | + # self.play(Write(text)) |
| 40 | + |
| 41 | + # # In the interactive shell, you can just type |
| 42 | + # # play, add, remove, clear, wait, save_state and restore, |
| 43 | + # # instead of self.play, self.add, self.remove, etc. |
| 44 | + |
| 45 | + # # To interact with the window, type touch(). You can then |
| 46 | + # # scroll in the window, or zoom by holding down 'z' while scrolling, |
| 47 | + # # and change camera perspective by holding down 'd' while moving |
| 48 | + # # the mouse. Press 'r' to reset to the standard camera position. |
| 49 | + # # Press 'q' to stop interacting with the window and go back to |
| 50 | + # # typing new commands into the shell. |
| 51 | + |
| 52 | + # # In principle you can customize a scene to be responsive to |
| 53 | + # # mouse and keyboard interactions |
| 54 | + # always(circle.move_to, self.mouse_point) |
| 55 | + |
| 56 | + |
8 | 57 | class SurfaceExample(Scene):
|
9 | 58 | def construct(self):
|
10 | 59 | # surface_text = Text("For 3d scenes, try using surfaces")
|
|
0 commit comments