Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Removed condition from Mobject.highlight

Grant Sandersonb9aec1e907aa
diff --git a/mobject/mobject.py b/mobject/mobject.py
index bec10171e..6129017ea 100644
--- a/mobject/mobject.py
+++ b/mobject/mobject.py
@@ -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)
diff --git a/mobject/point_cloud_mobject.py b/mobject/point_cloud_mobject.py
index 1bd855cae..787075759 100644
--- a/mobject/point_cloud_mobject.py
+++ b/mobject/point_cloud_mobject.py
@@ -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):