Fix error when using VFadeIn (and its subclasses) (#2328)

* Fix error when using VFadeIn and its subclasses

* 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-06-10 22:04:13 +07:00 committed by GitHub
parent 66e8b04507
commit c667136060
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

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(