Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

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

Mehmet Mert Yildiran80256013ea4f
diff --git a/manim.py b/manim.py
index 26459d05f..c6cf22927 100644
--- a/manim.py
+++ b/manim.py
@@ -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,
}
diff --git a/scene/scene.py b/scene/scene.py
index a152334d3..f116cf525 100644
--- a/scene/scene.py
+++ b/scene/scene.py
@@ -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:
diff --git a/test1.py b/test1.py
index 23613c18b..6ec415571 100644
--- a/test1.py
+++ b/test1.py
@@ -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()