add np.floating in type checking of Mobject.set_rgba_array_by_color and VMobject.set_stroke and removing the change in VFadeIn

This commit is contained in:
Irvanal Haq 2025-03-30 01:55:17 +07:00
parent 7ea15a8bf9
commit b4eed687b0
3 changed files with 4 additions and 4 deletions

View file

@ -164,10 +164,10 @@ class VFadeIn(Animation):
alpha: float
) -> None:
submob.set_stroke(
opacity=float(interpolate(0, start.get_stroke_opacity(), alpha))
opacity=interpolate(0, start.get_stroke_opacity(), alpha)
)
submob.set_fill(
opacity=float(interpolate(0, start.get_fill_opacity(), alpha))
opacity=interpolate(0, start.get_fill_opacity(), alpha)
)

View file

@ -1361,7 +1361,7 @@ class Mobject(object):
rgbs = resize_with_interpolation(rgbs, len(data))
data[name][:, :3] = rgbs
if opacity is not None:
if not isinstance(opacity, (float, int)):
if not isinstance(opacity, (float, int, np.floating)):
opacity = resize_with_interpolation(np.array(opacity), len(data))
data[name][:, 3] = opacity
return self

View file

@ -185,7 +185,7 @@ class VMobject(Mobject):
if width is not None:
for mob in self.get_family(recurse):
data = mob.data if mob.get_num_points() > 0 else mob._data_defaults
if isinstance(width, (float, int)):
if isinstance(width, (float, int, np.floating)):
data['stroke_width'][:, 0] = width
else:
data['stroke_width'][:, 0] = resize_with_interpolation(