Finished FirstLighthouseScene

This commit is contained in:
Grant Sanderson
2018-02-26 19:02:12 -08:00
parent 226f0153bd
commit 14f531086c
2 changed files with 207 additions and 119 deletions

View File

@ -128,7 +128,6 @@ class LightSource(VMobject):
self.camera_mob = new_cam_mob
self.spotlight.camera_mob = new_cam_mob
def set_screen(self, new_screen):
if self.has_screen():
self.spotlight.screen = new_screen
@ -158,9 +157,6 @@ class LightSource(VMobject):
# in any case
self.screen = new_screen
def move_source_to(self,point):
apoint = np.array(point)
v = apoint - self.get_source_point()
@ -190,7 +186,6 @@ class LightSource(VMobject):
self.spotlight.update_sectors()
self.update_shadow()
def update_lighthouse(self):
new_lh = Lighthouse()
new_lh.move_to(ORIGIN)
@ -198,7 +193,6 @@ class LightSource(VMobject):
new_lh.shift(self.get_source_point())
self.lighthouse.submobjects = new_lh.submobjects
def update_ambient(self):
new_ambient_light = AmbientLight(
source_point = VectorizedPoint(location = ORIGIN),
@ -212,12 +206,9 @@ class LightSource(VMobject):
new_ambient_light.move_source_to(self.get_source_point())
self.ambient_light.submobjects = new_ambient_light.submobjects
def get_source_point(self):
return self.source_point.get_location()
def rotation_matrix(self):
if self.camera_mob == None:
@ -242,7 +233,6 @@ class LightSource(VMobject):
R = np.dot(R2, R1)
return R
def update_shadow(self):
point = self.get_source_point()
@ -370,7 +360,7 @@ class AmbientLight(VMobject):
"opacity_function" : lambda r : 1.0/(r+1.0)**2,
"color" : LIGHT_COLOR,
"max_opacity" : 1.0,
"num_levels" : 10,
"num_levels" : NUM_LEVELS,
"radius" : 5.0
}