Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix VShowPassingFlash index out of bounds issue #2059

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

germanzhu
Copy link

Motivation

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

Proposed changes

  • indication.py

Test

Code:

Result:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant