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-control - 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.1.tar.gz
.
File metadata
- Download URL: jupyter_manim-0.1.tar.gz
- Upload date:
- Size: 4.5 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 | 074bfbb825757172135eba5b1de0a47694909edcf59db41f36b42375641376f1 |
|
MD5 | ffd29e7a05f9c92da11497af36f9b45b |
|
BLAKE2b-256 | 0d170a3f76d4730577ec28c756f604744def27840230444c1bdbf15fa73f1136 |