manim/example_scenes/manim_jupyter_example.ipynb
Michael McNeil Forbes 99b11da9c5
Added `media_embed` config option to control whether media in Jupyter notebooks is embedded (#2442)
* feat: Added --embed option to %%manim ManimMagic.

* feat: Change to --embed and also embed Images

* Update manim/utils/ipython_magic.py

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>

* Initial attempt to make media_embed a general config option

* fixed issues raised in code review

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove unused import

* actually remove unused import

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
Co-authored-by: Michael McNeil Forbes <michael.forbes+python@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-02-23 09:35:39 +00:00

68 lines
1.5 KiB
Text

{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from manim import *"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%manim -v WARNING --disable_caching -ql -s Example1\n",
"\n",
"class Example1(Scene):\n",
" def construct(self):\n",
" self.add(Circle())"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%manim -v WARNING --disable_caching -qm HelloManim\n",
"\n",
"# set the maximum width for video outputs to a predefined value\n",
"config.media_width = \"20vw\"\n",
"# embed video\n",
"config.media_embed = True\n",
"\n",
"class HelloManim(Scene):\n",
" def construct(self):\n",
" self.camera.background_color = \"#ece6e2\"\n",
" banner_large = ManimBanner(dark_theme=False).scale(0.7)\n",
" self.play(banner_large.create())\n",
" self.play(banner_large.expand())"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.1"
}
},
"nbformat": 4,
"nbformat_minor": 4
}