mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Fix set_width for variable stroke width
This commit is contained in:
parent
8e1fdd5a79
commit
9e02796c9a
1 changed files with 6 additions and 3 deletions
|
@ -199,9 +199,12 @@ class VMobject(Mobject):
|
||||||
if width is not None:
|
if width is not None:
|
||||||
for mob in self.get_family(recurse):
|
for mob in self.get_family(recurse):
|
||||||
data = mob.data if mob.get_num_points() > 0 else mob._data_defaults
|
data = mob.data if mob.get_num_points() > 0 else mob._data_defaults
|
||||||
if not isinstance(width, float | int):
|
if isinstance(width, float | int):
|
||||||
width = resize_with_interpolation(np.array(width), len(data)).flatten()
|
data['stroke_width'][:, 0] = width
|
||||||
data['stroke_width'][:, 0] = width
|
else:
|
||||||
|
data['stroke_width'][:, 0] = resize_with_interpolation(
|
||||||
|
np.array(width), len(data)
|
||||||
|
).flatten()
|
||||||
|
|
||||||
if background is not None:
|
if background is not None:
|
||||||
for mob in self.get_family(recurse):
|
for mob in self.get_family(recurse):
|
||||||
|
|
Loading…
Add table
Reference in a new issue