Closed kolibril13 closed 1 year ago
agree this would be cool! It looks like animate doesn't currently return anything - we could have the method return a small object which implements _ipython_display() and shows the video as you suggest! :)
I don't need this myself or use jupyter notebooks particularly heavily but would gladly accept a PR if you're keen to make this happen!
Glad you like it! :)
It looks like animate doesn't currently return anything - we could have the method return a small object which implements _ipython_display() and shows the video as you suggest! :)
In theory, a good idea! In practive, I remember one issue that we had in manim is, that when you name the video yourself, e.g. animation.animate("my_vid.mov"), then the video did not update due to caching issues.
Also, it can happen that users copy+paste their code into other cells, and then there are multiple my_vid.mov
files.
We solved this issue by using time-stemps in the file names.
When I find the time for it, I might make a pr :)
It would be nice to have a function or a cellmagic that displays the generated video directly in the Jupyter output!
Here is a prototype:
Cell1
Cell2
This is inspired by the way manim videos are embedded:
https://github.com/ManimCommunity/manim/blob/3713ed6b1e0f9d51de8e74717bf4489c592f880f/manim/utils/ipython_magic.py#L176-L197