manim
manim copied to clipboard
How to fill with gradient in shader mode?
How to fill circle for example with gradient in shader mode? I tried set_color_by_gradient, it results in having different colors for different submobjects.
For example:
class Gradient(Scene):
def construct(self):
circle_1 = Circle().move_to(2*RIGHT)
circle_2 = Circle().move_to(2*LEFT)
circles = VGroup(circle_1,circle_2)
self.add(circles.set_color_by_gradient(PINK, YELLOW))
self.wait()
The results is:
https://user-images.githubusercontent.com/53943014/102837108-1a97a280-4436-11eb-83cf-72dee1fa1d3b.mp4
What I want is something like this:
All suggestions are highly appreciated. Thank you.
Why do you post an example with two circles, when the desired outcome is a single circle? Anyways, try
from manim import *
class Gradient(Scene):
def construct(self):
gradient_circle = Circle(fill_opacity=1).set_color([ORANGE, RED])
self.add(gradient_circle)
output