ManimCommunity / ManimCommunity/manim
LinearTransformationScene bug(s)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 40.9k
- Forks
- 3.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Description
## Description of bug / unexpected behavior
There are a variety of bugs in the LinearTransformationScene. Of note:
* Playing animations on Text, Tex, and MathTex Mobjects causes an error: `ValueError: operands could not be broadcast together with shapes () ()` Todo: test with other text-based Mobjects (number, decimal, etc)
* Running `self.wait()` if not the final statement in the scene causes an error: `TypeError: All submobjects must be of type VMobject`
## Expected behavior
* [ ] Creating text-based Mobjects and playing animations on them should not cause an error.
* [ ] `self.wait()` should not cause an error in the middle of the scene.
## How to reproduce the issue
Code for reproducing the problem
* Text, Tex, & MathTex Mobjects fail upon animation:
```py
class LinearTransformationSceneExample(LinearTransformationScene):
def __init__(self, **kwargs):
LinearTransformationScene.__init__(
self,
show_coordinates=True,
leave_ghost_vectors=True,
*kwargs
)
def construct(self):
text = Text("Hello world")
tex = Tex(r"\LaTeX")
math_tex = MathTex(r"\pi x_{1} x_{2}")
group = VGroup(text, tex, math_tex).arrange(DOWN)
self.play(Write(group)) # <---- FAILS HERE
# Note that instead of playing, `self.add(group)` works fine.
matrix = [[1, 1], [0, 1]]
self.apply_matrix(matrix)
self.wait()
```
* Calling `self.wait()` before the end of the scene fails:
```py
class LinearTransformationSceneExample(LinearTransformationScene):
def __init__(self, **kwargs):
LinearTransformationScene.__init__(
self,
show_coordinates=True,
leave_ghost_vectors=True,
*kwargs
)
def construct(self):
circle = Circle().set_fill(YELLOW, opacity=0.7)
self.play(Create(circle))
self.wait(2)
matrix = [[1, 1], [0, 1]]
self.apply_matrix(matrix)
self.wait()
```
## Additional media files
... there are no files to paste. it fails to render. that's what this bug report is about.
## Logs
Terminal output
* Text-based mobjects bug: https://pastebin.com/EpAmcWWK
* `self.wait()` bug: https://pastebin.com/1tWsVWdX
## System specifications
System Details
- OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)): macOS Sonoma 14.2
- RAM: 16GB
- Python version (`python/py/python3 --version`): Python 3.11.6
- Installed modules (provide output from `pip list`):
```
$ uname -a
Darwin hostname.com 23.2.0 Darwin Kernel Version 23.2.0: Fri Oct 13 09:27:09 PDT 2023; root:xnu-10002.60.54~14/RELEASE_ARM64_T6020 arm64
$ python3 --version
Python 3.11.6
$ pip list
Package Version
---------------------- -----------
appnope 0.1.3
asttokens 2.4.1
Brotli 1.1.0
build 1.0.3
CacheControl 0.13.1
certifi 2023.11.17
cffi 1.16.0
charset-normalizer 3.3.2
cleo 2.1.0
click 8.1.7
click-default-group 1.2.4
cloup 2.1.2
colorama 0.4.6
comm 0.1.4
crashtest 0.4.1
Cython 3.0.5
debugpy 1.8.0
decorator 5.1.1
distlib 0.3.7
dulwich 0.21.6
exceptiongroup 1.2.0
executing 2.0.1
fastjsonschema 2.19.0
filelock 3.13.1
future 0.18.3
glcontext 2.5.0
idna 3.5
importlib-metadata 6.8.0
installer 0.7.0
ipykernel 6.26.0
ipython 8.18.0
isosurfaces 0.1.0
jaraco.classes 3.3.0
jedi 0.19.1
jupyter_client 8.6.0
jupyter_core 5.5.0
keyring 24.3.0
manim 0.18.0
ManimPango 0.5.0
mapbox-earcut 1.0.1
markdown-it-py 3.0.0
matplotlib-inline 0.1.6
mdurl 0.1.0
moderngl 5.8.2
moderngl-window 2.4.1
more-itertools 10.1.0
msgpack 1.0.7
multipledispatch 0.6.0
nest-asyncio 1.5.8
networkx 3.2.1
numpy 1.26.2
packaging 23.2
parso 0.8.3
pexpect 4.8.0
pickleshare 0.7.5
Pillow 9.5.0
pip 23.3.1
pkginfo 1.9.6
platformdirs 3.11.0
poetry 1.7.1
poetry-core 1.8.1
poetry-plugin-export 1.6.0
prompt-toolkit 3.0.41
psutil 5.9.5
ptyprocess 0.7.0
pure-eval 0.2.2
pycairo 1.25.1
pycparser 2.21
pydub 0.25.1
pyglet 1.5.27
Pygments 2.17.2
pyobjc-core 10.0
pyobjc-framework-Cocoa 10.0
pyproject_hooks 1.0.0
pyrr 0.10.3
PySocks 1.7.1
python-dateutil 2.8.2
PyYAML 6.0.1
pyzmq 25.1.1
rapidfuzz 3.5.2
requests 2.31.0
requests-toolbelt 1.0.0
rich 13.7.0
SciPy 1.11.4
screeninfo 0.8.1
setuptools 68.2.2
shellingham 1.5.4
six 1.16.0
skia-pathops 0.8.0.post1
srt 3.5.3
stack-data 0.6.2
svgelements 1.9.6
tomli 2.0.1
tomlkit 0.12.3
tornado 6.3.3
tqdm 4.66.1
traitlets 5.13.0
trove-classifiers 2023.11.22
typing_extensions 4.8.0
urllib3 2.1.0
virtualenv 20.24.7
watchdog 2.1.6
wcwidth 0.2.12
wheel 0.41.3
xattr 0.10.1
zipp 3.17.0
```
LaTeX details
+ LaTeX distribution (e.g. TeX Live 2020): No clue! Whatever homebrew provided.
+ Installed LaTeX packages:
https://i.strange.boats/OHQfaj.txt full list is huge. here's the output.
FFMPEG
Output of `ffmpeg -version`:
```
ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
built with clang version 12.0.0
configuration: --prefix=/Users/ktietz/demo/mc3/conda-bld/ffmpeg_1628925491858/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac --cc=arm64-apple-darwin20.0.0-clang --disable-doc --enable-avresample --enable-gmp --enable-hardcoded-tables --enable-libfreetype --enable-libvpx --enable-pthreads --enable-libopus --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-static --enable-version3 --enable-zlib --enable-libmp3lame --disable-nonfree --enable-gpl --enable-gnutls --disable-openssl --enable-libopenh264 --enable-libx264
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
```
## Additional comments
Text bugs: calling `self.add()` does *not* error
Wait bugs: calling `self.wait()` as the very last action in the scene does not error.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the two provided LinearTransformationScene reproductions: text-based Mobjects with Write, and self.wait() before apply_matrix. Trace the failures from those entry points and confirm the fix by ensuring both scenes render without errors, including the listed Text, Tex, and MathTex cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100