mirror of
https://github.com/3b1b/manim.git
synced 2025-07-30 05:24:22 +08:00
Replaced background_alpha with background_opacity
This commit is contained in:
@ -206,7 +206,7 @@ class LeaveItToComputers(TeacherStudentsScene):
|
||||
|
||||
class PrerequisiteKnowledge(TeacherStudentsScene):
|
||||
CONFIG = {
|
||||
"camera_config": {"background_alpha": 255}
|
||||
"camera_config": {"background_opacity": 1}
|
||||
}
|
||||
|
||||
def construct(self):
|
||||
|
@ -34,7 +34,7 @@ class Camera(object):
|
||||
"frame_shape": (FRAME_HEIGHT, FRAME_WIDTH),
|
||||
"space_center": ORIGIN,
|
||||
"background_color": BLACK,
|
||||
"background_alpha": 0, # Out of rgb_max_val
|
||||
"background_opacity": 0,
|
||||
# Points in vectorized mobjects with norm greater
|
||||
# than this value will be rescaled.
|
||||
"max_allowable_norm": FRAME_WIDTH,
|
||||
@ -94,7 +94,7 @@ class Camera(object):
|
||||
self.background = self.background.astype(self.pixel_array_dtype)
|
||||
else:
|
||||
background_rgba = color_to_int_rgba(
|
||||
self.background_color, alpha=self.background_alpha
|
||||
self.background_color, self.background_opacity
|
||||
)
|
||||
self.background = np.zeros(
|
||||
list(self.pixel_shape) + [self.n_rgb_coords],
|
||||
@ -115,10 +115,10 @@ class Camera(object):
|
||||
retval = np.array(pixel_array)
|
||||
if convert_from_floats:
|
||||
retval = np.apply_along_axis(
|
||||
lambda f: (
|
||||
f * self.rgb_max_val).astype(self.pixel_array_dtype),
|
||||
lambda f: (f * self.rgb_max_val).astype(self.pixel_array_dtype),
|
||||
2,
|
||||
retval)
|
||||
retval
|
||||
)
|
||||
return retval
|
||||
|
||||
def set_pixel_array(self, pixel_array, convert_from_floats=False):
|
||||
|
@ -2884,7 +2884,7 @@ class ZeroFoundOnBoundary(Scene):
|
||||
class AllOfTheVideos(Scene):
|
||||
CONFIG = {
|
||||
"camera_config" : {
|
||||
"background_alpha" : 255,
|
||||
"background_opacity" : 1,
|
||||
}
|
||||
}
|
||||
def construct(self):
|
||||
|
@ -1479,7 +1479,7 @@ class AskAboutLayers(PreviewMNistNetwork):
|
||||
|
||||
class BreakUpMacroPatterns(IntroduceEachLayer):
|
||||
CONFIG = {
|
||||
"camera_config" : {"background_alpha" : 255},
|
||||
"camera_config" : {"background_opacity" : 1},
|
||||
"prefixes" : [
|
||||
"nine", "eight", "four",
|
||||
"upper_loop", "right_line",
|
||||
@ -1868,7 +1868,7 @@ class BreakUpMicroPatterns(BreakUpMacroPatterns):
|
||||
class SecondLayerIsLittleEdgeLayer(IntroduceEachLayer):
|
||||
CONFIG = {
|
||||
"camera_config" : {
|
||||
"background_alpha" : 255,
|
||||
"background_opacity" : 1,
|
||||
},
|
||||
"network_mob_config" : {
|
||||
"layer_to_layer_buff" : 2,
|
||||
@ -2081,7 +2081,7 @@ class SecondLayerIsLittleEdgeLayer(IntroduceEachLayer):
|
||||
|
||||
class EdgeDetection(Scene):
|
||||
CONFIG = {
|
||||
"camera_config" : {"background_alpha" : 255}
|
||||
"camera_config" : {"background_opacity" : 1}
|
||||
}
|
||||
def construct(self):
|
||||
lion = ImageMobject("Lion")
|
||||
|
@ -468,7 +468,7 @@ class TauFalls(Scene):
|
||||
class EulerWrites628(Scene):
|
||||
CONFIG = {
|
||||
"camera_config" : {
|
||||
"background_alpha" : 255,
|
||||
"background_opacity" : 1,
|
||||
}
|
||||
}
|
||||
def construct(self):
|
||||
@ -548,7 +548,7 @@ class EulerWrites628(Scene):
|
||||
class HeroAndVillain(Scene):
|
||||
CONFIG = {
|
||||
"camera_config" : {
|
||||
"background_alpha" : 255,
|
||||
"background_opacity" : 1,
|
||||
}
|
||||
}
|
||||
def construct(self):
|
||||
@ -987,7 +987,7 @@ class SpecialThanks(Scene):
|
||||
class EndScene(PatreonEndScreen):
|
||||
CONFIG = {
|
||||
"camera_config" : {
|
||||
"background_alpha" : 255,
|
||||
"background_opacity" : 1,
|
||||
}
|
||||
}
|
||||
def construct(self):
|
||||
|
@ -4958,7 +4958,7 @@ class KeeperAndSailorForSineProduct(KeeperAndSailor):
|
||||
|
||||
class Conclusion(TeacherStudentsScene):
|
||||
CONFIG = {
|
||||
"camera_config": {"background_alpha": 255},
|
||||
"camera_config": {"background_opacity": 1},
|
||||
}
|
||||
|
||||
def construct(self):
|
||||
|
@ -39,7 +39,8 @@ def color_to_int_rgb(color):
|
||||
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)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user