Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

freeze_background for scenes

Grant Sandersonc19b3138084c
diff --git a/camera.py b/camera.py
index 6ec9d1e36..39a2d7d9a 100644
--- a/camera.py
+++ b/camera.py
@@ -41,7 +41,7 @@ class Camera(object):
self.space_shape = (space_height, space_width)
def init_background(self):
- if self.background:
+ if self.background is not None:
self.pixel_shape = self.background.shape[:2]
else:
background_rgb = color_to_int_rgb(self.background_color)
diff --git a/scene/scene.py b/scene/scene.py
index 196959d36..0d01b22e7 100644
--- a/scene/scene.py
+++ b/scene/scene.py
@@ -60,6 +60,11 @@ class Scene(object):
else:
self.camera.reset()
self.camera.capture_mobjects(mobjects, **kwargs)
+
+ def freeze_background(self):
+ self.update_frame()
+ self.set_camera(Camera(self.get_frame()))
+ self.clear()
###
def add(self, *mobjects):