MCPcopy
hub / github.com/3b1b/manim / construct

Method construct

example_scenes.py:649–691  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

647
648class InteractiveDevelopment(Scene):
649 def construct(self):
650 circle = Circle()
651 circle.set_fill(BLUE, opacity=0.5)
652 circle.set_stroke(BLUE_E, width=4)
653 square = Square()
654
655 self.play(ShowCreation(square))
656 self.wait()
657
658 # This opens an iPython terminal where you can keep writing
659 # lines as if they were part of this construct method.
660 # In particular, 'square', 'circle' and 'self' will all be
661 # part of the local namespace in that terminal.
662 self.embed()
663
664 # Try copying and pasting some of the lines below into
665 # the interactive shell
666 self.play(ReplacementTransform(square, circle))
667 self.wait()
668 self.play(circle.animate.stretch(4, 0))
669 self.play(Rotate(circle, 90 * DEG))
670 self.play(circle.animate.shift(2 * RIGHT).scale(0.25))
671
672 text = Text("""
673 In general, using the interactive shell
674 is very helpful when developing new scenes
675 """)
676 self.play(Write(text))
677
678 # In the interactive shell, you can just type
679 # play, add, remove, clear, wait, save_state and restore,
680 # instead of self.play, self.add, self.remove, etc.
681
682 # To interact with the window, type touch(). You can then
683 # scroll in the window, or zoom by holding down 'z' while scrolling,
684 # and change camera perspective by holding down 'd' while moving
685 # the mouse. Press 'r' to reset to the standard camera position.
686 # Press 'q' to stop interacting with the window and go back to
687 # typing new commands into the shell.
688
689 # In principle you can customize a scene to be responsive to
690 # mouse and keyboard interactions
691 always(circle.move_to, self.mouse_point)
692
693
694class ControlsExample(Scene):

Callers

nothing calls this directly

Calls 15

CircleClass · 0.85
SquareClass · 0.85
ShowCreationClass · 0.85
RotateClass · 0.85
TextClass · 0.85
WriteClass · 0.85
alwaysFunction · 0.85
set_fillMethod · 0.80
playMethod · 0.80
waitMethod · 0.80
embedMethod · 0.80

Tested by

no test coverage detected