Removed condition from Mobject.highlight

This commit is contained in:
Grant Sanderson 2017-10-26 21:30:59 -07:00
parent 0d8a713950
commit b9aec1e907
2 changed files with 10 additions and 8 deletions

View file

@ -399,11 +399,17 @@ class Mobject(object):
## Color functions
def highlight(self, color = YELLOW_C, family = True, condition = None):
def highlight(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
"""
raise Exception("Not implemented")
if family:
for submob in self.submobjects:
submob.highlight(color, family = family)
return self
def gradient_highlight(self, *colors):
self.submobject_gradient_highlight(*colors)

View file

@ -30,15 +30,11 @@ class PMobject(Mobject):
self.rgbas = np.append(self.rgbas, rgbas, axis = 0)
return self
def highlight(self, color = YELLOW_C, family = True, condition = None):
def highlight(self, color = YELLOW_C, family = True):
rgba = color_to_rgba(color)
mobs = self.family_members_with_points() if family else [self]
for mob in mobs:
if condition:
to_change = np.apply_along_axis(condition, 1, mob.points)
mob.rgbas[to_change, :] = rgba
else:
mob.rgbas[:,:] = rgba
mob.rgbas[:,:] = rgba
return self
def gradient_highlight(self, start_color, end_color):