mirror of
https://github.com/jeertmans/manim-slides.git
synced 2025-05-17 18:55:53 +08:00
Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
6a96b3ab8c | |||
a1c041db80 | |||
4fd3452f95 | |||
ff2be6851b | |||
95289ee7a5 | |||
f1a026208a | |||
b3fd1d209e | |||
8c38db0989 | |||
6da0c36c96 | |||
3b01efa601 | |||
c9ef5e9a75 | |||
bfad43bd38 | |||
6f2cbc9b19 |
@ -1,5 +1,5 @@
|
|||||||
[bumpversion]
|
[bumpversion]
|
||||||
current_version = 4.13.0
|
current_version = 4.13.2
|
||||||
commit = True
|
commit = True
|
||||||
message = chore(version): bump {current_version} to {new_version}
|
message = chore(version): bump {current_version} to {new_version}
|
||||||
|
|
||||||
|
14
.github/workflows/pages.yml
vendored
14
.github/workflows/pages.yml
vendored
@ -54,12 +54,16 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: media
|
path: media
|
||||||
key: ${{ runner.os }}-media
|
key: ${{ runner.os }}-media
|
||||||
- name: Build animation and convert it into HTML slides
|
- name: Build animations
|
||||||
run: |
|
run: |
|
||||||
poetry run manim example.py ConvertExample BasicExample ThreeDExample
|
poetry run manim example.py ConvertExample BasicExample ThreeDExample
|
||||||
poetry run manim-slides convert ConvertExample docs/source/_static/slides.html -ccontrols=true
|
- name: Convert animations to HTML slides
|
||||||
poetry run manim-slides convert BasicExample docs/source/_static/basic_example.html -ccontrols=true
|
run: |
|
||||||
poetry run manim-slides convert ThreeDExample docs/source/_static/three_d_example.html -ccontrols=true
|
poetry run manim-slides convert -v DEBUG ConvertExample docs/source/_static/slides.html -ccontrols=true
|
||||||
|
poetry run manim-slides convert -v DEBUG BasicExample docs/source/_static/basic_example.html -ccontrols=true
|
||||||
|
poetry run manim-slides convert -v DEBUG ThreeDExample docs/source/_static/three_d_example.html -ccontrols=true
|
||||||
|
- name: Show docs/source/_static/ dir content (video only)
|
||||||
|
run: tree -L 3 docs/source/_static/ -P '*.mp4'
|
||||||
- name: Clear cache
|
- name: Clear cache
|
||||||
run: |
|
run: |
|
||||||
gh extension install actions/gh-actions-cache
|
gh extension install actions/gh-actions-cache
|
||||||
@ -80,6 +84,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
# Upload docs/build/html dir
|
# Upload docs/build/html dir
|
||||||
path: docs/build/html/
|
path: docs/build/html/
|
||||||
|
- name: Show docs/build/html/_static/ dir content (video only)
|
||||||
|
run: tree -L 3 docs/build/html/_static/ -P '*.mp4'
|
||||||
- name: Deploy to GitHub Pages
|
- name: Deploy to GitHub Pages
|
||||||
id: deployment
|
id: deployment
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
|
@ -12,7 +12,7 @@ repos:
|
|||||||
- id: isort
|
- id: isort
|
||||||
name: isort (python)
|
name: isort (python)
|
||||||
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
|
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
|
||||||
rev: v2.8.0
|
rev: v2.9.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: pretty-format-yaml
|
- id: pretty-format-yaml
|
||||||
args: [--autofix]
|
args: [--autofix]
|
||||||
@ -24,11 +24,11 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
||||||
rev: v0.0.263
|
rev: v0.0.269
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||||
rev: v1.2.0
|
rev: v1.3.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: mypy
|
- id: mypy
|
||||||
additional_dependencies: [types-requests, types-setuptools]
|
additional_dependencies: [types-requests, types-setuptools]
|
||||||
|
@ -66,6 +66,56 @@ Example using 3D camera. As Manim and ManimGL handle 3D differently, definitions
|
|||||||
:end-before: [manimgl-3d]
|
:end-before: [manimgl-3d]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Subclass Custom Scenes
|
||||||
|
|
||||||
|
For compatibility reasons, Manim Slides only provides subclasses for
|
||||||
|
`Scene` and `ThreeDScene`.
|
||||||
|
However, subclassing other scene classes is totally possible,
|
||||||
|
and very simple to do actually!
|
||||||
|
|
||||||
|
[For example](https://github.com/jeertmans/manim-slides/discussions/185),
|
||||||
|
you can subclass the `MovingCameraScene` class from `manim`
|
||||||
|
with the following code:
|
||||||
|
|
||||||
|
```{code-block} python
|
||||||
|
:linenos:
|
||||||
|
|
||||||
|
from manim import *
|
||||||
|
from manim_slides import Slide
|
||||||
|
|
||||||
|
|
||||||
|
class MovingCameraSlide(Slide, MovingCameraScene):
|
||||||
|
pass
|
||||||
|
```
|
||||||
|
|
||||||
|
And later use this class anywhere in your code:
|
||||||
|
|
||||||
|
|
||||||
|
```{code-block} python
|
||||||
|
:linenos:
|
||||||
|
|
||||||
|
class SubclassExample(MovingCameraSlide):
|
||||||
|
def construct(self):
|
||||||
|
eq1 = MathTex("x", "=", "1")
|
||||||
|
eq2 = MathTex("x", "=", "2")
|
||||||
|
|
||||||
|
self.play(Write(eq1))
|
||||||
|
|
||||||
|
self.next_slide()
|
||||||
|
|
||||||
|
self.play(
|
||||||
|
TransformMatchingTex(eq1, eq2),
|
||||||
|
self.camera.frame.animate.scale(0.5)
|
||||||
|
)
|
||||||
|
|
||||||
|
self.wait()
|
||||||
|
```
|
||||||
|
|
||||||
|
:::{note}
|
||||||
|
If you do not plan to reuse `MovingCameraSlide` more than once, then you can
|
||||||
|
directly write the `construct` method in the body of `MovingCameraSlide`.
|
||||||
|
:::
|
||||||
|
|
||||||
## Advanced Example
|
## Advanced Example
|
||||||
|
|
||||||
A more advanced example is `ConvertExample`, which is used as demo slide and tutorial.
|
A more advanced example is `ConvertExample`, which is used as demo slide and tutorial.
|
||||||
|
@ -1 +1 @@
|
|||||||
__version__ = "4.13.0"
|
__version__ = "4.13.2"
|
||||||
|
@ -57,7 +57,7 @@ def verbosity_option(function: F) -> F:
|
|||||||
["PERF", "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
|
["PERF", "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
|
||||||
case_sensitive=False,
|
case_sensitive=False,
|
||||||
),
|
),
|
||||||
help="Verbosity of CLI output",
|
help="Verbosity of CLI output. PERF will log performances (timing) information.",
|
||||||
default=None,
|
default=None,
|
||||||
expose_value=False,
|
expose_value=False,
|
||||||
envvar="MANIM_SLIDES_VERBOSITY",
|
envvar="MANIM_SLIDES_VERBOSITY",
|
||||||
|
@ -54,7 +54,7 @@ def validate_config_option(
|
|||||||
class Converter(BaseModel): # type: ignore
|
class Converter(BaseModel): # type: ignore
|
||||||
presentation_configs: List[PresentationConfig] = []
|
presentation_configs: List[PresentationConfig] = []
|
||||||
assets_dir: str = "{basename}_assets"
|
assets_dir: str = "{basename}_assets"
|
||||||
template: Optional[str] = None
|
template: Optional[Path] = None
|
||||||
|
|
||||||
def convert_to(self, dest: Path) -> None:
|
def convert_to(self, dest: Path) -> None:
|
||||||
"""Converts self, i.e., a list of presentations, into a given format."""
|
"""Converts self, i.e., a list of presentations, into a given format."""
|
||||||
@ -314,6 +314,8 @@ class RevealJS(Converter):
|
|||||||
file = presentation_config.files[slide_config.start_animation]
|
file = presentation_config.files[slide_config.start_animation]
|
||||||
file = assets_dir / file.name
|
file = assets_dir / file.name
|
||||||
|
|
||||||
|
logger.debug(f"Writing video section with file {file}")
|
||||||
|
|
||||||
# TODO: document this
|
# TODO: document this
|
||||||
# Videos are muted because, otherwise, the first slide never plays correctly.
|
# Videos are muted because, otherwise, the first slide never plays correctly.
|
||||||
# This is due to a restriction in playing audio without the user doing anything.
|
# This is due to a restriction in playing audio without the user doing anything.
|
||||||
@ -327,9 +329,8 @@ class RevealJS(Converter):
|
|||||||
|
|
||||||
def load_template(self) -> str:
|
def load_template(self) -> str:
|
||||||
"""Returns the RevealJS HTML template as a string."""
|
"""Returns the RevealJS HTML template as a string."""
|
||||||
if isinstance(self.template, str):
|
if isinstance(self.template, Path):
|
||||||
with open(self.template, "r") as f:
|
return self.template.read_text()
|
||||||
return f.read()
|
|
||||||
|
|
||||||
if sys.version_info < (3, 9):
|
if sys.version_info < (3, 9):
|
||||||
return resources.read_text(data, "revealjs_template.html")
|
return resources.read_text(data, "revealjs_template.html")
|
||||||
@ -350,6 +351,8 @@ class RevealJS(Converter):
|
|||||||
)
|
)
|
||||||
full_assets_dir = dirname / assets_dir
|
full_assets_dir = dirname / assets_dir
|
||||||
|
|
||||||
|
logger.debug(f"Assets will be saved to: {full_assets_dir}")
|
||||||
|
|
||||||
os.makedirs(full_assets_dir, exist_ok=True)
|
os.makedirs(full_assets_dir, exist_ok=True)
|
||||||
|
|
||||||
for presentation_config in self.presentation_configs:
|
for presentation_config in self.presentation_configs:
|
||||||
|
@ -906,7 +906,7 @@ def start_at_callback(
|
|||||||
"-s",
|
"-s",
|
||||||
"--skip-all",
|
"--skip-all",
|
||||||
is_flag=True,
|
is_flag=True,
|
||||||
help="Skip all slides, useful the test if slides are working. Automatically sets `--skip-after-last-slide` to True.",
|
help="Skip all slides, useful the test if slides are working. Automatically sets `--exit-after-last-slide` to True.",
|
||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"-r",
|
"-r",
|
||||||
|
@ -59,7 +59,9 @@ 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
|
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
|
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
|
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
|
evolved a lot (see
|
||||||
|
[comparison section](#comparison-with-manim-presentation)),
|
||||||
|
has built a small community of contributors, and continues to
|
||||||
provide new features on a regular basis.
|
provide new features on a regular basis.
|
||||||
|
|
||||||
# Easy to Use Commitment
|
# Easy to Use Commitment
|
||||||
@ -133,6 +135,31 @@ share your slides, which we discuss on our
|
|||||||
[Sharing your slides](https://jeertmans.github.io/manim-slides/reference/sharing.html)
|
[Sharing your slides](https://jeertmans.github.io/manim-slides/reference/sharing.html)
|
||||||
page.
|
page.
|
||||||
|
|
||||||
|
## Comparison with manim-presentation
|
||||||
|
|
||||||
|
Starting from [@manim-presentation]'s original work, Manim Slides now provides
|
||||||
|
numerous additional features.
|
||||||
|
A non-exhaustive list of those new features is as follows:
|
||||||
|
|
||||||
|
* ManimGL compatibility;
|
||||||
|
* playing slides in reverse;
|
||||||
|
* exporting slides to HTML and PowerPoint;
|
||||||
|
* 3D scene support;
|
||||||
|
* multiple key inputs can map to the same action
|
||||||
|
(e.g., useful when using a pointer);
|
||||||
|
* optionally hiding mouse cursor when presenting;
|
||||||
|
* recording your presentation;
|
||||||
|
* multiple video scaling methods (for speed-vs-quality tradeoff);
|
||||||
|
* and automatic detection of some scene parameters
|
||||||
|
(e.g., resolution or background color).
|
||||||
|
|
||||||
|
The complete and up-to-date set of features Manim Slide supports is
|
||||||
|
available in the
|
||||||
|
[online documentation](https://jeertmans.github.io/manim-slides/).
|
||||||
|
For new feature requests, we highly encourage users to
|
||||||
|
[create an issue](https://github.com/jeertmans/manim-slides/issues/new/choose)
|
||||||
|
with the appropriate template.
|
||||||
|
|
||||||
# Acknowledgements
|
# Acknowledgements
|
||||||
|
|
||||||
We acknowledge the work of [@manim-presentation] that paved the initial structure
|
We acknowledge the work of [@manim-presentation] that paved the initial structure
|
||||||
|
@ -43,7 +43,7 @@ packages = [
|
|||||||
]
|
]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
repository = "https://github.com/jeertmans/manim-slides"
|
repository = "https://github.com/jeertmans/manim-slides"
|
||||||
version = "4.13.0"
|
version = "4.13.2"
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
click = "^8.1.3"
|
click = "^8.1.3"
|
||||||
|
Reference in New Issue
Block a user