|
9 | 9 | # Use -n <number> to skip ahead to the n'th animation of a scene. |
10 | 10 |
|
11 | 11 |
|
12 | | -class OpeningManimExample(Scene): |
| 12 | +class OpeningManimExample(InteractiveScene): |
13 | 13 | def construct(self): |
14 | 14 | intro_words = Text(""" |
15 | 15 | The original motivation for manim was to |
@@ -66,9 +66,10 @@ def construct(self): |
66 | 66 | run_time=6, |
67 | 67 | ) |
68 | 68 | self.wait(2) |
| 69 | + self.embed() |
69 | 70 |
|
70 | 71 |
|
71 | | -class AnimatingMethods(Scene): |
| 72 | +class AnimatingMethods(InteractiveScene): |
72 | 73 | def construct(self): |
73 | 74 | grid = Tex(R"\pi").get_grid(10, 10, height=4) |
74 | 75 | self.add(grid) |
@@ -110,9 +111,10 @@ def construct(self): |
110 | 111 | run_time=5, |
111 | 112 | ) |
112 | 113 | self.wait() |
| 114 | + self.embed() |
113 | 115 |
|
114 | 116 |
|
115 | | -class TextExample(Scene): |
| 117 | +class TextExample(InteractiveScene): |
116 | 118 | def construct(self): |
117 | 119 | # To run this scene properly, you should have "Consolas" font in your computer |
118 | 120 | # for full usage, you can see https://github.com/3b1b/manim/pull/680 |
@@ -151,9 +153,10 @@ def construct(self): |
151 | 153 | self.wait() |
152 | 154 | self.play(Write(slant)) |
153 | 155 | self.wait() |
| 156 | + self.embed() |
154 | 157 |
|
155 | 158 |
|
156 | | -class TexTransformExample(Scene): |
| 159 | +class TexTransformExample(InteractiveScene): |
157 | 160 | def construct(self): |
158 | 161 | # Tex to color map |
159 | 162 | t2c = { |
@@ -223,9 +226,10 @@ def construct(self): |
223 | 226 | self.wait() |
224 | 227 | self.play(TransformMatchingShapes(target, saved_source, **kw)) |
225 | 228 | self.wait() |
| 229 | + self.embed() |
226 | 230 |
|
227 | 231 |
|
228 | | -class TexIndexing(Scene): |
| 232 | +class TexIndexing(InteractiveScene): |
229 | 233 | def construct(self): |
230 | 234 | # You can index into Tex mobject (or other StringMobjects) by substrings |
231 | 235 | equation = Tex(R"e^{\pi i} = -1", font_size=144) |
@@ -276,9 +280,10 @@ def construct(self): |
276 | 280 | self.play(equation[R"\infty"].animate.set_color(RED)) # Got it! |
277 | 281 | self.wait() |
278 | 282 | self.play(FadeOut(equation)) |
| 283 | + self.embed() |
279 | 284 |
|
280 | 285 |
|
281 | | -class UpdatersExample(Scene): |
| 286 | +class UpdatersExample(InteractiveScene): |
282 | 287 | def construct(self): |
283 | 288 | square = Square() |
284 | 289 | square.set_fill(BLUE_E, 1) |
@@ -336,9 +341,10 @@ def construct(self): |
336 | 341 | lambda m: m.set_width(w0 * math.sin(self.time - now) + w0) |
337 | 342 | ) |
338 | 343 | self.wait(4 * PI) |
| 344 | + self.embed() |
339 | 345 |
|
340 | 346 |
|
341 | | -class CoordinateSystemExample(Scene): |
| 347 | +class CoordinateSystemExample(InteractiveScene): |
342 | 348 | def construct(self): |
343 | 349 | axes = Axes( |
344 | 350 | # x-axis ranges from -1 to 10, with a default step size of 1 |
@@ -415,9 +421,9 @@ def construct(self): |
415 | 421 |
|
416 | 422 | # Other coordinate systems you can play around with include |
417 | 423 | # ThreeDAxes, NumberPlane, and ComplexPlane. |
| 424 | + self.embed() |
418 | 425 |
|
419 | | - |
420 | | -class GraphExample(Scene): |
| 426 | +class GraphExample(InteractiveScene): |
421 | 427 | def construct(self): |
422 | 428 | axes = Axes((-3, 10), (-1, 8), height=6) |
423 | 429 | axes.add_coordinate_labels() |
@@ -493,9 +499,10 @@ def construct(self): |
493 | 499 | self.play(x_tracker.animate.set_value(4), run_time=3) |
494 | 500 | self.play(x_tracker.animate.set_value(-2), run_time=3) |
495 | 501 | self.wait() |
| 502 | + self.embed() |
496 | 503 |
|
497 | 504 |
|
498 | | -class TexAndNumbersExample(Scene): |
| 505 | +class TexAndNumbersExample(InteractiveScene): |
499 | 506 | def construct(self): |
500 | 507 | axes = Axes((-3, 3), (-3, 3), unit_size=1) |
501 | 508 | axes.to_edge(DOWN) |
@@ -561,9 +568,10 @@ def func(x, y): |
561 | 568 | ReplacementTransform(circle.copy(), new_curve), |
562 | 569 | circle.animate.set_stroke(width=1, opacity=0.5), |
563 | 570 | ) |
| 571 | + self.embed() |
564 | 572 |
|
565 | 573 |
|
566 | | -class SurfaceExample(ThreeDScene): |
| 574 | +class SurfaceExample(ThreeDScene, InteractiveScene): |
567 | 575 | def construct(self): |
568 | 576 | surface_text = Text("For 3d scenes, try using surfaces") |
569 | 577 | surface_text.fix_in_frame() |
@@ -643,9 +651,10 @@ def construct(self): |
643 | 651 |
|
644 | 652 | self.play(FadeTransform(light_text, drag_text)) |
645 | 653 | self.wait() |
| 654 | + self.embed() |
646 | 655 |
|
647 | 656 |
|
648 | | -class InteractiveDevelopment(Scene): |
| 657 | +class InteractiveDevelopment(InteractiveScene): |
649 | 658 | def construct(self): |
650 | 659 | circle = Circle() |
651 | 660 | circle.set_fill(BLUE, opacity=0.5) |
@@ -691,7 +700,7 @@ def construct(self): |
691 | 700 | always(circle.move_to, self.mouse_point) |
692 | 701 |
|
693 | 702 |
|
694 | | -class ControlsExample(Scene): |
| 703 | +class ControlsExample(InteractiveScene): |
695 | 704 | drag_to_pan = False |
696 | 705 |
|
697 | 706 | def setup(self): |
@@ -728,7 +737,7 @@ def text_updater(old_text): |
728 | 737 |
|
729 | 738 | self.textbox.set_value("Manim") |
730 | 739 | # self.wait(60) |
731 | | - # self.embed() |
| 740 | + self.embed() |
732 | 741 |
|
733 | 742 |
|
734 | 743 | # See https://github.com/3b1b/videos for many, many more |
0 commit comments