MCPcopy
hub / github.com/ManimCommunity/manim / construct

Method construct

example_scenes/opengl.py:400–444  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

398
399class InteractiveDevelopment(Scene):
400 def construct(self):
401 circle = Circle()
402 circle.set_fill(BLUE, opacity=0.5)
403 circle.set_stroke(BLUE_E, width=4)
404 square = Square()
405
406 self.play(Create(square))
407 self.wait()
408
409 # This opens an iPython terminal where you can keep writing
410 # lines as if they were part of this construct method.
411 # In particular, 'square', 'circle' and 'self' will all be
412 # part of the local namespace in that terminal.
413 # self.embed()
414
415 # Try copying and pasting some of the lines below into
416 # the interactive shell
417 self.play(ReplacementTransform(square, circle))
418 self.wait()
419 self.play(circle.animate.stretch(4, 0))
420 self.play(Rotate(circle, 90 * DEGREES))
421 self.play(circle.animate.shift(2 * RIGHT).scale(0.25))
422
423 # text = Text(
424 # """
425 # In general, using the interactive shell
426 # is very helpful when developing new scenes
427 # """
428 # )
429 # self.play(Write(text))
430
431 # # In the interactive shell, you can just type
432 # # play, add, remove, clear, wait, save_state and restore,
433 # # instead of self.play, self.add, self.remove, etc.
434
435 # # To interact with the window, type touch(). You can then
436 # # scroll in the window, or zoom by holding down 'z' while scrolling,
437 # # and change camera perspective by holding down 'd' while moving
438 # # the mouse. Press 'r' to reset to the standard camera position.
439 # # Press 'q' to stop interacting with the window and go back to
440 # # typing new commands into the shell.
441
442 # # In principle you can customize a scene to be responsive to
443 # # mouse and keyboard interactions
444 # always(circle.move_to, self.mouse_point)
445
446
447class SurfaceExample(Scene):

Callers

nothing calls this directly

Calls 12

CircleClass · 0.85
SquareClass · 0.85
CreateClass · 0.85
RotateClass · 0.85
waitMethod · 0.80
set_fillMethod · 0.45
set_strokeMethod · 0.45
playMethod · 0.45
stretchMethod · 0.45
scaleMethod · 0.45
shiftMethod · 0.45

Tested by

no test coverage detected