Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
e01be300a0 | |||
940916d4aa | |||
3da8fab145 | |||
f0c5d48107 | |||
426470ef3c | |||
700584cbcc | |||
a440da9468 | |||
6486ce147c | |||
b258deeb31 | |||
a32773c50f | |||
a16aa93ee6 | |||
e809e64f9a | |||
5967760dc3 | |||
7f824be682 | |||
9346f199d7 | |||
5c40dc69d8 | |||
bf10068cfc | |||
2f307225d1 | |||
8b5db4b2fd | |||
855c74de34 | |||
a70876d696 |
@ -1,5 +1,5 @@
|
||||
[bumpversion]
|
||||
current_version = 4.9.1
|
||||
current_version = 4.10.0
|
||||
commit = True
|
||||
message = chore(version): bump {current_version} to {new_version}
|
||||
|
||||
|
34
.github/workflows/clearcache.yml
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
# From: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries
|
||||
name: Cleanup caches by a branch
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- closed
|
||||
|
||||
jobs:
|
||||
cleanup:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cleanup
|
||||
run: |
|
||||
gh extension install actions/gh-actions-cache
|
||||
|
||||
REPO=${{ github.repository }}
|
||||
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
|
||||
|
||||
echo "Fetching list of cache key"
|
||||
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
|
||||
|
||||
## Setting this to not fail the workflow while deleting cache keys.
|
||||
set +e
|
||||
echo "Deleting caches..."
|
||||
for cacheKey in $cacheKeysForPR
|
||||
do
|
||||
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
|
||||
done
|
||||
echo "Done"
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
33
.github/workflows/draft-pdf.yml
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
# Simple workflow for deploying static content to GitHub Pages
|
||||
name: Create JOSE Paper
|
||||
|
||||
on:
|
||||
# Runs on pushes targeting the default branch
|
||||
push:
|
||||
paths:
|
||||
- paper/*
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
paper:
|
||||
runs-on: ubuntu-latest
|
||||
name: Paper Draft
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Build draft PDF
|
||||
uses: openjournals/openjournals-draft-action@master
|
||||
with:
|
||||
journal: jose
|
||||
# This should be the path to the paper within your repo.
|
||||
paper-path: paper/paper.md
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: paper
|
||||
# This is the output path where Pandoc will write the compiled
|
||||
# PDF. Note, this should be the same directory as the input
|
||||
# paper.md
|
||||
path: paper/paper.pdf
|
7
.github/workflows/pages.yml
vendored
@ -25,6 +25,7 @@ concurrency:
|
||||
jobs:
|
||||
# Single deploy job since we're just deploying
|
||||
deploy:
|
||||
permissions: write-all
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
@ -61,6 +62,12 @@ jobs:
|
||||
poetry run manim-slides convert ConvertExample docs/source/_static/slides.html -ccontrols=true
|
||||
poetry run manim-slides convert BasicExample docs/source/_static/basic_example.html -ccontrols=true
|
||||
poetry run manim-slides convert ThreeDExample docs/source/_static/three_d_example.html -ccontrols=true
|
||||
- name: Clear cache
|
||||
run: |
|
||||
gh extension install actions/gh-actions-cache
|
||||
gh actions-cache delete ${{ steps.cache-media-restore.outputs.cache-primary-key }} --confirm || true
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Save media to cache
|
||||
id: cache-media-save
|
||||
uses: actions/cache/save@v3
|
||||
|
6
.gitignore
vendored
@ -35,3 +35,9 @@ docs/source/_static/basic_example.html
|
||||
docs/source/_static/three_d_example.html
|
||||
|
||||
docs/source/_static/three_d_example_assets/
|
||||
|
||||
paper/media/
|
||||
|
||||
*.jats
|
||||
|
||||
paper/paper.pdf
|
||||
|
@ -24,7 +24,7 @@ repos:
|
||||
hooks:
|
||||
- id: black
|
||||
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
||||
rev: v0.0.249
|
||||
rev: v0.0.254
|
||||
hooks:
|
||||
- id: ruff
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
|
24
README.md
@ -1,8 +1,13 @@
|
||||

|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/jeertmans/manim-slides/main/static/logo_dark_transparent.png">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/jeertmans/manim-slides/main/static/logo_light_transparent.png">
|
||||
<img alt="Manim Slides Logo" src="https://raw.githubusercontent.com/jeertmans/manim-slides/main/static/logo.png">
|
||||
</picture>
|
||||
|
||||
[![Latest Release][pypi-version-badge]][pypi-version-url]
|
||||
[![Python version][pypi-python-version-badge]][pypi-version-url]
|
||||

|
||||
[![PyPI - Downloads][pypi-download-badge]][pypi-version-url]
|
||||
[![Documentation][documentation-badge]][documentation-url]
|
||||
# Manim Slides
|
||||
|
||||
Tool for live presentations using either [Manim (community edition)](https://www.manim.community/) or [ManimGL](https://3b1b.github.io/manim/). Manim Slides will *automatically* detect the one you are using!
|
||||
@ -60,7 +65,7 @@ An alternative way to install Manim Slides is to clone the git repository, and i
|
||||
<!-- start usage -->
|
||||
|
||||
Using Manim Slides is a two-step process:
|
||||
1. Render animations using `Slide` (resp. `ThreeDSlide`) as a base class instead of `Scene` (resp. `ThreeDScene`), and add calls to `self.pause()` everytime you want to create a new slide.
|
||||
1. Render animations using `Slide` (resp. `ThreeDSlide`) as a base class instead of `Scene` (resp. `ThreeDScene`), and add calls to `self.next_slide()` everytime you want to create a new slide.
|
||||
2. Run `manim-slides` on rendered animations and display them like a *Power Point* presentation.
|
||||
|
||||
The documentation is available [online](https://eertmans.be/manim-slides/).
|
||||
@ -82,14 +87,14 @@ class BasicExample(Slide):
|
||||
dot = Dot()
|
||||
|
||||
self.play(GrowFromCenter(circle))
|
||||
self.pause() # Waits user to press continue to go to the next slide
|
||||
self.next_slide() # Waits user to press continue to go to the next slide
|
||||
|
||||
self.start_loop() # Start loop
|
||||
self.play(MoveAlongPath(dot, circle), run_time=2, rate_func=linear)
|
||||
self.end_loop() # This will loop until user inputs a key
|
||||
|
||||
self.play(dot.animate.move_to(ORIGIN))
|
||||
self.pause() # Waits user to press continue to go to the next slide
|
||||
self.next_slide() # Waits user to press continue to go to the next slide
|
||||
```
|
||||
|
||||
First, render the animation files:
|
||||
@ -118,7 +123,11 @@ manim-slides BasicExample
|
||||
|
||||
The default key bindings to control the presentation are:
|
||||
|
||||

|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/jeertmans/manim-slides/main/static/wizard_dark.png">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/jeertmans/manim-slides/main/static/wizard_light.png">
|
||||
<img alt="Manim Slides Wizard" src="https://raw.githubusercontent.com/jeertmans/manim-slides/main/static/wizard_light.png">
|
||||
</picture>
|
||||
|
||||
|
||||
You can run the **configuration wizard** to change those key bindings:
|
||||
@ -184,3 +193,6 @@ Contributions are more than welcome! Please read through [our contributing secti
|
||||
[pypi-version-badge]: https://img.shields.io/pypi/v/manim-slides?label=manim-slides
|
||||
[pypi-version-url]: https://pypi.org/project/manim-slides/
|
||||
[pypi-python-version-badge]: https://img.shields.io/pypi/pyversions/manim-slides
|
||||
[pypi-download-badge]: https://img.shields.io/pypi/dm/manim-slides
|
||||
[documentation-badge]: https://img.shields.io/website?down_color=lightgrey&down_message=offline&label=documentation&up_color=green&up_message=online&url=https%3A%2F%2Feertmans.be%2Fmanim-slides%2F
|
||||
[documentation-url]: https://eertmans.be/manim-slides/
|
||||
|
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 24 B |
1
docs/source/_static/logo.png
Symbolic link
@ -0,0 +1 @@
|
||||
../../../static/logo.png
|
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 24 B |
1
docs/source/_static/logo_dark_docs.png
Symbolic link
@ -0,0 +1 @@
|
||||
../../../static/logo_dark_docs.png
|
1
docs/source/_static/logo_dark_github.png
Symbolic link
@ -0,0 +1 @@
|
||||
../../../static/logo_dark_github.png
|
1
docs/source/_static/logo_dark_transparent.png
Symbolic link
@ -0,0 +1 @@
|
||||
../../../static/logo_dark_transparent.png
|
1
docs/source/_static/logo_light_transparent.png
Symbolic link
@ -0,0 +1 @@
|
||||
../../../static/logo_light_transparent.png
|
1
docs/source/_static/wizard_dark.png
Symbolic link
@ -0,0 +1 @@
|
||||
../../../static/wizard_dark.png
|
1
docs/source/_static/wizard_light.png
Symbolic link
@ -0,0 +1 @@
|
||||
../../../static/wizard_light.png
|
@ -24,6 +24,11 @@ extensions = [
|
||||
"sphinx_copybutton",
|
||||
]
|
||||
|
||||
myst_enable_extensions = [
|
||||
"colon_fence",
|
||||
"html_admonition",
|
||||
]
|
||||
|
||||
templates_path = ["_templates"]
|
||||
exclude_patterns = []
|
||||
|
||||
@ -35,6 +40,8 @@ html_theme = "furo"
|
||||
html_static_path = ["_static"]
|
||||
|
||||
html_theme_options = {
|
||||
"light_logo": "logo_light_transparent.png",
|
||||
"dark_logo": "logo_dark_transparent.png",
|
||||
"footer_icons": [
|
||||
{
|
||||
"name": "GitHub",
|
||||
|
@ -42,7 +42,7 @@ poetry run manim-slides wizard
|
||||
or enter a new shell that uses this new Python environment:
|
||||
|
||||
```
|
||||
poetry run
|
||||
poetry shell
|
||||
manim-slides wizard
|
||||
```
|
||||
|
||||
|
27
docs/source/features_table.md
Normal file
@ -0,0 +1,27 @@
|
||||
# Features Table
|
||||
|
||||
The following summarizes the different presentation features Manim Slides offers.
|
||||
|
||||
:::{table} Comparison of the different presentation methods.
|
||||
:widths: auto
|
||||
:align: center
|
||||
|
||||
| Feature / Constraint | [`present`](reference/cli.md) | [`convert --to=html`](reference/cli.md) | [`convert --to=pptx`](reference/cli.md) |
|
||||
| :--- | :---: | :---: | :---: |
|
||||
| Basic navigation through slides | Yes | Yes | Yes |
|
||||
| Replay slide | Yes | No | No |
|
||||
| Pause animation | Yes | No | No |
|
||||
| Play slide in reverse | Yes | No | No |
|
||||
| Slide count | Yes | Yes (optional) | Yes (optional) |
|
||||
| Animation count | Yes | No | No |
|
||||
| Needs Python with Manim Slides installed | Yes | No | No |
|
||||
| Requires internet access | No | Yes | No |
|
||||
| Auto. play slides | Yes | Yes | Yes |
|
||||
| Loops support | Yes | Yes | Yes |
|
||||
| Fully customizable | No | Yes (`--use-template` option) | No |
|
||||
| Other dependencies | None | A modern web browser | PowerPoint or LibreOffice Impress[^1]
|
||||
| Works cross-platforms | Yes | Yes | Partly[^1][^2] |
|
||||
:::
|
||||
|
||||
[^1]: If you encounter a problem where slides do not automatically play or loops do not work, please [file an issue on GitHub](https://github.com/jeertmans/manim-slides/issues/new/choose).
|
||||
[^2]: PowerPoint online does not seem to support automatic playing of videos, so you need LibreOffice Impress on Linux platforms.
|
@ -4,9 +4,18 @@ og:description: Manim Slides makes creating slides with Manim super easy!
|
||||
---
|
||||
|
||||
```{eval-rst}
|
||||
.. image:: _static/logo.png
|
||||
.. image:: _static/logo_light_transparent.png
|
||||
:width: 600px
|
||||
:align: center
|
||||
:class: only-light
|
||||
:alt: Manim Slide logo
|
||||
```
|
||||
|
||||
```{eval-rst}
|
||||
.. image:: _static/logo_dark_transparent.png
|
||||
:width: 600px
|
||||
:align: center
|
||||
:class: only-dark
|
||||
:alt: Manim Slide logo
|
||||
```
|
||||
|
||||
@ -30,6 +39,7 @@ Slide through the demo below to get a quick glimpse on what you can do with Mani
|
||||
|
||||
quickstart
|
||||
reference/index
|
||||
features_table
|
||||
```
|
||||
|
||||
```{toctree}
|
||||
|
@ -6,7 +6,7 @@ Thefore, we only document here the methods we think the end-user will ever use,
|
||||
|
||||
```{eval-rst}
|
||||
.. autoclass:: manim_slides.Slide
|
||||
:members: start_loop, end_loop, pause, play
|
||||
:members: start_loop, end_loop, pause, next_slide
|
||||
|
||||
.. autoclass:: manim_slides.ThreeDSlide
|
||||
:members:
|
||||
|
71
docs/source/reference/gui.md
Normal file
@ -0,0 +1,71 @@
|
||||
# Graphical User Interface
|
||||
|
||||
Manim Slides' graphical user interface (GUI) is the *de facto* way to present slides.
|
||||
|
||||
If you do not specify one of the commands listed in the [CLI reference](./cli),
|
||||
Manim Slides will use **present** by default, which launches a GUI window,
|
||||
playing your scene(s) like so:
|
||||
|
||||
```bash
|
||||
manim-slides [present] [SCENES]...
|
||||
```
|
||||
|
||||
Some optional parameters can be specified and can be listed with:
|
||||
|
||||
```bash
|
||||
manim-slides present --help
|
||||
```
|
||||
|
||||
:::{note}
|
||||
All the `SCENES` must be in the same folder (`--folder DIRECTORY`), which
|
||||
defaults to `./slides`. If you rendered your animations without changing
|
||||
directory, you should not worry about that :-)
|
||||
:::
|
||||
|
||||
## Configuration File
|
||||
|
||||
It is possible to configure Manim Slides via a configuration file, even though
|
||||
this feature is currently limited. You may initiliaze the default configuration
|
||||
file with:
|
||||
|
||||
```bash
|
||||
manim-slides init
|
||||
```
|
||||
|
||||
:::{warning}
|
||||
Note that, by default, Manim Slides will use default key bindings that are
|
||||
platform-dependent. If you decide to overwrite those with a config file, you may
|
||||
encounter some problems from platform to platform.
|
||||
:::
|
||||
|
||||
## Configuring Key Bindings
|
||||
|
||||
If you wish to use other key bindings than the defaults, you can run the
|
||||
configuration wizard with:
|
||||
|
||||
```bash
|
||||
manim-slides wizard
|
||||
```
|
||||
|
||||
A similar window to the image below will pop up and prompt to change keys.
|
||||
|
||||
```{eval-rst}
|
||||
.. image:: ../_static/wizard_light.png
|
||||
:width: 300px
|
||||
:align: center
|
||||
:class: only-light
|
||||
:alt: Manim Slide Wizard
|
||||
```
|
||||
|
||||
```{eval-rst}
|
||||
.. image:: ../_static/wizard_dark.png
|
||||
:width: 300px
|
||||
:align: center
|
||||
:class: only-dark
|
||||
:alt: Manim Slide Wizard
|
||||
```
|
||||
|
||||
:::{note}
|
||||
Even though it is not currently supported through the GUI, you can select
|
||||
multiple key binding for the same action by modifying the config file.
|
||||
:::
|
40
docs/source/reference/html.md
Normal file
@ -0,0 +1,40 @@
|
||||
# HTML Presentations
|
||||
|
||||
Manim Slides allows you to convert presentations into one HTML file, with
|
||||
[RevealJS](https://revealjs.com/). This file can then be opened with any modern
|
||||
web browser, allowing for a nice portability of your presentations.
|
||||
|
||||
As for every command with Manim Slides, converting slides' fragments into one
|
||||
HTML file (and its assets) can be done in one command:
|
||||
|
||||
```bash
|
||||
manim-slides convert [SCENES]... DEST
|
||||
```
|
||||
|
||||
where `DEST` is the `.html` destination file.
|
||||
|
||||
## Configuring the Template
|
||||
|
||||
Many configuration options are available through the `-c<option>=<value>` syntax.
|
||||
Most, if not all, RevealJS options should be available by default. If that is
|
||||
not the case, please
|
||||
[fill an issue](https://github.com/jeertmans/manim-slides/issues/new/choose)
|
||||
on GitHub.
|
||||
|
||||
You can print the list of available options with:
|
||||
|
||||
```bash
|
||||
manim-slides convert --show-config
|
||||
```
|
||||
|
||||
## Using a Custom Template
|
||||
|
||||
The default template used for HTML conversion can be found on
|
||||
[GitHub](https://github.com/jeertmans/manim-slides/blob/main/manim_slides/data/revealjs_template.html)
|
||||
or printed with the `--show-template` option.
|
||||
If you wish to use another template, you can do so with the
|
||||
`--use-template FILE` option.
|
||||
|
||||
## More about HTML Slides
|
||||
|
||||
You can read more about HTML slides in the [sharing](./sharing) section.
|
@ -8,13 +8,21 @@ Automatically generated reference for Manim Slides.
|
||||
api
|
||||
cli
|
||||
examples
|
||||
gui
|
||||
html
|
||||
sharing
|
||||
```
|
||||
|
||||
[Application Programming Interface](./api): list of classes and methods that may be useful to the end-user.
|
||||
[Application Programming Interface](./api): list of classes and methods that may
|
||||
be useful to the end-user.
|
||||
|
||||
[Command Line Interface](./cli): list of all commands available using Manim Slides' executable.
|
||||
[Command Line Interface](./cli): list of all commands available using Manim
|
||||
Slides' executable.
|
||||
|
||||
[Examples](./examples): curated list of examples and their output.
|
||||
|
||||
[Graphical User Interface](./gui): details about the main Manim Slide' feature.
|
||||
|
||||
[HTML Presenetation](./html): an alternative way of presenting your animations.
|
||||
|
||||
[Sharing](./sharing): how to share your presentation with others.
|
||||
|
@ -144,6 +144,20 @@ This is how your are able to watch all the examples on this website. If you want
|
||||
to know how to share your slide with GitHub pages, see the
|
||||
[workflow file](https://github.com/jeertmans/manim-slides/blob/main/.github/workflows/pages.yml).
|
||||
|
||||
> **WARNING:** keep in minde that playing large video files over the internet
|
||||
> **WARNING:** keep in mind that playing large video files over the internet
|
||||
can take some time, and *glitches* may occur between slide transitions for this
|
||||
reason.
|
||||
|
||||
### With PowerPoint (*EXPERIMENTAL*)
|
||||
|
||||
A recent conversion feature is to the PowerPoint format, thanks to the `python-pptx` package. Even though it is fully working, it is still considered in an *EXPERIMENTAL* status because we do not exactly know what versions of PowerPoint (or LibreOffice Impress) are supported.
|
||||
|
||||
Basically, you can create a PowerPoint in a single command:
|
||||
|
||||
```bash
|
||||
manim-slides convert --to=pptx BasicExample basic_example.pptx
|
||||
```
|
||||
|
||||
All the videos and necessary files will be contained inside the `.pptx` file, so you can safely share it with anyone. By default, the `poster_frame_image`, i.e., what is displayed by PowerPoint when the video is not playing, is the first frame of each slide. This allows for smooth transitions.
|
||||
|
||||
In the future, we hope to provide more features to this format, so feel free to suggest new features too!
|
||||
|
44
example.py
@ -22,14 +22,14 @@ class BasicExample(Slide):
|
||||
dot = Dot()
|
||||
|
||||
self.play(GrowFromCenter(circle))
|
||||
self.pause() # Waits user to press continue to go to the next slide
|
||||
self.next_slide() # Waits user to press continue to go to the next slide
|
||||
|
||||
self.start_loop() # Start loop
|
||||
self.play(MoveAlongPath(dot, circle), run_time=2, rate_func=linear)
|
||||
self.end_loop() # This will loop until user inputs a key
|
||||
|
||||
self.play(dot.animate.move_to(ORIGIN))
|
||||
self.pause() # Waits user to press continue to go to the next slide
|
||||
self.next_slide() # Waits user to press continue to go to the next slide
|
||||
|
||||
|
||||
class TestFileTooLong(Slide):
|
||||
@ -47,7 +47,7 @@ class TestFileTooLong(Slide):
|
||||
self.play(dot.animate.move_to(direction), run_time=0.1)
|
||||
self.play(dot.animate.move_to(ORIGIN), run_time=0.1)
|
||||
|
||||
self.pause()
|
||||
self.next_slide()
|
||||
|
||||
|
||||
class ConvertExample(Slide):
|
||||
@ -77,7 +77,7 @@ class ConvertExample(Slide):
|
||||
|
||||
self.play(FadeIn(title))
|
||||
|
||||
self.pause()
|
||||
self.next_slide()
|
||||
|
||||
code = Code(
|
||||
code="""from manim import *
|
||||
@ -146,10 +146,10 @@ class Example(Slide):
|
||||
self.add(dot)
|
||||
|
||||
self.play(Indicate(dot, scale_factor=2))
|
||||
self.pause()
|
||||
self.next_slide()
|
||||
square = Square()
|
||||
self.play(Transform(dot, square))
|
||||
self.pause()
|
||||
self.next_slide()
|
||||
self.play(Rotate(square, angle=PI/2))
|
||||
""",
|
||||
language="python",
|
||||
@ -168,7 +168,7 @@ class Example(Slide):
|
||||
self.end_loop()
|
||||
square = Square()
|
||||
self.play(Transform(dot, square))
|
||||
self.pause()
|
||||
self.next_slide()
|
||||
self.play(Rotate(square, angle=PI/2))
|
||||
""",
|
||||
language="python",
|
||||
@ -195,38 +195,38 @@ class Example(Slide):
|
||||
|
||||
self.play(FadeIn(code))
|
||||
self.tinywait()
|
||||
self.pause()
|
||||
self.next_slide()
|
||||
|
||||
self.play(FadeIn(step, shift=RIGHT))
|
||||
self.play(Transform(code, code_step_1))
|
||||
self.tinywait()
|
||||
self.pause()
|
||||
self.next_slide()
|
||||
|
||||
self.play(Transform(step, step_2))
|
||||
self.play(Transform(code, code_step_2))
|
||||
self.tinywait()
|
||||
self.pause()
|
||||
self.next_slide()
|
||||
|
||||
self.play(Transform(step, step_3))
|
||||
self.play(Transform(code, code_step_3))
|
||||
self.tinywait()
|
||||
self.pause()
|
||||
self.next_slide()
|
||||
|
||||
self.play(Transform(step, step_4))
|
||||
self.play(Transform(code, code_step_4))
|
||||
self.tinywait()
|
||||
self.pause()
|
||||
self.next_slide()
|
||||
|
||||
self.play(Transform(step, step_5))
|
||||
self.play(Transform(code, code_step_5))
|
||||
self.tinywait()
|
||||
self.pause()
|
||||
self.next_slide()
|
||||
|
||||
self.play(Transform(step, step_6))
|
||||
self.play(Transform(code, code_step_6))
|
||||
self.play(code.animate.shift(UP), FadeIn(code_step_7), FadeIn(or_text))
|
||||
self.tinywait()
|
||||
self.pause()
|
||||
self.next_slide()
|
||||
|
||||
watch_text = Text("Watch result on next slides!").shift(2 * DOWN).scale(0.5)
|
||||
|
||||
@ -246,10 +246,10 @@ class Example(Slide):
|
||||
self.remove(dot)
|
||||
self.add(square)
|
||||
self.tinywait()
|
||||
self.pause()
|
||||
self.next_slide()
|
||||
self.play(Rotate(square, angle=PI / 4))
|
||||
self.tinywait()
|
||||
self.pause()
|
||||
self.next_slide()
|
||||
|
||||
learn_more_text = (
|
||||
VGroup(
|
||||
@ -281,7 +281,7 @@ if not MANIMGL:
|
||||
self.play(GrowFromCenter(circle))
|
||||
self.begin_ambient_camera_rotation(rate=75 * DEGREES / 4)
|
||||
|
||||
self.pause()
|
||||
self.next_slide()
|
||||
|
||||
self.start_loop()
|
||||
self.play(MoveAlongPath(dot, circle), run_time=4, rate_func=linear)
|
||||
@ -291,10 +291,10 @@ if not MANIMGL:
|
||||
self.move_camera(phi=75 * DEGREES, theta=30 * DEGREES)
|
||||
|
||||
self.play(dot.animate.move_to(ORIGIN))
|
||||
self.pause()
|
||||
self.next_slide()
|
||||
|
||||
self.play(dot.animate.move_to(RIGHT * 3))
|
||||
self.pause()
|
||||
self.next_slide()
|
||||
|
||||
self.start_loop()
|
||||
self.play(MoveAlongPath(dot, circle), run_time=2, rate_func=linear)
|
||||
@ -330,7 +330,7 @@ else:
|
||||
updater = lambda m, dt: m.increment_theta((75 * DEGREES / 4) * dt)
|
||||
frame.add_updater(updater)
|
||||
|
||||
self.pause()
|
||||
self.next_slide()
|
||||
|
||||
self.start_loop()
|
||||
self.play(MoveAlongPath(dot, circle), run_time=4, rate_func=linear)
|
||||
@ -339,10 +339,10 @@ else:
|
||||
frame.remove_updater(updater)
|
||||
self.play(frame.animate.set_theta(30 * DEGREES))
|
||||
self.play(dot.animate.move_to(ORIGIN))
|
||||
self.pause()
|
||||
self.next_slide()
|
||||
|
||||
self.play(dot.animate.move_to(RIGHT * 3))
|
||||
self.pause()
|
||||
self.next_slide()
|
||||
|
||||
self.start_loop()
|
||||
self.play(MoveAlongPath(dot, circle), run_time=2, rate_func=linear)
|
||||
|
@ -1,3 +1,48 @@
|
||||
# flake8: noqa: F401
|
||||
import sys
|
||||
from types import ModuleType
|
||||
from typing import Any, List
|
||||
|
||||
from .__version__ import __version__
|
||||
from .slide import Slide, ThreeDSlide
|
||||
|
||||
|
||||
class module(ModuleType):
|
||||
def __getattr__(self, name: str) -> Any:
|
||||
if name == "Slide" or name == "ThreeDSlide":
|
||||
module = __import__(
|
||||
"manim_slides.slide", None, None, ["Slide", "ThreeDSlide"]
|
||||
)
|
||||
return getattr(module, name)
|
||||
|
||||
return ModuleType.__getattribute__(self, name)
|
||||
|
||||
def __dir__(self) -> List[str]:
|
||||
result = list(new_module.__all__)
|
||||
result.extend(
|
||||
(
|
||||
"__file__",
|
||||
"__doc__",
|
||||
"__all__",
|
||||
"__docformat__",
|
||||
"__name__",
|
||||
"__path__",
|
||||
"__package__",
|
||||
"__version__",
|
||||
)
|
||||
)
|
||||
return result
|
||||
|
||||
|
||||
old_module = sys.modules["manim_slides"]
|
||||
new_module = sys.modules["manim_slides"] = module("manim_slides")
|
||||
|
||||
new_module.__dict__.update(
|
||||
{
|
||||
"__file__": __file__,
|
||||
"__package__": "manim_slides",
|
||||
"__path__": __path__,
|
||||
"__doc__": __doc__,
|
||||
"__version__": __version__,
|
||||
"__all__": ("__version__", "Slides", "ThreeDSlide"),
|
||||
}
|
||||
)
|
||||
|
@ -4,9 +4,9 @@ import click
|
||||
import requests
|
||||
from click_default_group import DefaultGroup
|
||||
|
||||
from . import __version__
|
||||
from .__version__ import __version__
|
||||
from .convert import convert
|
||||
from .manim import logger
|
||||
from .logger import make_logger
|
||||
from .present import list_scenes, present
|
||||
from .wizard import init, wizard
|
||||
|
||||
@ -27,6 +27,7 @@ def cli(notify_outdated_version: bool) -> None:
|
||||
|
||||
If no command is specified, defaults to `present`.
|
||||
"""
|
||||
logger = make_logger()
|
||||
# Code below is mostly a copy from:
|
||||
# https://github.com/ManimCommunity/manim/blob/main/manim/cli/render/commands.py
|
||||
if notify_outdated_version:
|
||||
|
@ -1 +1 @@
|
||||
__version__ = "4.9.1"
|
||||
__version__ = "4.10.0"
|
||||
|
@ -5,7 +5,7 @@ import click
|
||||
from click import Context, Parameter
|
||||
|
||||
from .defaults import CONFIG_PATH, FOLDER_PATH
|
||||
from .manim import logger
|
||||
from .logger import logger
|
||||
|
||||
F = Callable[..., Any]
|
||||
Wrapper = Callable[[F], F]
|
||||
|
@ -10,7 +10,8 @@ from typing import Dict, List, Optional, Set, Union
|
||||
from pydantic import BaseModel, FilePath, root_validator, validator
|
||||
from PySide6.QtCore import Qt
|
||||
|
||||
from .manim import FFMPEG_BIN, logger
|
||||
from .defaults import FFMPEG_BIN
|
||||
from .logger import logger
|
||||
|
||||
|
||||
def merge_basenames(files: List[FilePath]) -> Path:
|
||||
@ -169,7 +170,7 @@ class PresentationConfig(BaseModel): # type: ignore
|
||||
|
||||
return values
|
||||
|
||||
def copy_to(self, dest: Path) -> "PresentationConfig":
|
||||
def copy_to(self, dest: Path, use_cached: bool = True) -> "PresentationConfig":
|
||||
"""
|
||||
Copy the files to a given directory.
|
||||
"""
|
||||
@ -177,13 +178,18 @@ class PresentationConfig(BaseModel): # type: ignore
|
||||
for i in range(n):
|
||||
file = self.files[i]
|
||||
dest_path = dest / self.files[i].name
|
||||
logger.debug(f"Moving / copying {file} to {dest_path}")
|
||||
shutil.copy(file, dest_path)
|
||||
self.files[i] = dest_path
|
||||
if use_cached and dest_path.exists():
|
||||
logger.debug(f"Skipping copy of {file}, using cached copy")
|
||||
continue
|
||||
logger.debug(f"Copying {file} to {dest_path}")
|
||||
shutil.copy(file, dest_path)
|
||||
|
||||
return self
|
||||
|
||||
def concat_animations(self, dest: Optional[Path] = None) -> "PresentationConfig":
|
||||
def concat_animations(
|
||||
self, dest: Optional[Path] = None, use_cached: bool = True
|
||||
) -> "PresentationConfig":
|
||||
"""
|
||||
Concatenate animations such that each slide contains one animation.
|
||||
"""
|
||||
@ -193,8 +199,16 @@ class PresentationConfig(BaseModel): # type: ignore
|
||||
for i, slide_config in enumerate(self.slides):
|
||||
files = self.files[slide_config.slides_slice]
|
||||
|
||||
slide_config.start_animation = i
|
||||
slide_config.end_animation = i + 1
|
||||
|
||||
if len(files) > 1:
|
||||
dest_path = merge_basenames(files)
|
||||
dest_paths.append(dest_path)
|
||||
|
||||
if use_cached and dest_path.exists():
|
||||
logger.debug(f"Concatenated animations already exist for slide {i}")
|
||||
continue
|
||||
|
||||
f = tempfile.NamedTemporaryFile(mode="w", delete=False)
|
||||
f.writelines(f"file '{os.path.abspath(path)}'\n" for path in files)
|
||||
@ -225,14 +239,14 @@ class PresentationConfig(BaseModel): # type: ignore
|
||||
if error:
|
||||
logger.debug(error.decode())
|
||||
|
||||
dest_paths.append(dest_path)
|
||||
if not dest_path.exists():
|
||||
raise ValueError(
|
||||
"could not properly concatenate animations, use `-v INFO` for more details"
|
||||
)
|
||||
|
||||
else:
|
||||
dest_paths.append(files[0])
|
||||
|
||||
slide_config.start_animation = i
|
||||
slide_config.end_animation = i + 1
|
||||
|
||||
self.files = dest_paths
|
||||
|
||||
if dest:
|
||||
|
@ -1,19 +1,39 @@
|
||||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import webbrowser
|
||||
from enum import Enum
|
||||
from importlib import resources
|
||||
from pathlib import Path
|
||||
from typing import Any, Callable, Dict, Generator, List, Optional, Type, Union
|
||||
|
||||
import click
|
||||
import pkg_resources
|
||||
import cv2
|
||||
import pptx
|
||||
from click import Context, Parameter
|
||||
from pydantic import BaseModel, PositiveInt, ValidationError
|
||||
from lxml import etree
|
||||
from pydantic import BaseModel, FilePath, PositiveInt, ValidationError
|
||||
from tqdm import tqdm
|
||||
|
||||
from . import data
|
||||
from .commons import folder_path_option, verbosity_option
|
||||
from .config import PresentationConfig
|
||||
from .logger import logger
|
||||
from .present import get_scenes_presentation_config
|
||||
|
||||
|
||||
def open_with_default(file: Path):
|
||||
system = platform.system()
|
||||
if system == "Darwin":
|
||||
subprocess.call(("open", str(file)))
|
||||
elif system == "Windows":
|
||||
os.startfile(str(file)) # type: ignore[attr-defined]
|
||||
else:
|
||||
subprocess.call(("xdg-open", str(file)))
|
||||
|
||||
|
||||
def validate_config_option(
|
||||
ctx: Context, param: Parameter, value: Any
|
||||
) -> Dict[str, str]:
|
||||
@ -55,6 +75,7 @@ class Converter(BaseModel): # type: ignore
|
||||
"""Returns the appropriate converter from a string name."""
|
||||
return {
|
||||
"html": RevealJS,
|
||||
"pptx": PowerPoint,
|
||||
}[s]
|
||||
|
||||
|
||||
@ -309,9 +330,11 @@ class RevealJS(Converter):
|
||||
if isinstance(self.template, str):
|
||||
with open(self.template, "r") as f:
|
||||
return f.read()
|
||||
return pkg_resources.resource_string(
|
||||
__name__, "data/revealjs_template.html"
|
||||
).decode()
|
||||
|
||||
if sys.version_info < (3, 9):
|
||||
return resources.read_text(data, "revealjs_template.html")
|
||||
|
||||
return resources.files(data).joinpath("revealjs_template.html").read_text()
|
||||
|
||||
def open(self, file: Path) -> bool:
|
||||
return webbrowser.open(file.absolute().as_uri())
|
||||
@ -333,7 +356,7 @@ class RevealJS(Converter):
|
||||
presentation_config.concat_animations().copy_to(full_assets_dir)
|
||||
|
||||
with open(dest, "w") as f:
|
||||
sections = "".join(self.get_sections_iter(full_assets_dir))
|
||||
sections = "".join(self.get_sections_iter(assets_dir))
|
||||
|
||||
revealjs_template = self.load_template()
|
||||
content = revealjs_template.format(sections=sections, **self.dict())
|
||||
@ -341,6 +364,90 @@ class RevealJS(Converter):
|
||||
f.write(content)
|
||||
|
||||
|
||||
class PowerPoint(Converter):
|
||||
left: PositiveInt = 0
|
||||
top: PositiveInt = 0
|
||||
width: PositiveInt = 1280
|
||||
height: PositiveInt = 720
|
||||
auto_play_media: bool = True
|
||||
poster_frame_image: Optional[FilePath] = None
|
||||
|
||||
class Config:
|
||||
use_enum_values = True
|
||||
extra = "forbid"
|
||||
|
||||
def open(self, file: Path) -> bool:
|
||||
return open_with_default(file)
|
||||
|
||||
def convert_to(self, dest: Path) -> None:
|
||||
"""Converts this configuration into a PowerPoint presentation, saved to DEST."""
|
||||
prs = pptx.Presentation()
|
||||
prs.slide_width = self.width * 9525
|
||||
prs.slide_height = self.height * 9525
|
||||
|
||||
layout = prs.slide_layouts[6] # Should be blank
|
||||
|
||||
# From GitHub issue comment:
|
||||
# - https://github.com/scanny/python-pptx/issues/427#issuecomment-856724440
|
||||
def auto_play_media(media: pptx.shapes.picture.Movie, loop: bool = False):
|
||||
el_id = xpath(media.element, ".//p:cNvPr")[0].attrib["id"]
|
||||
el_cnt = xpath(
|
||||
media.element.getparent().getparent().getparent(),
|
||||
'.//p:timing//p:video//p:spTgt[@spid="%s"]' % el_id,
|
||||
)[0]
|
||||
cond = xpath(el_cnt.getparent().getparent(), ".//p:cond")[0]
|
||||
cond.set("delay", "0")
|
||||
|
||||
if loop:
|
||||
ctn = xpath(el_cnt.getparent().getparent(), ".//p:cTn")[0]
|
||||
ctn.set("repeatCount", "indefinite")
|
||||
|
||||
def xpath(el: etree.Element, query: str) -> etree.XPath:
|
||||
nsmap = {"p": "http://schemas.openxmlformats.org/presentationml/2006/main"}
|
||||
return etree.ElementBase.xpath(el, query, namespaces=nsmap)
|
||||
|
||||
def save_first_image_from_video_file(file: Path) -> Optional[str]:
|
||||
cap = cv2.VideoCapture(str(file))
|
||||
ret, frame = cap.read()
|
||||
|
||||
if ret:
|
||||
f = tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".png")
|
||||
cv2.imwrite(f.name, frame)
|
||||
return f.name
|
||||
else:
|
||||
logger.warn("Failed to read first image from video file")
|
||||
return None
|
||||
|
||||
for i, presentation_config in enumerate(self.presentation_configs):
|
||||
presentation_config.concat_animations()
|
||||
for slide_config in tqdm(
|
||||
presentation_config.slides,
|
||||
desc=f"Generating video slides for config {i + 1}",
|
||||
leave=False,
|
||||
):
|
||||
file = presentation_config.files[slide_config.start_animation]
|
||||
|
||||
if self.poster_frame_image is None:
|
||||
poster_frame_image = save_first_image_from_video_file(file)
|
||||
else:
|
||||
poster_frame_image = str(self.poster_frame_image)
|
||||
|
||||
slide = prs.slides.add_slide(layout)
|
||||
movie = slide.shapes.add_movie(
|
||||
str(file),
|
||||
self.left,
|
||||
self.top,
|
||||
self.width * 9525,
|
||||
self.height * 9525,
|
||||
poster_frame_image=poster_frame_image,
|
||||
mime_type="video/mp4",
|
||||
)
|
||||
if self.auto_play_media:
|
||||
auto_play_media(movie, loop=slide_config.is_loop())
|
||||
|
||||
prs.save(dest)
|
||||
|
||||
|
||||
def show_config_options(function: Callable[..., Any]) -> Callable[..., Any]:
|
||||
"""Wraps a function to add a `--show-config` option."""
|
||||
|
||||
@ -401,7 +508,7 @@ def show_template_option(function: Callable[..., Any]) -> Callable[..., Any]:
|
||||
@click.argument("dest", type=click.Path(dir_okay=False, path_type=Path))
|
||||
@click.option(
|
||||
"--to",
|
||||
type=click.Choice(["html"], case_sensitive=False),
|
||||
type=click.Choice(["html", "pptx"], case_sensitive=False),
|
||||
default="html",
|
||||
show_default=True,
|
||||
help="Set the conversion format to use.",
|
||||
|
0
manim_slides/data/__init__.py
Normal file
@ -1,2 +1,3 @@
|
||||
FOLDER_PATH: str = "./slides"
|
||||
CONFIG_PATH: str = ".manim-slides.json"
|
||||
FFMPEG_BIN: str = "ffmpeg"
|
||||
|
42
manim_slides/logger.py
Normal file
@ -0,0 +1,42 @@
|
||||
"""
|
||||
Logger utils, mostly copied from Manim Community:
|
||||
https://github.com/ManimCommunity/manim/blob/d5b65b844b8ce8ff5151a2f56f9dc98cebbc1db4/manim/_config/logger_utils.py#L29-L101
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
||||
from rich.logging import RichHandler
|
||||
|
||||
__all__ = ["logger", "make_logger"]
|
||||
|
||||
HIGHLIGHTED_KEYWORDS = [ # these keywords are highlighted specially
|
||||
"Played",
|
||||
"animations",
|
||||
"scene",
|
||||
"Reading",
|
||||
"Writing",
|
||||
"script",
|
||||
"arguments",
|
||||
"Invalid",
|
||||
"Aborting",
|
||||
"module",
|
||||
"File",
|
||||
"Rendering",
|
||||
"Rendered",
|
||||
]
|
||||
|
||||
|
||||
def make_logger() -> logging.Logger:
|
||||
"""
|
||||
Make a logger similar to the one used by Manim.
|
||||
"""
|
||||
RichHandler.KEYWORDS = HIGHLIGHTED_KEYWORDS
|
||||
rich_handler = RichHandler(
|
||||
show_time=True,
|
||||
)
|
||||
logger = logging.getLogger("manim-slides")
|
||||
logger.addHandler(rich_handler)
|
||||
return logger
|
||||
|
||||
|
||||
logger = logging.getLogger("manim-slides")
|
@ -18,7 +18,7 @@ from tqdm import tqdm
|
||||
from .commons import config_path_option, verbosity_option
|
||||
from .config import DEFAULT_CONFIG, Config, PresentationConfig, SlideConfig
|
||||
from .defaults import FOLDER_PATH
|
||||
from .manim import logger
|
||||
from .logger import logger
|
||||
from .resources import * # noqa: F401, F403
|
||||
|
||||
os.environ.pop(
|
||||
|
@ -3,6 +3,7 @@ import platform
|
||||
import shutil
|
||||
import subprocess
|
||||
from typing import Any, List, Optional
|
||||
from warnings import warn
|
||||
|
||||
from tqdm import tqdm
|
||||
|
||||
@ -90,8 +91,51 @@ class Slide(Scene): # type:ignore
|
||||
super().play(*args, **kwargs)
|
||||
self.current_animation += 1
|
||||
|
||||
def pause(self) -> None:
|
||||
"""Creates a new slide with previous animations."""
|
||||
def next_slide(self):
|
||||
"""
|
||||
Creates a new slide with previous animations.
|
||||
|
||||
This usually means that the user will need to press some key before the
|
||||
next slide is played. By default, this is the right arrow key.
|
||||
|
||||
|
||||
.. note::
|
||||
|
||||
Calls to :func:`next_slide` at the very beginning or at the end are
|
||||
not needed, since they are automatically added.
|
||||
|
||||
.. warning::
|
||||
|
||||
This is not allowed to call :func:`next_slide` inside a loop.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
The following contains 3 slides:
|
||||
|
||||
#. the first with nothing on it;
|
||||
#. the second with "Hello World!" fading in;
|
||||
#. and the last with the text fading out;
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from manim import *
|
||||
from manim_slides import Slide
|
||||
|
||||
class Example(Slide):
|
||||
def construct(self):
|
||||
text = Text("Hello World!")
|
||||
|
||||
self.next_slide()
|
||||
self.play(FadeIn(text))
|
||||
|
||||
self.next_slide()
|
||||
self.play(FadeOut(text))
|
||||
"""
|
||||
assert (
|
||||
self.loop_start_animation is None
|
||||
), "You cannot call `self.next_slide()` inside a loop"
|
||||
|
||||
self.slides.append(
|
||||
SlideConfig(
|
||||
type=SlideType.slide,
|
||||
@ -103,6 +147,20 @@ class Slide(Scene): # type:ignore
|
||||
self.current_slide += 1
|
||||
self.pause_start_animation = self.current_animation
|
||||
|
||||
def pause(self) -> None:
|
||||
"""
|
||||
Creates a new slide with previous animations.
|
||||
|
||||
.. deprecated:: 4.10.0
|
||||
Use :func:`next_slide` instead.
|
||||
"""
|
||||
warn(
|
||||
"`self.pause()` is deprecated. Use `self.next_slide()` instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
self.next_slide()
|
||||
|
||||
def add_last_slide(self) -> None:
|
||||
"""Adds a 'last' slide to the end of slides."""
|
||||
|
||||
@ -123,12 +181,37 @@ class Slide(Scene): # type:ignore
|
||||
)
|
||||
|
||||
def start_loop(self) -> None:
|
||||
"""Starts a loop."""
|
||||
"""
|
||||
Starts a loop. End it with :func:`end_loop`.
|
||||
|
||||
A loop will automatically replay the slide, i.e., everything between
|
||||
:func:`start_loop` and :func:`end_loop`, upon reaching end.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
The following contains one slide that will loop endlessly.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from manim import *
|
||||
from manim_slides import Slide
|
||||
|
||||
class Example(Slide):
|
||||
def construct(self):
|
||||
dot = Dot(color=BLUE)
|
||||
|
||||
self.start_loop()
|
||||
|
||||
self.play(Indicate(dot))
|
||||
|
||||
self.end_loop()
|
||||
"""
|
||||
assert self.loop_start_animation is None, "You cannot nest loops"
|
||||
self.loop_start_animation = self.current_animation
|
||||
|
||||
def end_loop(self) -> None:
|
||||
"""Ends an existing loop."""
|
||||
"""Ends an existing loop. See :func:`start_loop` for more details."""
|
||||
assert (
|
||||
self.loop_start_animation is not None
|
||||
), "You have to start a loop before ending it"
|
||||
|
@ -21,7 +21,7 @@ from PySide6.QtWidgets import (
|
||||
from .commons import config_options, verbosity_option
|
||||
from .config import Config, Key
|
||||
from .defaults import CONFIG_PATH
|
||||
from .manim import logger
|
||||
from .logger import logger
|
||||
from .resources import * # noqa: F401, F403
|
||||
|
||||
WINDOW_NAME: str = "Configuration Wizard"
|
||||
|
BIN
paper/docs.png
Normal file
After Width: | Height: | Size: 4.3 MiB |
53
paper/paper.bib
Normal file
@ -0,0 +1,53 @@
|
||||
@online{manim-announcement,
|
||||
author = {Grant Sanderson},
|
||||
title = {{Q}\&{A} with {G}rant {S}anderson (3blue1brown)},
|
||||
year = {2018},
|
||||
organization = {YouTube},
|
||||
url = {https://www.youtube.com/watch?v=Qe6o9j4IjTo\&ab_channel=3Blue1Brown}
|
||||
}
|
||||
|
||||
@misc{revealjs,
|
||||
author = {Hakim El Hattab},
|
||||
title = {The HTML Presentation Framework},
|
||||
year = {2022},
|
||||
publisher = {GitHub},
|
||||
journal = {GitHub repository},
|
||||
url = {https://github.com/hakimel/reveal.js}
|
||||
}
|
||||
|
||||
@misc{manim-presentation,
|
||||
author = {Federico Galatolo},
|
||||
title = {Tool for live presentations using manim},
|
||||
year = {2021},
|
||||
publisher = {GitHub},
|
||||
journal = {GitHub repository},
|
||||
url = {https://github.com/galatolofederico/manim-presentation}
|
||||
}
|
||||
|
||||
@misc{manimgl,
|
||||
author = {Grant Sanderson},
|
||||
title = {Animation engine for explanatory math videos},
|
||||
year = {2022},
|
||||
publisher = {GitHub},
|
||||
journal = {GitHub repository},
|
||||
url = {https://github.com/3b1b/manim}
|
||||
}
|
||||
|
||||
@misc{manim-editor,
|
||||
author = {Christopher Besch},
|
||||
title = {Web Presenter for Mathematical Animations using Manim},
|
||||
year = {2022},
|
||||
publisher = {GitHub},
|
||||
journal = {GitHub repository},
|
||||
url = {https://github.com/ManimCommunity/manim_editor}
|
||||
}
|
||||
|
||||
@software{manimce,
|
||||
author = {{The Manim Community Developers}},
|
||||
license = {MIT},
|
||||
month = {12},
|
||||
title = {{Manim – Mathematical Animation Framework}},
|
||||
url = {https://www.manim.community/},
|
||||
version = {v0.17.2},
|
||||
year = {2022}
|
||||
}
|
125
paper/paper.md
Normal file
@ -0,0 +1,125 @@
|
||||
---
|
||||
title: 'Manim Slides: A Python package for presenting Manim content anywhere'
|
||||
tags:
|
||||
- Python
|
||||
- manim
|
||||
- animations
|
||||
- teaching
|
||||
- conference presentations
|
||||
- tool
|
||||
authors:
|
||||
- name: Jérome Eertmans
|
||||
orcid: 0000-0002-5579-5360
|
||||
affiliation: 1
|
||||
affiliations:
|
||||
- name: ICTEAM, UCLouvain, Belgium
|
||||
index: 1
|
||||
date: 2 March 2023
|
||||
bibliography: paper.bib
|
||||
---
|
||||
|
||||
# Summary
|
||||
|
||||
Manim Slides is a Python package that makes presenting Manim animations
|
||||
straightforward. With minimal changes required to pre-existing code, one can
|
||||
slide through animations in a *PowerPoint-like* manner, or share its slides
|
||||
*online* using ReavealJS' power.
|
||||
|
||||
# Introduction
|
||||
|
||||
Presenting educational content has always been a difficult task, especially
|
||||
when it uses temporal or iterative concepts. During the last decades, the
|
||||
presence of computers in classrooms for educational purposes has increased
|
||||
enormously, allowing teachers to show animated or interactive content.
|
||||
|
||||
With the democratization of YouTube, many people have decided to use this
|
||||
platform to share educational content. Among these people, Grant Sanderson, a
|
||||
YouTuber presenting videos on the theme of mathematics, quickly became known
|
||||
for his original and quality animations. In 2018, Grant announced in a video
|
||||
that he creates his animations using a self-developed Python tool called Manim
|
||||
[@manim-announcement]. In 2019, he made the Manim source code public [@manimgl],
|
||||
so anyone can use his tool. Very quickly, the community came together and, in
|
||||
2020, created a "fork" of the original GitHub repository [@manimce], in order to
|
||||
create a more accessible and better documented version of this tool. Since then,
|
||||
the two versions are differentiated by using ManimGL for Grant Sanderson's
|
||||
version, as it uses OpenGL for rendering, and ManimCE for the community edition
|
||||
(CE).
|
||||
|
||||
Despite the many advantages of the Manim tool in terms of illustrating
|
||||
mathematical concepts, one cannot help but notice that most presentations,
|
||||
whether in the classroom or at a conference, are mainly done with PowerPoint
|
||||
or PDF slides. One of the many advantages of these formats, as opposed to videos
|
||||
created with Manim, is the ability to pause, rewind, etc., whenever you want.
|
||||
|
||||
To face this problem, in 2021, the manim-presentation tool was created
|
||||
[@manim-presentation]. This tool allows you to present Manim animations as you
|
||||
would present slides: with pauses, slide jumps, etc. However, this tool has
|
||||
evolved very little since its inception and does not work with ManimGL.
|
||||
|
||||
In 2022, Manim Slides has been created from manim-presentation, with the aim
|
||||
to make it a more complete tool, better documented, and usable on all platforms
|
||||
and with ManimCE or ManimGL. After almost a year of existence, Manim Slides has
|
||||
evolved a lot, has built a small community of contributors, and continues to
|
||||
provide new features on a regular basis.
|
||||
|
||||
# Easy to Use Commitment
|
||||
|
||||
Manim Slides is commited to be an easy-to-use tool, when minimal installation
|
||||
procedure and few modifications required. It can either be used locally with its
|
||||
graphical user interface (GUI), or shared via HTML thanks to the RevealJS
|
||||
Javascript package [@revealjs].
|
||||
|
||||
This work has a very similar syntax to Manim and offers a comprehensive
|
||||
documentation hosted on [GitHub pages](https://eertmans.be/manim-slides/), see
|
||||
\autoref{fig:docs}.
|
||||
|
||||

|
||||
|
||||
# Example usage
|
||||
|
||||
We have used manim-presentation for our presentation at the COST
|
||||
Interact, hosted in Lyon, 2022, and
|
||||
[available online](https://eertmans.be/research/cost-interact-presentation/).
|
||||
This experience highly motivated the development of Manim Slides, and our
|
||||
EuCAP 2023 presentation slides are already
|
||||
[available online](https://eertmans.be/research/eucap-presentation/), thanks
|
||||
to Manim Slides' HTML feature.
|
||||
|
||||
Also, one of our users created a short
|
||||
[video tutorial](https://www.youtube.com/watch?v=Oc9g89VzKsY&ab_channel=TheoremofBeethoven)
|
||||
and posted it on YouTube.
|
||||
|
||||
# Stability and releases
|
||||
|
||||
Manim Slides is continously tested on most recent Python versions, both ManimCE
|
||||
and ManimGL, and on all major platforms: **Ubuntu**, **macOS** and **Windows**. As of Manim
|
||||
Slide's exposed API begin very minimal, and the variaty of tests that are
|
||||
performed, this tool can be considered stable over time.
|
||||
|
||||
New releases are very frequent, as they mostly introduce enhancements or small
|
||||
documention fixes, and the command-line tool automatically notifies for new
|
||||
available updates. Therefore, regularly updating Manim Slides is highly
|
||||
recommended.
|
||||
|
||||
# Statement of Need
|
||||
|
||||
Similar tools to Manim Slides also exist, such as its predecessor,
|
||||
manim-presentation [@manim-presentation], or the web-based alternative, Manim
|
||||
Editor [@manim-editor], but none of them provide the documentation level nor the
|
||||
amount of features that Manim Slides strives to. This work makes the task of
|
||||
presenting Manim content in front of an audience much easier than before,
|
||||
allowing presenters to focus more on the content of their slides, rather than on
|
||||
how to actually present them efficiently.
|
||||
|
||||
# Acknowledgements
|
||||
|
||||
We acknowledge the work of [@manim-presentation] that paved the initial structure
|
||||
of Manim Slides with the manim-presentation Python package.
|
||||
|
||||
We also acknowledge Grant Sanderson for its termendous work on Manim, as well as
|
||||
well as the Manim Community contributors.
|
||||
|
||||
Finally, we also acknowledge contributions from the GitHub contributors on the
|
||||
Manim Slides repository.
|
||||
|
||||
# References
|
3837
poetry.lock
generated
@ -61,17 +61,20 @@ packages = [
|
||||
]
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/jeertmans/manim-slides"
|
||||
version = "4.9.1"
|
||||
version = "4.10.0"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
click = "^8.1.3"
|
||||
click-default-group = "^1.2.2"
|
||||
lxml = "^4.9.2"
|
||||
numpy = "^1.19"
|
||||
opencv-python = "^4.6.0.66"
|
||||
pydantic = "^1.10.2"
|
||||
pyside6 = "^6.4.1"
|
||||
python = ">=3.8.1,<3.12"
|
||||
python-pptx = "^0.6.21"
|
||||
requests = "^2.28.1"
|
||||
rich = "^13.3.2"
|
||||
tqdm = "^4.64.1"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
|
BIN
static/logo.png
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 110 KiB |
@ -1,17 +1,29 @@
|
||||
# flake8: noqa: F403, F405
|
||||
# type: ignore
|
||||
import os
|
||||
|
||||
from manim import *
|
||||
|
||||
THEME = os.environ.get("MANIM_SLIDES_THEME", "light").lower().replace("_", "-")
|
||||
|
||||
|
||||
class ManimSlidesLogo(Scene):
|
||||
def construct(self):
|
||||
tex_template = TexTemplate()
|
||||
tex_template.add_to_preamble(r"\usepackage{graphicx}\usepackage{fontawesome5}")
|
||||
self.camera.background_color = "#ffffff"
|
||||
self.camera.background_color = {
|
||||
"light": "#ffffff",
|
||||
"dark-docs": "#131416",
|
||||
"dark-github": "#0d1117",
|
||||
}[THEME]
|
||||
logo_green = "#87c2a5"
|
||||
logo_blue = "#525893"
|
||||
logo_red = "#e07a5f"
|
||||
logo_black = "#343434"
|
||||
logo_black = {
|
||||
"light": "#343434",
|
||||
"dark-docs": "#d0d0d0",
|
||||
"dark-github": "#c9d1d9",
|
||||
}[THEME]
|
||||
ds_m = MathTex(r"\mathbb{M}", fill_color=logo_black).scale(7)
|
||||
ds_m.shift(2.25 * LEFT + 1.5 * UP)
|
||||
slides = MathTex(r"\mathbb{S}\text{lides}", fill_color=logo_black).scale(4)
|
||||
|
BIN
static/logo_dark_docs.png
Normal file
After Width: | Height: | Size: 112 KiB |
BIN
static/logo_dark_github.png
Normal file
After Width: | Height: | Size: 113 KiB |
BIN
static/logo_dark_transparent.png
Normal file
After Width: | Height: | Size: 124 KiB |
BIN
static/logo_light_transparent.png
Normal file
After Width: | Height: | Size: 116 KiB |
21
static/make_logo.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#! /bin/bash
|
||||
|
||||
MANIM_SLIDES_THEME=light poetry run manim render -qk -s --format png --resolution 2560,1280 static/logo.py && mv media/images/logo/*.png static/logo.png
|
||||
|
||||
ln -f -r -s static/logo.png docs/source/_static/logo.png
|
||||
|
||||
MANIM_SLIDES_THEME=dark_docs poetry run manim render -qk -s --format png --resolution 2560,1280 static/logo.py && mv media/images/logo/*.png static/logo_dark_docs.png
|
||||
|
||||
ln -f -r -s static/logo_dark_docs.png docs/source/_static/logo_dark_docs.png
|
||||
|
||||
MANIM_SLIDES_THEME=dark_github poetry run manim render -qk -s --format png --resolution 2560,1280 static/logo.py && mv media/images/logo/*.png static/logo_dark_github.png
|
||||
|
||||
ln -f -r -s static/logo_dark_github.png docs/source/_static/logo_dark_github.png
|
||||
|
||||
MANIM_SLIDES_THEME=light poetry run manim render -t -qk -s --format png --resolution 2560,1280 static/logo.py && mv media/images/logo/*.png static/logo_light_transparent.png
|
||||
|
||||
ln -f -r -s static/logo_light_transparent.png docs/source/_static/logo_light_transparent.png
|
||||
|
||||
MANIM_SLIDES_THEME=dark_docs poetry run manim render -t -qk -s --format png --resolution 2560,1280 static/logo.py && mv media/images/logo/*.png static/logo_dark_transparent.png
|
||||
|
||||
ln -f -r -s static/logo_dark_transparent.png docs/source/_static/logo_dark_transparent.png
|
BIN
static/wizard_dark.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
static/wizard_light.png
Normal file
After Width: | Height: | Size: 26 KiB |