Give set_color_by_gradient more expected behavior

https://github.com/3b1b/manim/issues/1882
This commit is contained in:
Grant Sanderson
2022-11-03 16:17:17 -07:00
parent 834c806e83
commit 8e6265d35e

View File

@ -1265,7 +1265,10 @@ class Mobject(object):
return self.data["rgbas"][0, 3]
def set_color_by_gradient(self, *colors: ManimColor):
self.set_submobject_colors_by_gradient(*colors)
if self.has_points():
self.set_color(colors)
else:
self.set_submobject_colors_by_gradient(*colors)
return self
def set_submobject_colors_by_gradient(self, *colors: ManimColor):