mirror of
https://github.com/3b1b/manim.git
synced 2025-08-21 05:44:04 +00:00
Fixed(?) Spotlight.update_sectors
This commit is contained in:
parent
ad13082b73
commit
ec4bf7b504
1 changed files with 7 additions and 14 deletions
|
@ -234,7 +234,6 @@ class LightSource(VMobject):
|
||||||
return R
|
return R
|
||||||
|
|
||||||
def update_shadow(self):
|
def update_shadow(self):
|
||||||
|
|
||||||
point = self.get_source_point()
|
point = self.get_source_point()
|
||||||
projected_screen_points = []
|
projected_screen_points = []
|
||||||
if not self.has_screen():
|
if not self.has_screen():
|
||||||
|
@ -304,7 +303,6 @@ class LightSource(VMobject):
|
||||||
self.shadow.mark_paths_closed = True
|
self.shadow.mark_paths_closed = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class SwitchOn(LaggedStart):
|
class SwitchOn(LaggedStart):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"lag_ratio": 0.2,
|
"lag_ratio": 0.2,
|
||||||
|
@ -318,7 +316,6 @@ class SwitchOn(LaggedStart):
|
||||||
self, FadeIn, light, **kwargs
|
self, FadeIn, light, **kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SwitchOff(LaggedStart):
|
class SwitchOff(LaggedStart):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"lag_ratio": 0.2,
|
"lag_ratio": 0.2,
|
||||||
|
@ -333,7 +330,6 @@ class SwitchOff(LaggedStart):
|
||||||
FadeOut, light, **kwargs)
|
FadeOut, light, **kwargs)
|
||||||
light.submobjects = light.submobjects[::-1]
|
light.submobjects = light.submobjects[::-1]
|
||||||
|
|
||||||
|
|
||||||
class Lighthouse(SVGMobject):
|
class Lighthouse(SVGMobject):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"file_name" : "lighthouse",
|
"file_name" : "lighthouse",
|
||||||
|
@ -473,11 +469,6 @@ class Spotlight(VMobject):
|
||||||
|
|
||||||
|
|
||||||
def new_sector(self,r,dr,lower_angle,upper_angle):
|
def new_sector(self,r,dr,lower_angle,upper_angle):
|
||||||
# Note: I'm not looking _too_ closely at the implementation
|
|
||||||
# of these updates based on viewing angles and such. It seems to
|
|
||||||
# behave as intended, but let me know if you'd like more thorough
|
|
||||||
# scrutiny
|
|
||||||
|
|
||||||
alpha = self.max_opacity * self.opacity_function(r)
|
alpha = self.max_opacity * self.opacity_function(r)
|
||||||
annular_sector = AnnularSector(
|
annular_sector = AnnularSector(
|
||||||
inner_radius = r,
|
inner_radius = r,
|
||||||
|
@ -564,15 +555,17 @@ class Spotlight(VMobject):
|
||||||
def update_sectors(self):
|
def update_sectors(self):
|
||||||
if self.screen == None:
|
if self.screen == None:
|
||||||
return
|
return
|
||||||
for submob in self.submobject_family():
|
for submob in self.submobjects:
|
||||||
if type(submob) == AnnularSector:
|
if type(submob) == AnnularSector:
|
||||||
lower_angle, upper_angle = self.viewing_angles(self.screen)
|
lower_angle, upper_angle = self.viewing_angles(self.screen)
|
||||||
#dr = submob.outer_radius - submob.inner_radius
|
#dr = submob.outer_radius - submob.inner_radius
|
||||||
dr = self.radius / self.num_levels
|
dr = self.radius / self.num_levels
|
||||||
new_submob = self.new_sector(submob.inner_radius,dr,lower_angle,upper_angle)
|
new_submob = self.new_sector(
|
||||||
submob.points = new_submob.points
|
submob.inner_radius, dr, lower_angle, upper_angle
|
||||||
submob.set_fill(opacity = 10 * self.opacity_function(submob.outer_radius))
|
)
|
||||||
|
# submob.points = new_submob.points
|
||||||
|
# submob.set_fill(opacity = 10 * self.opacity_function(submob.outer_radius))
|
||||||
|
Transform(submob, new_submob).update(1)
|
||||||
|
|
||||||
|
|
||||||
def dimming(self,new_alpha):
|
def dimming(self,new_alpha):
|
||||||
|
|
Loading…
Add table
Reference in a new issue