mirror of
https://github.com/3b1b/manim.git
synced 2025-09-19 04:41:56 +00:00
Added support for changing and interpolating stroke_width on PMobjects
This commit is contained in:
parent
307ac852a6
commit
42e0cd07ac
1 changed files with 15 additions and 0 deletions
|
@ -50,6 +50,15 @@ class PMobject(Mobject):
|
||||||
self.color = color
|
self.color = color
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
def get_stroke_width(self):
|
||||||
|
return self.stroke_width
|
||||||
|
|
||||||
|
def set_stroke_width(self, width, family=True):
|
||||||
|
mobs = self.family_members_with_points() if family else [self]
|
||||||
|
for mob in mobs:
|
||||||
|
mob.stroke_width = width
|
||||||
|
return self
|
||||||
|
|
||||||
# def set_color_by_gradient(self, start_color, end_color):
|
# def set_color_by_gradient(self, start_color, end_color):
|
||||||
def set_color_by_gradient(self, *colors):
|
def set_color_by_gradient(self, *colors):
|
||||||
self.rgbas = np.array(list(map(
|
self.rgbas = np.array(list(map(
|
||||||
|
@ -158,6 +167,12 @@ class PMobject(Mobject):
|
||||||
self.rgbas = interpolate(
|
self.rgbas = interpolate(
|
||||||
mobject1.rgbas, mobject2.rgbas, alpha
|
mobject1.rgbas, mobject2.rgbas, alpha
|
||||||
)
|
)
|
||||||
|
self.set_stroke_width(interpolate(
|
||||||
|
mobject1.get_stroke_width(),
|
||||||
|
mobject2.get_stroke_width(),
|
||||||
|
alpha,
|
||||||
|
))
|
||||||
|
return self
|
||||||
|
|
||||||
def pointwise_become_partial(self, mobject, a, b):
|
def pointwise_become_partial(self, mobject, a, b):
|
||||||
lower_index, upper_index = [
|
lower_index, upper_index = [
|
||||||
|
|
Loading…
Add table
Reference in a new issue