Get rid of this color nonsense

This commit is contained in:
Grant Sanderson 2020-06-07 12:23:35 -07:00
parent 58df38f74e
commit 3a111cf3af

View file

@ -62,7 +62,6 @@ class Mobject(Container):
self.submobjects = [] self.submobjects = []
self.parents = [] self.parents = []
self.family = [self] self.family = [self]
self.color = Color(self.color)
if self.name is None: if self.name is None:
self.name = self.__class__.__name__ self.name = self.__class__.__name__
self.time_based_updaters = [] self.time_based_updaters = []
@ -670,19 +669,30 @@ class Mobject(Container):
# Color functions # Color functions
def set_color(self, color=YELLOW_C, family=True): def set_color(self, color, family=True):
""" # Here it just recurses to submobjects, but in subclasses this
Condition is function which takes in one arguments, (x, y, z). # should be further implemented based on the the inner workings
Here it just recurses to submobjects, but in subclasses this # of color
should be further implemented based on the the inner workings
of color
"""
if family: if family:
for submob in self.submobjects: for submob in self.submobjects:
submob.set_color(color, family=family) submob.set_color(color, family=family)
self.color = color
return self 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): def set_color_by_gradient(self, *colors):
self.set_submobject_colors_by_gradient(*colors) self.set_submobject_colors_by_gradient(*colors)
return self return self
@ -717,10 +727,6 @@ class Mobject(Container):
return self return self
def to_original_color(self):
self.set_color(self.color)
return self
def fade_to(self, color, alpha, family=True): def fade_to(self, color, alpha, family=True):
if self.get_num_points() > 0: if self.get_num_points() > 0:
new_color = interpolate_color( new_color = interpolate_color(
@ -738,9 +744,6 @@ class Mobject(Container):
submob.fade(darkness, family) submob.fade(darkness, family)
return self return self
def get_color(self):
return self.color
def get_gloss(self): def get_gloss(self):
return self.gloss return self.gloss