mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Bug fix to MoreFiltersMoreLight
This commit is contained in:
parent
231df4740f
commit
4c1282af7b
1 changed files with 33 additions and 18 deletions
45
bell.py
45
bell.py
|
@ -178,7 +178,6 @@ class PhotonPassesCompletelyOrNotAtAll(DirectionOfPolarization):
|
||||||
self.remove(self.em_wave)
|
self.remove(self.em_wave)
|
||||||
|
|
||||||
def construct(self):
|
def construct(self):
|
||||||
|
|
||||||
pol_filter = self.pol_filter
|
pol_filter = self.pol_filter
|
||||||
label = pol_filter.label
|
label = pol_filter.label
|
||||||
pol_filter.remove(label)
|
pol_filter.remove(label)
|
||||||
|
@ -314,26 +313,43 @@ class MoreFiltersMoreLight(FilterScene):
|
||||||
}
|
}
|
||||||
def construct(self):
|
def construct(self):
|
||||||
self.remove(self.axes)
|
self.remove(self.axes)
|
||||||
pfs = self.pol_filters
|
pfs = VGroup(*reversed(self.pol_filters))
|
||||||
self.color_filters(pfs)
|
self.color_filters(pfs)
|
||||||
self.remove(pfs)
|
self.remove(pfs)
|
||||||
self.build_color_map(pfs)
|
self.build_color_map(pfs)
|
||||||
self.add(pfs[4], pfs[2], pfs[0])
|
self.add(pfs[0], pfs[2], pfs[4])
|
||||||
|
pfs.center().scale(1.5)
|
||||||
|
|
||||||
self.move_camera(
|
self.move_camera(
|
||||||
phi = 0.9*np.pi/2,
|
phi = 0.9*np.pi/2,
|
||||||
theta = -0.95*np.pi,
|
theta = -0.95*np.pi,
|
||||||
)
|
)
|
||||||
self.dither()
|
|
||||||
for i in 1, 3:
|
|
||||||
pf = pfs[i]
|
|
||||||
foreground = VGroup(*reversed(pfs[:i]))
|
|
||||||
pf.save_state()
|
|
||||||
pf.shift(6*OUT)
|
|
||||||
self.remove(foreground)
|
|
||||||
self.play(
|
self.play(
|
||||||
pf.restore,
|
Animation(pfs[0]),
|
||||||
Animation(foreground),
|
pfs[2].shift, 3*OUT,
|
||||||
|
Animation(pfs[4]),
|
||||||
|
)
|
||||||
|
self.dither()
|
||||||
|
self.play(
|
||||||
|
Animation(pfs[0]),
|
||||||
|
pfs[2].shift, 3*IN,
|
||||||
|
Animation(pfs[4]),
|
||||||
|
)
|
||||||
|
|
||||||
|
pfs[1].shift(8*OUT)
|
||||||
|
self.play(
|
||||||
|
Animation(pfs[0]),
|
||||||
|
pfs[1].shift, 8*IN,
|
||||||
|
Animation(VGroup(pfs[2], pfs[4])),
|
||||||
|
run_time = 2
|
||||||
|
)
|
||||||
|
self.dither()
|
||||||
|
|
||||||
|
pfs[3].shift(8*OUT)
|
||||||
|
self.play(
|
||||||
|
Animation(VGroup(*pfs[:3])),
|
||||||
|
pfs[3].shift, 8*IN,
|
||||||
|
Animation(VGroup(*pfs[4:])),
|
||||||
run_time = 2
|
run_time = 2
|
||||||
)
|
)
|
||||||
self.dither()
|
self.dither()
|
||||||
|
@ -354,7 +370,7 @@ class MoreFiltersMoreLight(FilterScene):
|
||||||
for bool_array in it.product(*5*[[True, False]]):
|
for bool_array in it.product(*5*[[True, False]]):
|
||||||
pfs_to_use = VGroup(*[
|
pfs_to_use = VGroup(*[
|
||||||
pf
|
pf
|
||||||
for pf, b in reversed(zip(pfs, bool_array))
|
for pf, b in zip(pfs, bool_array)
|
||||||
if b
|
if b
|
||||||
])
|
])
|
||||||
self.camera.capture_mobject(pfs_to_use)
|
self.camera.capture_mobject(pfs_to_use)
|
||||||
|
@ -387,10 +403,9 @@ class MoreFiltersMoreLight(FilterScene):
|
||||||
lambda b1, b2 : b1 | b2,
|
lambda b1, b2 : b1 | b2,
|
||||||
bool_arrays
|
bool_arrays
|
||||||
)
|
)
|
||||||
frame[~covered] = [127, 127, 127]
|
frame[~covered] = [65, 65, 65]
|
||||||
return frame
|
return frame
|
||||||
|
|
||||||
|
|
||||||
class ConfusedPiCreature(Scene):
|
class ConfusedPiCreature(Scene):
|
||||||
def construct(self):
|
def construct(self):
|
||||||
randy = Randolph()
|
randy = Randolph()
|
||||||
|
|
Loading…
Add table
Reference in a new issue