ManimCommunity / ManimCommunity/manim

Changing cap style of Mobject to ROUND is influencing Write animations behavior

Open
#4,979 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

issue:bug
Dominant language
Python
Stars
40.9k
Forks
3.1k
Avg merge
3d 12h
Merged PRs (30d)
25

Description

## Description of bug / unexpected behavior
When I change the cap style of an Mobject (a line, in my case) using either the parameter `cap_style=CapStyleType.ROUND` or the method `.set_cap_style(CapStyleType.ROUND)` , subsequent Write() animations of MathTex equations appear with dots on the screen. Even though the MathTex object has no direct influence on the Mobject whose cap style was changed.

@nikolajmunk guesses that the points show up because round linestyle (by design) also applies a stroke to paths of length 0, while the other choices don't. That means we're suddenly seeing a stroke show up out of nowhere when the animation starts, even when it's at its beginning size of length 0.

## Expected behavior
The expectation is that changing the cap style of a Mobject will not affect other objects.

## How to reproduce the issue
This is a simple and clean version of the problem. As we can see, although the second equation is identical to the first, because it was instantiated after the line specifying `CapStyleType.ROUND`, dots appear on the screen when using the `Write` animation.

Code for reproducing the problem

```py
def construct(self):
eq1 = MathTex(r"f(x)=ax^2+bx+c").scale(2)
line = Line(cap_style=CapStyleType.ROUND)
eq2 = MathTex(r"f(x)=ax^2+bx+c").scale(2)
VGroup(eq1, line, eq2).arrange(DOWN, buff=1)

self.play(Write(eq1, run_time=2))
self.play(Create(line))
self.play(Write(eq2, run_time=2))
self.wait()
```

## Additional media files
Video generated by manim.exe:

Images/GIFs

https://github.com/user-attachments/assets/85954503-3c6a-434c-aea3-8f1978364728

## System specifications

System Details
- OS: Windows 10 Pro
- RAM: 32 GB
- Python version: 3.13.5
- Installed modules:
```
Package Version
----------------------- -------
asttokens 3.0.2
audioop-lts 0.2.2
av 18.1.0
beautifulsoup4 4.15.0
click 8.4.2
cloup 3.1.0
colorama 0.4.6
dearpygui 2.3.1
decorator 5.3.1
executing 2.2.1
glcontext 3.0.0
ipython 9.16.1
ipython_pygments_lexers 1.1.1
isosurfaces 0.1.2
jedi 0.20.0
manim 0.21.0
ManimPango 0.6.1
mapbox_earcut 2.0.0
markdown-it-py 4.2.0
matplotlib-inline 0.2.2
mdurl 0.1.2
MF-Tools 1.4.9
moderngl 5.12.0
moderngl-window 3.1.1
networkx 3.6.1
numpy 2.5.2
packaging 26.3
parso 0.8.7
pillow 12.3.0
pip 26.2.1
prompt_toolkit 3.0.53
psutil 7.2.2
pure_eval 0.2.3
pycairo 1.29.1
pydub 0.25.1
pyglet 2.1.16
pyglm 2.8.3
Pygments 2.20.0
rich 15.0.0
scipy 1.18.0
screeninfo 0.8.1
setuptools 84.0.0
skia-pathops 0.9.2
soupsieve 2.9.2
srt 3.5.3
stack-data 0.6.3
svgelements 1.9.6
tqdm 4.70.0
traitlets 5.16.1
typing_extensions 4.16.0
typst 0.15.0
watchdog 6.0.0
wcwidth 0.8.2
wheel 0.48.0
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided reproduction with Line(cap_style=CapStyleType.ROUND), MathTex, and Write, then trace how set_cap_style and Write handle zero-length paths. Compare the rendering behavior with other cap styles and verify that the equations no longer show dots after the fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.