Add is_live_streaming control flow to idle the scene generation pipe for interactive shell usage purpose

This commit is contained in:
Mehmet Mert Yildiran 2018-10-30 09:00:51 +03:00
parent 5e8a2c8901
commit 80256013ea
3 changed files with 20 additions and 5 deletions

View file

@ -43,4 +43,5 @@ class Manim():
"skip_animations": False,
"camera_config": HIGH_QUALITY_CAMERA_CONFIG,
"frame_duration": PRODUCTION_QUALITY_FRAME_DURATION,
"is_live_streaming": True,
}

View file

@ -67,6 +67,8 @@ class Scene(Container):
self.setup()
if self.write_to_movie:
self.open_movie_pipe()
if self.is_live_streaming:
return None
try:
self.construct(*self.construct_args)
except EndSceneEarlyException:

View file

@ -6,8 +6,8 @@ class Shapes(Scene):
def construct(self):
circle = Circle()
square = Square()
line=Line(np.array([3,0,0]),np.array([5,0,0]))
triangle=Polygon(np.array([0,0,0]),np.array([1,1,0]),np.array([1,-1,0]))
line = Line(np.array([3,0,0]),np.array([5,0,0]))
triangle = Polygon(np.array([0,0,0]),np.array([1,1,0]),np.array([1,-1,0]))
self.add(line)
self.play(ShowCreation(circle))
@ -18,6 +18,18 @@ class Shapes(Scene):
#python3 extract_scene.py test1.py Shapes -r 1080
if __name__ == '__main__':
manim = Manim()
Shapes(**manim.config)
manim = Manim()
scene1 = Scene(**manim.config)
circle = Circle()
square = Square()
line = Line(np.array([3,0,0]),np.array([5,0,0]))
triangle = Polygon(np.array([0,0,0]),np.array([1,1,0]),np.array([1,-1,0]))
scene1.add(line)
scene1.play(ShowCreation(circle))
scene1.play(FadeOut(circle))
scene1.play(GrowFromCenter(square))
scene1.play(Transform(square,triangle))
scene1.close_movie_pipe()