mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
Get rid of this color nonsense
This commit is contained in:
parent
58df38f74e
commit
3a111cf3af
1 changed files with 19 additions and 16 deletions
|
@ -62,7 +62,6 @@ class Mobject(Container):
|
|||
self.submobjects = []
|
||||
self.parents = []
|
||||
self.family = [self]
|
||||
self.color = Color(self.color)
|
||||
if self.name is None:
|
||||
self.name = self.__class__.__name__
|
||||
self.time_based_updaters = []
|
||||
|
@ -670,19 +669,30 @@ class Mobject(Container):
|
|||
|
||||
# Color functions
|
||||
|
||||
def set_color(self, color=YELLOW_C, family=True):
|
||||
"""
|
||||
Condition is function which takes in one arguments, (x, y, z).
|
||||
Here it just recurses to submobjects, but in subclasses this
|
||||
should be further implemented based on the the inner workings
|
||||
of color
|
||||
"""
|
||||
def set_color(self, color, family=True):
|
||||
# Here it just recurses to submobjects, but in subclasses this
|
||||
# should be further implemented based on the the inner workings
|
||||
# of color
|
||||
if family:
|
||||
for submob in self.submobjects:
|
||||
submob.set_color(color, family=family)
|
||||
self.color = color
|
||||
return self
|
||||
|
||||
def set_opacity(self, opacity, family=True):
|
||||
# Here it just recurses to submobjects, but in subclasses this
|
||||
# should be further implemented based on the the inner workings
|
||||
# of color
|
||||
if family:
|
||||
for submob in self.submobjects:
|
||||
submob.set_opacity(opacity, family=family)
|
||||
return self
|
||||
|
||||
def get_color(self):
|
||||
raise Exception("Not implemented")
|
||||
|
||||
def get_opacity(self):
|
||||
raise Exception("Not implemented")
|
||||
|
||||
def set_color_by_gradient(self, *colors):
|
||||
self.set_submobject_colors_by_gradient(*colors)
|
||||
return self
|
||||
|
@ -717,10 +727,6 @@ class Mobject(Container):
|
|||
|
||||
return self
|
||||
|
||||
def to_original_color(self):
|
||||
self.set_color(self.color)
|
||||
return self
|
||||
|
||||
def fade_to(self, color, alpha, family=True):
|
||||
if self.get_num_points() > 0:
|
||||
new_color = interpolate_color(
|
||||
|
@ -738,9 +744,6 @@ class Mobject(Container):
|
|||
submob.fade(darkness, family)
|
||||
return self
|
||||
|
||||
def get_color(self):
|
||||
return self.color
|
||||
|
||||
def get_gloss(self):
|
||||
return self.gloss
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue