Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Revert "edits that broke light.py"

Ben Hambrecht935ae923ca57
diff --git a/topics/light.py b/topics/light.py
index 46ff0c85f..15c15c5f9 100644
--- a/topics/light.py
+++ b/topics/light.py
@@ -18,7 +18,6 @@ from mobject.svg_mobject import *
from topics.three_dimensions import *
from scipy.spatial import ConvexHull
-from traceback import *
LIGHT_COLOR = YELLOW
@@ -80,7 +79,16 @@ class LightSource(VMobject):
max_opacity = self.max_opacity_ambient
)
if self.has_screen():
- self.create_spotlight()
+ self.spotlight = Spotlight(
+ source_point = VectorizedPoint(location = self.get_source_point()),
+ color = self.color,
+ num_levels = self.num_levels,
+ radius = self.radius,
+ screen = self.screen,
+ opacity_function = self.opacity_function,
+ max_opacity = self.max_opacity_spotlight,
+ camera = self.camera
+ )
else:
self.spotlight = Spotlight()
@@ -102,18 +110,6 @@ class LightSource(VMobject):
else:
return True
- def create_spotlight(self):
- self.spotlight = Spotlight(
- source_point = VectorizedPoint(location = self.get_source_point()),
- color = self.color,
- num_levels = self.num_levels,
- radius = self.radius,
- screen = self.screen,
- opacity_function = self.opacity_function,
- max_opacity = self.max_opacity_spotlight,
- camera = self.camera
- )
-
def dim_ambient(self):
self.set_max_opacity_ambient(AMBIENT_DIMMED)
@@ -134,15 +130,21 @@ class LightSource(VMobject):
def set_screen(self, new_screen):
- print "setting screen"
- print_stack()
if self.has_screen():
self.spotlight.screen = new_screen
else:
# Note: See below
index = self.submobjects.index(self.spotlight)
+ camera = self.spotlight.camera
self.remove(self.spotlight)
- self.create_spotlight()
+ self.spotlight = Spotlight(
+ source_point = VectorizedPoint(location = self.get_source_point()),
+ color = self.color,
+ num_levels = self.num_levels,
+ radius = self.radius,
+ screen = new_screen,
+ camera = self.camera
+ )
self.spotlight.move_source_to(self.get_source_point())
# Note: This line will make spotlight show up at the end