Description
Description of bug / unexpected behavior
I'm trying to change how the timing of a graph's edges and vertices are created so that graphs with many edges have an equal amount of time spend created edges and vertices. When I create the edges in an AnimationGroup
, nothing is shown on the screen but the edges then all appear at once after the animation is over.
Expected behavior
The edges should appear one at a time, just like the vertices.
How to reproduce the issue
Code for reproducing the problem
from manim import *
class TestScene(Scene):
def construct(self):
graph = Graph(
vertices=[1, 2, 3, 4, 5],
edges=[
(1, 2),
(1, 3),
(1, 4),
(1, 5),
(2, 3),
(2, 4),
(2, 5),
(3, 4),
(3, 5),
(4, 5),
],
vertex_type=Circle,
vertex_config={"radius": 0.25},
)
# default behavior; edges are created one at a time
self.play(Create(graph), run_time=4)
self.clear()
# manually created the vertices, works as expected
self.play(
AnimationGroup(
*(Create(vertex) for vertex in graph.vertices.values()),
lag_ratio=0.1,
),
run_time=2,
)
# manually create the edges, edges appear all at once?
self.play(
AnimationGroup(
*(Create(edge) for edge in graph.edges.values()),
lag_ratio=0.1,
),
run_time=2,
)
self.pause(3)
Additional media files
Images/GIFs
TestScene.mp4
Logs
Terminal output
> manim -pqh -v DEBUG test.py TestScene
Manim Community v0.18.0
[01/18/24 18:23:59] DEBUG Hashing ... hashing.py:350
DEBUG Hashing done in 0.016427 s. hashing.py:362
DEBUG Hash generated : 3529212410_466792430_223132457 hashing.py:365
DEBUG List of the first few animation hashes of the scene: cairo_renderer.py:87
['3529212410_466792430_223132457']
Animation 0: Create(Undirected graph on 5 vertices and 10 edges): 30%|####5 | 73/240 [00:01<00:02, 56.22it/s]
(process:3544): GLib-GIO-WARNING **: 18:24:01.080: Unexpectedly, UWP app `Microsoft.ScreenSketch_11.2310.54.0_x64__8wekyb3d8bbwe' (AUMId `Microsoft.ScreenSketch_8wekyb3d8bbwe!App') supports 29 extensions but has no verbs
Animation 0: Create(Undirected graph on 5 vertices and 10 edges): 33%|####9 | 79/240 [00:01<00:02, 56.13it/s]
(process:3544): GLib-GIO-WARNING **: 18:24:01.155: Unexpectedly, UWP app `Microsoft.OutlookForWindows_1.2023.1214.201_x64__8wekyb3d8bbwe' (AUMId `Microsoft.OutlookForWindows_8wekyb3d8bbwe!Microsoft.OutlookforWindows') supports 1 extensions but has no verbs
[01/18/24 18:24:04] INFO Animation 0 : Partial movie file written in scene_file_writer.py:527
'D:\ml-visualize\media\videos\test\1080p60\partial_movie_files\Tes
tScene\3529212410_466792430_223132457.mp4'
DEBUG Hashing ... hashing.py:350
DEBUG Hashing done in 0.008106 s. hashing.py:362
DEBUG Hash generated : 3040924799_2563770218_2358810818 hashing.py:365
DEBUG List of the first few animation hashes of the scene: cairo_renderer.py:87
['3529212410_466792430_223132457', '3040924799_2563770218_2358810818']
[01/18/24 18:24:05] INFO Animation 1 : Partial movie file written in scene_file_writer.py:527
'D:\ml-visualize\media\videos\test\1080p60\partial_movie_files\Tes
tScene\3040924799_2563770218_2358810818.mp4'
DEBUG Hashing ... hashing.py:350
DEBUG Hashing done in 0.022348 s. hashing.py:362
DEBUG Hash generated : 3040924799_738277517_2459790260 hashing.py:365
DEBUG List of the first few animation hashes of the scene: cairo_renderer.py:87
['3529212410_466792430_223132457', '3040924799_2563770218_2358810818',
'3040924799_738277517_2459790260']
[01/18/24 18:24:07] INFO Animation 2 : Partial movie file written in scene_file_writer.py:527
'D:\ml-visualize\media\videos\test\1080p60\partial_movie_files\Tes
tScene\3040924799_738277517_2459790260.mp4'
DEBUG Animation with empty mobject animation.py:174
DEBUG Hashing ... hashing.py:350
DEBUG Hashing done in 0.019766 s. hashing.py:362
DEBUG Hash generated : 3040924799_2475379470_3097048898 hashing.py:365
DEBUG List of the first few animation hashes of the scene: cairo_renderer.py:87
['3529212410_466792430_223132457', '3040924799_2563770218_2358810818',
'3040924799_738277517_2459790260', '3040924799_2475379470_3097048898']
[01/18/24 18:24:09] INFO Animation 3 : Partial movie file written in scene_file_writer.py:527
'D:\ml-visualize\media\videos\test\1080p60\partial_movie_files\Tes
tScene\3040924799_2475379470_3097048898.mp4'
INFO Combining to Movie file. scene_file_writer.py:617
DEBUG Partial movie files to combine (4 files): scene_file_writer.py:561
['D:\\ml-visualize\\media\\videos\\test\\1080p60\\partial_movie_fi
les\\TestScene\\3529212410_466792430_223132457.mp4',
'D:\\ml-visualize\\media\\videos\\test\\1080p60\\partial_movie_fil
es\\TestScene\\3040924799_2563770218_2358810818.mp4',
'D:\\ml-visualize\\media\\videos\\test\\1080p60\\partial_movie_fil
es\\TestScene\\3040924799_738277517_2459790260.mp4',
'D:\\ml-visualize\\media\\videos\\test\\1080p60\\partial_movie_fil
es\\TestScene\\3040924799_2475379470_3097048898.mp4']
INFO scene_file_writer.py:735
File ready at
'D:\ml-visualize\media\videos\test\1080p60\TestScene.mp4'
INFO Rendered TestScene scene.py:241
Played 4 animations
INFO Previewed File at: file_ops.py:227
'D:\ml-visualize\media\videos\test\1080p60\TestScene.mp4'
System specifications
System Details
- OS: Windows 11 Pro 10.0.22631 Build 22631
- RAM: 16 GB DDR4
- Python version: Python 3.11.5 in venv
- Installed modules (provide output from
pip list
):
> pip list
Package Version
---------------------------- ------------
absl-py 2.0.0
astunparse 1.6.3
black 23.12.1
cachetools 5.3.2
certifi 2023.11.17
charset-normalizer 3.3.2
click 8.1.7
click-default-group 1.2.4
cloup 2.1.2
colorama 0.4.6
contourpy 1.2.0
cycler 0.12.1
decorator 5.1.1
flatbuffers 23.5.26
fonttools 4.47.2
gast 0.5.4
glcontext 2.5.0
google-auth 2.26.2
google-auth-oauthlib 1.2.0
google-pasta 0.2.0
grpcio 1.60.0
h5py 3.10.0
idna 3.6
isosurfaces 0.1.0
keras 2.15.0
kiwisolver 1.4.5
libclang 16.0.6
manim 0.18.0
ManimPango 0.5.0
mapbox-earcut 1.0.1
Markdown 3.5.2
markdown-it-py 3.0.0
MarkupSafe 2.1.3
matplotlib 3.8.2
mdurl 0.1.2
ml-dtypes 0.2.0
moderngl 5.9.0
moderngl-window 2.4.4
multipledispatch 1.0.0
mypy-extensions 1.0.0
networkx 3.2.1
numpy 1.26.3
oauthlib 3.2.2
opt-einsum 3.3.0
packaging 23.2
pandas 2.1.4
pathspec 0.12.1
Pillow 9.5.0
pip 23.3.2
platformdirs 4.1.0
protobuf 4.23.4
pyasn1 0.5.1
pyasn1-modules 0.3.0
pycairo 1.25.1
pydub 0.25.1
pyglet 2.0.10
Pygments 2.17.2
pyparsing 3.1.1
pyrr 0.10.3
python-dateutil 2.8.2
pytz 2023.3.post1
requests 2.31.0
requests-oauthlib 1.3.1
rich 13.7.0
rsa 4.9
scipy 1.11.4
screeninfo 0.8.1
setuptools 65.5.0
six 1.16.0
skia-pathops 0.7.4
srt 3.5.3
svgelements 1.9.6
tensorboard 2.15.1
tensorboard-data-server 0.7.2
tensorflow 2.15.0
tensorflow-estimator 2.15.0
tensorflow-intel 2.15.0
tensorflow-io-gcs-filesystem 0.31.0
termcolor 2.4.0
tqdm 4.66.1
typing_extensions 4.9.0
tzdata 2023.4
urllib3 2.1.0
watchdog 3.0.0
Werkzeug 3.0.1
wheel 0.42.0
wrapt 1.14.1
FFMPEG
Output of ffmpeg -version
:
> ffmpeg -version
ffmpeg version 6.0-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 58. 2.100 / 58. 2.100
libavcodec 60. 3.100 / 60. 3.100
libavformat 60. 3.100 / 60. 3.100
libavdevice 60. 1.100 / 60. 1.100
libavfilter 9. 3.100 / 9. 3.100
libswscale 7. 1.100 / 7. 1.100
libswresample 4. 10.100 / 4. 10.100
libpostproc 57. 1.100 / 57. 1.100
Additional comments
The graph classes (GenericGraph
, Graph
, and DiGraph
) all set the z_index
of the edges to be -1
on creation. Removing this seems to fix the issue, but I don't know why they are there and the full effects of removing them.
Line 775 in 68bd790
Line 1277 in 68bd790
Line 1479 in 68bd790
Metadata
Metadata
Assignees
Type
Projects
Status