Skip to content

Bug: Animating a DashedLine from or to a length of 0 crashes #4591

@trent2

Description

@trent2

Description of bug / unexpected behavior

When animating a DashedLine Manim crashes when the the line has a a length of exactly 0.

Expected behavior

The line is either drawn as a point or not at all.

How to reproduce the issue

Code for reproducing the problem
from manim import *

class DashedLineAnimationCrash(Scene):
    def construct(self):
        v = ValueTracker(2)
        l = always_redraw(lambda: DashedLine((0,0,0), (v.get_value(), v.get_value(), 0)))
        # l = always_redraw(lambda: Line((0,0,0), (v.get_value(), v.get_value(), 0))) # would work

        self.add(l)
        self.play(v.animate.set_value(-1))     # <-- no problem since 0 is not exactly produced going from 2 to -1
        self.play(v.animate.set_value(0))  # <-- hits the bug

Additional media files

Logs

Pastebin Logfile

System specifications

System Details
  • OS (gentoo Linux 6.12.58-gentoo):
  • RAM: 64 GB
  • Python version 3.14.0
  • Installed modules (provide output from pip list):
Package           Version
----------------- -------
audioop-lts       0.2.2
av                16.1.0
beautifulsoup4    4.14.3
click             8.3.1
cloup             3.0.8
decorator         5.2.1
glcontext         3.0.0
isosurfaces       0.1.2
manim             0.19.2
ManimPango        0.6.1
mapbox_earcut     2.0.0
markdown-it-py    4.0.0
mdurl             0.1.2
moderngl          5.12.0
moderngl-window   3.1.1
networkx          3.6.1
numpy             2.4.2
pillow            12.1.0
pip               26.0.1
pycairo           1.29.0
pydub             0.25.1
pyglet            2.1.13
pyglm             2.8.3
Pygments          2.19.2
rich              14.3.2
scipy             1.17.0
screeninfo        0.8.1
skia-pathops      0.9.1
soupsieve         2.8.3
srt               3.5.3
svgelements       1.9.6
tqdm              4.67.3
typing_extensions 4.15.0
watchdog          6.0.0
LaTeX details
  • LaTeX distribution: TeX Live 2025 (bug not related to LaTeX)

Additional comments

See also this reddit post

The bug is also triggered when we start with a length 0 line to animate.

from manim import *

class DashedLineAnimationCrash(Scene):
    def construct(self):
        v = ValueTracker(0)   # <-- initial length 0 
        l = always_redraw(lambda: DashedLine((0,0,0), (v.get_value(), v.get_value(), 0)))

        self.add(l)
        self.play(v.animate.set_value(2))     # <-- now triggered here

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions