Cell magic rendering displaying videos in Jupyter/IPython
Project description
Integrates manim (animation engine for explanatory math videos) with Jupyter displaying the resulting video when using %%manim cell magic to wrap a scene definition.
Quick preview
The code in the example above comes from the excellent manim tutorial.
Installation
pip3 install jupyter-manim
Usage
Your arguments will be passed to manim, exactly as if these were command line options.
For example, to render scene defined with class Shapes(Scene) use
%%manim Shapes
from manimlib.scene.scene import Scene
from manimlib.mobject.geometry import Circle
from manimlib.animation.creation import ShowCreation
class Shapes(Scene):
def construct(self):
circle = Circle()
self.play(ShowCreation(circle))
NOTE: currently the code has to be self-contained as it will be run in a separate namespace. Thus, all the imports have to be contained in your cell.
In future, an option to export the current namespace (or specific variables) will be added. It could be implemented by pickling the Python locals and globals and then pre-pending the cell with an un-pickling script (PRs welcome!).
In the latest version of manimlib (not yet released) you will be able to import everything at once using:
from manimlib.imports import *
To display manim help and options use:
%%manim -h pass
The %%manim magic (by default) hides the progress bars as well as other logging messages generated by manim. You can disable this behaviour using --verbose flag
Video player control options
--no-controls - hides the controls
--no-autoplay - disables the autoplay feature
-r or --resolution - control the height and width of the video player; this option is shared with manim and requires the resolution in following format: height,width, e.g. %%manim Shapes -r 200,1000
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file jupyter_manim-0.11.tar.gz
.
File metadata
- Download URL: jupyter_manim-0.11.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.24.0 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d4b874ae35871be00ed8236183f7a35ee7d10256a63aba7e8f38785d33560c5 |
|
MD5 | 727cde1a5052968d4b9fe91d9ca61d54 |
|
BLAKE2b-256 | 49f8c68e7fae8e5aa5dcdb161a48dacd3f94eb24c38059e25a15aa903a1bc0d8 |