Animation VShowPassingFlash often encounters an IndexError: index 0 is out of bounds for axis 0 with size 0.
for example:
from manimlib import *
class Video(Scene):
def construct(self):
s = TexText(r"A",template="tex")
self.play(ShowCreation(s))
self.play(VShowPassingFlash(s))
The error message is as follows:
File "test.py", line 9, in construct
self.play(VShowPassingFlash(s))
File "manimlib/scene/scene.py", line 405, in wrapper
func(self, *args, *kwargs)
File "manimlib/scene/scene.py", line 661, in play
self.begin_animations(animations)
File "manimlib/scene/scene.py", line 616, in begin_animations
animation.begin()
File "site-packages/manimlib/animation/indication.py", line 227, in begin
super().begin()
File "manimlib/animation/animation.py", line 79, in begin
self.interpolate(0)
File "manimlib/animation/animation.py", line 143, in interpolate
self.interpolate_mobject(alpha)
File "manimlib/animation/animation.py", line 155, in interpolate_mobject
self.interpolate_submobject(mobs, sub_alpha)
File "manimlib/animation/indication.py", line 247, in interpolate_submobject
submobject.set_stroke(width=widths gaussian)
File "manimlib/mobject/types/vectorized_mobject.py", line 207, in set_stroke
data['stroke_width'][:, 0] = resize_with_interpolation(
File "manimlib/utils/iterables.py", line 109, in resize_with_interpolation
return np.array([
File "manimlib/utils/iterables.py", line 110, in
(1 - a) nparray[lh] + a * nparray[rh]
IndexError: index 0 is out of bounds for axis 0 with size 0
Motivation
Animation VShowPassingFlash often encounters an IndexError: index 0 is out of bounds for axis 0 with size 0. for example:
The error message is as follows: File "test.py", line 9, in construct self.play(VShowPassingFlash(s)) File "manimlib/scene/scene.py", line 405, in wrapper func(self, *args, *kwargs) File "manimlib/scene/scene.py", line 661, in play self.begin_animations(animations) File "manimlib/scene/scene.py", line 616, in begin_animations animation.begin() File "site-packages/manimlib/animation/indication.py", line 227, in begin super().begin() File "manimlib/animation/animation.py", line 79, in begin self.interpolate(0) File "manimlib/animation/animation.py", line 143, in interpolate self.interpolate_mobject(alpha) File "manimlib/animation/animation.py", line 155, in interpolate_mobject self.interpolate_submobject(mobs, sub_alpha) File "manimlib/animation/indication.py", line 247, in interpolate_submobject submobject.set_stroke(width=widths gaussian) File "manimlib/mobject/types/vectorized_mobject.py", line 207, in set_stroke data['stroke_width'][:, 0] = resize_with_interpolation( File "manimlib/utils/iterables.py", line 109, in resize_with_interpolation return np.array([ File "manimlib/utils/iterables.py", line 110, in
(1 - a) nparray[lh] + a * nparray[rh]
IndexError: index 0 is out of bounds for axis 0 with size 0
Proposed changes
Test
Code:
Result: