Added example jupyter notebook into the examples folders (#1029)

* example notebook

* removed cell output

* added jupyter/ folder to gitignore

* added link to binder in documentation

* Update docs/source/installation.rst

* updated binder links in readme

* Update example_scenes/manim_jupyter_example.ipynb

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

* Update example_scenes/manim_jupyter_example.ipynb

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

* Update docs/source/installation.rst

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

* added config.media_width = "10vw"

* updated notebook to latest version

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
This commit is contained in:
kolibril13 2021-04-08 10:36:18 +02:00 committed by GitHub
commit 2b6b2cddcc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 78 additions and 3 deletions

1
.gitignore vendored
View file

@ -64,6 +64,7 @@ docs/source/_build/
target/
# Jupyter Notebook
jupyter/
.ipynb_checkpoints
# IPython

View file

@ -4,7 +4,7 @@
<br />
<a href="https://pypi.org/project/manim/"><img src="https://img.shields.io/pypi/v/manim.svg?style=flat&logo=pypi" alt="PyPI Latest Release"></a>
<a href="https://hub.docker.com/r/manimcommunity/manim"><img src="https://img.shields.io/docker/v/manimcommunity/manim?color=%23099cec&label=docker%20image&logo=docker" alt="Docker image"> </a>
<a href="https://mybinder.org/v2/gist/behackl/725d956ec80969226b7bf9b4aef40b78/HEAD?filepath=basic%20example%20scenes.ipynb"><img src="https://mybinder.org/badge_logo.svg"></a>
<a href="https://mybinder.org/v2/gh/ManimCommunity/jupyter_examples/HEAD?filepath=basic_example_scenes.ipynb"><img src="https://mybinder.org/badge_logo.svg"></a>
<a href="http://choosealicense.com/licenses/mit/"><img src="https://img.shields.io/badge/license-MIT-red.svg?style=flat" alt="MIT License"></a>
<a href="https://www.reddit.com/r/manim/"><img src="https://img.shields.io/reddit/subreddit-subscribers/manim.svg?color=orange&label=reddit&logo=reddit" alt="Reddit" href=></a>
<a href="https://twitter.com/manim_community/"><img src="https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=Follow%20%40manim_community" alt="Twitter">
@ -19,7 +19,6 @@
</p>
<hr />
Manim is an animation engine for explanatory math videos. It's used to create precise animations programmatically, as demonstrated in the videos of [3Blue1Brown](https://www.3blue1brown.com/).
> NOTE: This repository is maintained by the Manim Community, and is not associated with Grant Sanderson or 3Blue1Brown in any way (although we are definitely indebted to him for providing his work to the world). If you would like to study how Grant makes his videos, head over to his repository ([3b1b/manim](https://github.com/3b1b/manim)). This fork is updated more frequently than his, and it's recommended to use this fork if you'd like to use Manim for your own projects.
@ -80,8 +79,9 @@ You should see your native video player program pop up and play a simple scene i
[GitHub repository](master/example_scenes). You can also visit the [official gallery](https://docs.manim.community/en/stable/examples.html) for more advanced examples.
Manim also ships with a `%%manim` IPython magic which allows to use it conveniently in JupyterLab (as well as classic Jupyter) notebooks. See the
[corresponding documentation](https://docs.manim.community/en/stable/reference/manim.utils.ipython_magic.ManimMagic.html) for some guidance and
[try it out online](https://mybinder.org/v2/gist/behackl/725d956ec80969226b7bf9b4aef40b78/HEAD?filepath=basic%20example%20scenes.ipynb).
[try it out online](https://mybinder.org/v2/gh/ManimCommunity/jupyter_examples/HEAD?filepath=basic_example_scenes.ipynb).
## Command line arguments

View file

@ -7,12 +7,20 @@ you are done installing the dependencies, come back to this page to install
manim itself.
.. NOTE::
Before installing manim, you should understand that there are a few main versions of manim
today that are generally incompatible with each other.
This documentation **only** covers the installation of the *community edition*;
trying to use instructions intended for other versions of manim or vice versa will likely result in failure.
In particular, most video tutorials are outdated. For more information, please read :doc:`Differences between Manim Versions <installation/versions>`.
.. tip::
In case that you want to try manim online without installation, open it in
`Binder <https://mybinder.org/v2/gh/ManimCommunity/jupyter_examples/HEAD?filepath=basic_example_scenes.ipynb>`_.
Installing dependencies
***********************

View file

@ -0,0 +1,66 @@
{
"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",
"\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
}