mirror of
https://github.com/jeertmans/manim-slides.git
synced 2025-05-18 11:05:54 +08:00

* feat(cli): allow offline HTML presentations * feat(convert): allow fully offline HTML presentation TODO: check if this is really the case, especially for nested dependencies? Closes #438 * fix(cli): typo * chore(fmt): auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * chore(tests): add tests * fix(cli): use full path * fix(tests): typo * chore(ci): avoid specific kernel name * fix ? * chore(lib): simplify logic --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
101 lines
2.4 KiB
Plaintext
101 lines
2.4 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "6896875b-34ce-4fc5-809c-669c295067e7",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Jupyter Magic Example\n",
|
|
"\n",
|
|
"This small example shows how to use the Manim Slides cell (`%%manim_slides`) and line (`%manim_slides`) magics:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "a73f1c06-c7f8-4f19-a90e-e283bfb8c7c5",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from manim import *\n",
|
|
"\n",
|
|
"from manim_slides import *"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "68dda1a0-74ff-4d9e-9575-5b25a98f21e7",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"%%manim_slides -v WARNING --progress_bar None MySlide --manim-slides controls=true\n",
|
|
"\n",
|
|
"config.media_embed = True\n",
|
|
"\n",
|
|
"class MySlide(Slide):\n",
|
|
" def construct(self):\n",
|
|
" square = Square()\n",
|
|
" circle = Circle()\n",
|
|
" \n",
|
|
" self.play(Create(square))\n",
|
|
" self.next_slide()\n",
|
|
" self.play(Transform(square, circle))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "54fa2d3e-bfee-417d-b64b-f3f30a8749ea",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"class MyOtherSlide(Slide):\n",
|
|
" def construct(self):\n",
|
|
" text = VGroup(\n",
|
|
" Text(\"Press\"),\n",
|
|
" Text(\"and\"),\n",
|
|
" Text(\"loop\"),\n",
|
|
" ).arrange(DOWN, buff=1.0)\n",
|
|
"\n",
|
|
" self.play(Write(text))\n",
|
|
" self.next_slide(loop=True)\n",
|
|
" self.play(Indicate(text[-1], scale_factor=2.0, run_time=0.5))\n",
|
|
" self.next_slide()\n",
|
|
" self.play(FadeOut(text))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "7d8ad450-1487-4ca7-8d89-bf8ac344e1fa",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"%manim_slides -v WARNING --progress_bar None MyOtherSlide --manim-slides controls=true"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": ".venv",
|
|
"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.11.8"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|