mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Replaced background_alpha with background_opacity
This commit is contained in:
parent
d36a68f756
commit
80176f0940
7 changed files with 16 additions and 15 deletions
|
@ -206,7 +206,7 @@ class LeaveItToComputers(TeacherStudentsScene):
|
||||||
|
|
||||||
class PrerequisiteKnowledge(TeacherStudentsScene):
|
class PrerequisiteKnowledge(TeacherStudentsScene):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"camera_config": {"background_alpha": 255}
|
"camera_config": {"background_opacity": 1}
|
||||||
}
|
}
|
||||||
|
|
||||||
def construct(self):
|
def construct(self):
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Camera(object):
|
||||||
"frame_shape": (FRAME_HEIGHT, FRAME_WIDTH),
|
"frame_shape": (FRAME_HEIGHT, FRAME_WIDTH),
|
||||||
"space_center": ORIGIN,
|
"space_center": ORIGIN,
|
||||||
"background_color": BLACK,
|
"background_color": BLACK,
|
||||||
"background_alpha": 0, # Out of rgb_max_val
|
"background_opacity": 0,
|
||||||
# Points in vectorized mobjects with norm greater
|
# Points in vectorized mobjects with norm greater
|
||||||
# than this value will be rescaled.
|
# than this value will be rescaled.
|
||||||
"max_allowable_norm": FRAME_WIDTH,
|
"max_allowable_norm": FRAME_WIDTH,
|
||||||
|
@ -94,7 +94,7 @@ class Camera(object):
|
||||||
self.background = self.background.astype(self.pixel_array_dtype)
|
self.background = self.background.astype(self.pixel_array_dtype)
|
||||||
else:
|
else:
|
||||||
background_rgba = color_to_int_rgba(
|
background_rgba = color_to_int_rgba(
|
||||||
self.background_color, alpha=self.background_alpha
|
self.background_color, self.background_opacity
|
||||||
)
|
)
|
||||||
self.background = np.zeros(
|
self.background = np.zeros(
|
||||||
list(self.pixel_shape) + [self.n_rgb_coords],
|
list(self.pixel_shape) + [self.n_rgb_coords],
|
||||||
|
@ -115,10 +115,10 @@ class Camera(object):
|
||||||
retval = np.array(pixel_array)
|
retval = np.array(pixel_array)
|
||||||
if convert_from_floats:
|
if convert_from_floats:
|
||||||
retval = np.apply_along_axis(
|
retval = np.apply_along_axis(
|
||||||
lambda f: (
|
lambda f: (f * self.rgb_max_val).astype(self.pixel_array_dtype),
|
||||||
f * self.rgb_max_val).astype(self.pixel_array_dtype),
|
|
||||||
2,
|
2,
|
||||||
retval)
|
retval
|
||||||
|
)
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
def set_pixel_array(self, pixel_array, convert_from_floats=False):
|
def set_pixel_array(self, pixel_array, convert_from_floats=False):
|
||||||
|
|
|
@ -2884,7 +2884,7 @@ class ZeroFoundOnBoundary(Scene):
|
||||||
class AllOfTheVideos(Scene):
|
class AllOfTheVideos(Scene):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"camera_config" : {
|
"camera_config" : {
|
||||||
"background_alpha" : 255,
|
"background_opacity" : 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def construct(self):
|
def construct(self):
|
||||||
|
|
|
@ -1479,7 +1479,7 @@ class AskAboutLayers(PreviewMNistNetwork):
|
||||||
|
|
||||||
class BreakUpMacroPatterns(IntroduceEachLayer):
|
class BreakUpMacroPatterns(IntroduceEachLayer):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"camera_config" : {"background_alpha" : 255},
|
"camera_config" : {"background_opacity" : 1},
|
||||||
"prefixes" : [
|
"prefixes" : [
|
||||||
"nine", "eight", "four",
|
"nine", "eight", "four",
|
||||||
"upper_loop", "right_line",
|
"upper_loop", "right_line",
|
||||||
|
@ -1868,7 +1868,7 @@ class BreakUpMicroPatterns(BreakUpMacroPatterns):
|
||||||
class SecondLayerIsLittleEdgeLayer(IntroduceEachLayer):
|
class SecondLayerIsLittleEdgeLayer(IntroduceEachLayer):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"camera_config" : {
|
"camera_config" : {
|
||||||
"background_alpha" : 255,
|
"background_opacity" : 1,
|
||||||
},
|
},
|
||||||
"network_mob_config" : {
|
"network_mob_config" : {
|
||||||
"layer_to_layer_buff" : 2,
|
"layer_to_layer_buff" : 2,
|
||||||
|
@ -2081,7 +2081,7 @@ class SecondLayerIsLittleEdgeLayer(IntroduceEachLayer):
|
||||||
|
|
||||||
class EdgeDetection(Scene):
|
class EdgeDetection(Scene):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"camera_config" : {"background_alpha" : 255}
|
"camera_config" : {"background_opacity" : 1}
|
||||||
}
|
}
|
||||||
def construct(self):
|
def construct(self):
|
||||||
lion = ImageMobject("Lion")
|
lion = ImageMobject("Lion")
|
||||||
|
|
|
@ -468,7 +468,7 @@ class TauFalls(Scene):
|
||||||
class EulerWrites628(Scene):
|
class EulerWrites628(Scene):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"camera_config" : {
|
"camera_config" : {
|
||||||
"background_alpha" : 255,
|
"background_opacity" : 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def construct(self):
|
def construct(self):
|
||||||
|
@ -548,7 +548,7 @@ class EulerWrites628(Scene):
|
||||||
class HeroAndVillain(Scene):
|
class HeroAndVillain(Scene):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"camera_config" : {
|
"camera_config" : {
|
||||||
"background_alpha" : 255,
|
"background_opacity" : 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def construct(self):
|
def construct(self):
|
||||||
|
@ -987,7 +987,7 @@ class SpecialThanks(Scene):
|
||||||
class EndScene(PatreonEndScreen):
|
class EndScene(PatreonEndScreen):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"camera_config" : {
|
"camera_config" : {
|
||||||
"background_alpha" : 255,
|
"background_opacity" : 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def construct(self):
|
def construct(self):
|
||||||
|
|
|
@ -4958,7 +4958,7 @@ class KeeperAndSailorForSineProduct(KeeperAndSailor):
|
||||||
|
|
||||||
class Conclusion(TeacherStudentsScene):
|
class Conclusion(TeacherStudentsScene):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"camera_config": {"background_alpha": 255},
|
"camera_config": {"background_opacity": 1},
|
||||||
}
|
}
|
||||||
|
|
||||||
def construct(self):
|
def construct(self):
|
||||||
|
|
|
@ -39,7 +39,8 @@ def color_to_int_rgb(color):
|
||||||
return (255 * color_to_rgb(color)).astype('uint8')
|
return (255 * color_to_rgb(color)).astype('uint8')
|
||||||
|
|
||||||
|
|
||||||
def color_to_int_rgba(color, alpha=255):
|
def color_to_int_rgba(color, opacity=1.0):
|
||||||
|
alpha = int(255 * opacity)
|
||||||
return np.append(color_to_int_rgb(color), alpha)
|
return np.append(color_to_int_rgb(color), alpha)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue