Skip to content

Commit fbc28ba

Browse files
committed
Merge remote-tracking branch 'origin/master' into docker
2 parents af0e314 + 6addecc commit fbc28ba

File tree

16 files changed

+480
-54
lines changed

16 files changed

+480
-54
lines changed

README.md

Lines changed: 49 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,45 @@
1-
![logo](https://raw.githubusercontent.com/ManimCommunity/manim/master/logo/cropped.png)
2-
3-
![CI](https://github.com/ManimCommunity/manim/workflows/CI/badge.svg)
4-
[![Documentation Status](https://readthedocs.org/projects/manimce/badge/?version=latest)](https://manimce.readthedocs.io/en/latest/?badge=latest)
5-
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://choosealicense.com/licenses/mit/)
6-
[![Manim Subreddit](https://img.shields.io/reddit/subreddit-subscribers/manim.svg?color=ff4301&label=reddit)](https://www.reddit.com/r/manim/)
7-
[![Manim Discord](https://img.shields.io/discord/581738731934056449.svg?label=discord)](https://discord.gg/mMRrZQW)
8-
9-
Manim is an animation engine for explanatory math videos. It's used to create precise animations programmatically, as seen in the videos at [3Blue1Brown](https://www.3blue1brown.com/).
10-
11-
> NOTE: This repository is maintained by the Manim Community, and is not associated with Grant Sanderson or 3Blue1Brown in any way (though we are definitely indebted to him for providing his work to the world). If you want to study how Grant makes his videos, head over to his repository (3b1b/manim). This is a more frequently updated repository than that one, and is recommended if you want to use Manim for your own projects.
1+
<p align="center">
2+
<img src="https://raw.githubusercontent.com/ManimCommunity/manim/master/logo/cropped.png" />
3+
<br />
4+
<br />
5+
<img src="https://img.shields.io/badge/license-MIT-red.svg?style=flat" alt="MIT License" src="http://choosealicense.com/licenses/mit/" />
6+
<img src="https://img.shields.io/reddit/subreddit-subscribers/manim.svg?color=orange&label=reddit" alt="Reddit" href="https://www.reddit.com/r/manim/" />
7+
<img src="https://img.shields.io/discord/581738731934056449.svg?label=discord&color=yellow" alt="Discord" href="https://discord.gg/mMRrZQW" />
8+
<img src="https://readthedocs.org/projects/manimce/badge/?version=latest" alt="Documentation Status" href="https://manimce.readthedocs.io/en/latest/?badge=latest" />
9+
<img src="https://github.com/ManimCommunity/manim/workflows/CI/badge.svg" alt="CI" />
10+
<br />
11+
<br />
12+
<i>An animation engine for explanatory math videos</i>
13+
</p>
14+
15+
<hr />
16+
17+
`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/).
18+
19+
> 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 that his, and it's recommended to use this fork if you'd like to use Manim for your own projects.
1220
1321
## Table of Contents:
1422

15-
- [Installation](#installation)
16-
- [Usage](#usage)
17-
- [Documentation](#documentation)
18-
- [Help with Manim](#help-with-manim)
19-
- [Contributing](#contributing)
20-
- [License](#license)
23+
- [Installation](#installation)
24+
- [Usage](#usage)
25+
- [Documentation](#documentation)
26+
- [Help with Manim](#help-with-manim)
27+
- [Contributing](#contributing)
28+
- [License](#license)
2129

2230
## Installation
2331

24-
Manim has a few dependencies that need to be installed before it. Please visit
25-
the
26-
[documentation](https://manimce.readthedocs.io/en/latest/installation.html)
27-
and follow the instructions according to your operating system.
32+
Manim requires a few dependencies that must be installed prior to using it. Please visit the [documentation](https://manimce.readthedocs.io/en/latest/installation.html) and follow the appropriate instructions for your operating system.
33+
34+
Once the dependencies have been installed, run the following in a terminal window:
35+
36+
```bash
37+
pip install manimce
38+
```
2839

2940
## Usage
3041

31-
Here is an example manim script:
42+
Manim is an extremely versatile package. The following is an example `Scene` you can construct:
3243

3344
```python
3445
from manim import *
@@ -46,56 +57,46 @@ class SquareToCircle(Scene):
4657
self.play(FadeOut(square))
4758
```
4859

49-
Save this code in a file called `example.py`. Now open your terminal in the
50-
folder where you saved the file and execute
60+
In order to view the output of this scene, save the code in a file called `example.py`. Then, run the following in a terminal window:
5161

5262
```sh
53-
manim example.py SquareToCircle -pl
63+
manim example.py SquareToCircle -p -ql
5464
```
5565

56-
You should see your video player pop up and play a simple scene where a square
57-
is transformed into a circle. You can find some more simple examples in the
58-
[GitHub repository](https://github.com/ManimCommunity/manim/tree/master/example_scenes).
59-
Visit the [official gallery](https://manimce.readthedocs.io/en/latest/examples.html) for more advanced examples.
66+
You should see your native video player program pop up and play a simple scene in which a square is transformed into a circle. You may find some more simple examples within this
67+
[GitHub repository](master/example_scenes). You can also visit the [official gallery](https://manimce.readthedocs.io/en/latest/examples.html) for more advanced examples.
6068

6169
## Command line arguments
6270

6371
The general usage of manim is as follows:
6472

65-
![manim-illustration](https://raw.githubusercontent.com/ManimCommunity/manim/master/readme-assets/command.png)
73+
![manim-illustration](docs/source/_static/command.png)
6674

67-
The `-p` flag in the command above is for previewing, meaning the video file will automatically open when it is done rendering. The `-l` flag is for a faster rendering at a lower quality.
75+
The `-p` flag in the command above is for previewing, meaning the video file will automatically open when it is done rendering. The `-ql` flag is for a faster rendering at a lower quality.
6876

6977
Some other useful flags include:
7078

71-
- `-s` to skip to the end and just show the final frame.
72-
- `-n <number>` to skip ahead to the `n`'th animation of a scene.
73-
- `-f` show the file in the file browser.
79+
- `-s` to skip to the end and just show the final frame.
80+
- `-n <number>` to skip ahead to the `n`'th animation of a scene.
81+
- `-f` show the file in the file browser.
7482

75-
For a thorough list of command line arguments, visit the
76-
[documentation](https://manimce.readthedocs.io/en/latest/tutorials/configuration.html).
83+
For a thorough list of command line arguments, visit the [documentation](https://manimce.readthedocs.io/en/latest/tutorials/configuration.html).
7784

7885
## Documentation
7986

8087
Documentation is in progress at [ReadTheDocs](https://manimce.readthedocs.io/en/latest/).
8188

8289
## Help with Manim
8390

84-
If you need help installing or using Manim, please take a look at [the Reddit
85-
Community](https://www.reddit.com/r/manim) or the [Discord
86-
Community](https://discord.gg/mMRrZQW). For bug reports and feature requests,
87-
please open an issue.
91+
If you need help installing or using Manim, feel free to reach out to our [Discord
92+
Server](https://discord.gg/mMRrZQW) or [Reddit Community](https://www.reddit.com/r/manim). If you would like to submit bug report or feature request, please open an issue.
8893

8994
## Contributing
9095

91-
Is always welcome. In particular, there is a dire need for tests and
92-
documentation. For guidelines please see the
93-
[documentation](https://manimce.readthedocs.io/en/latest/contributing.html).
94-
This project uses [Poetry](https://python-poetry.org/docs/) for management. You need to have poetry installed and available in your environment.
95-
You can find more information about it in its [Documentation](https://manimce.readthedocs.io/en/latest/installation/for_dev.html)
96+
Contributions to `manim` are always welcome. In particular, there is a dire need for tests and documentation. For contribution guidelines, please see the [documentation](https://manimce.readthedocs.io/en/latest/contributing.html).
97+
98+
This project uses [Poetry](https://python-poetry.org/docs/) for management. You must have poetry installed and available in your environment. You can learn more `poetry` and how to use it at its [Documentation](https://manimce.readthedocs.io/en/latest/installation/for_dev.html).
9699

97100
## License
98101

99-
The software is double-licensed under the MIT license, with copyright
100-
by 3blue1brown LLC (see LICENSE), and copyright by Manim Community
101-
Developers (see LICENSE.community).
102+
The software is double-licensed under the MIT license, with copyright by 3blue1brown LLC (see LICENSE), and copyright by Manim Community Developers (see LICENSE.community).

docs/source/_static/command.png

26.1 KB
Loading

docs/source/examples/shapes_images_positions.rst

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,68 @@ Shapes, Images and Positions
5151
self.wait()
5252

5353

54+
.. manim:: ManimCELogo
55+
:save_last_frame:
56+
57+
class ManimCELogo(Scene):
58+
def construct(self):
59+
logo_green = "#87c2a5"
60+
logo_blue = "#525893"
61+
logo_red = "#e07a5f"
62+
ds_m = MathTex(r"\mathbb{M}", z_index=20).scale(7)
63+
ds_m.shift(2.25*LEFT + 1.5*UP)
64+
circle = Circle(color=logo_green,
65+
fill_opacity=1,
66+
z_index=7)
67+
square = Square(color=logo_blue,
68+
fill_opacity=1,
69+
z_index=5)
70+
triangle = Triangle(color=logo_red,
71+
fill_opacity=1,
72+
z_index=3)
73+
circle.shift(LEFT)
74+
square.shift(UP)
75+
triangle.shift(RIGHT)
76+
self.add(triangle, square, circle, ds_m) # Order matters
77+
self.wait()
78+
79+
Download the resource for the following example `here <https://github.com/ManimCommunity/manim/blob/master/docs/source/_static/manim-logo-sidebar.svg>`_
80+
81+
.. manim:: ManimCELogoFromSVG
82+
83+
class ManimCELogoFromSVG(Scene):
84+
def construct(self):
85+
v_image = SVGMobject(file_name="manim-logo-sidebar.svg")
86+
self.add(v_image)
87+
88+
# Custom colors can be defined with hex strings
89+
logo_blue, logo_green, logo_red = "#525893", "#87C2A5", "#E07A5F"
90+
91+
# An SVG file with multiple objects can be decomposed into
92+
# their subcomponents
93+
triangle = v_image.submobjects[0]
94+
square = v_image.submobjects[1]
95+
circle = v_image.submobjects[2]
96+
m = v_image.submobjects[3]
97+
98+
self.play(
99+
ApplyMethod(triangle.set_fill, logo_red),
100+
ApplyMethod(square.set_fill, logo_blue),
101+
ApplyMethod(circle.set_fill, logo_green),
102+
ApplyMethod(m.set_fill, WHITE, opacity=1),
103+
)
104+
self.wait()
105+
106+
Download the resource for the following example `here <https://github.com/ManimCommunity/manim/blob/master/docs/source/_static/favicon.ico>`_
107+
108+
.. manim:: ManimCELogoFromImage
109+
:save_last_frame:
110+
111+
class ManimCELogoFromImage(Scene):
112+
def construct(self):
113+
image = ImageMobject(filename_or_array="favicon.ico")
114+
self.add(image)
115+
54116
.. manim:: GradientImageFromArray
55117
:save_last_frame:
56118

docs/source/manim_directive.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ def run(self):
197197
config.images_dir = "{media_dir}/images"
198198
config.video_dir = "{media_dir}/videos/{quality}"
199199
output_file = f"{clsname}-{classnamedict[clsname]}"
200+
config.assets_dir = Path("_static")
200201

201202
config_code = [
202203
f'config["frame_rate"] = {frame_rate}',

manim/_config/default.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ media_dir = ./media
7474
# --log_dir
7575
log_dir = {media_dir}/logs
7676

77+
# --assets_dir
78+
assets_dir = ./
79+
7780
# the following do not have CLI arguments but depend on media_dir
7881
video_dir = {media_dir}/videos/{module_name}/{quality}
7982
images_dir = {media_dir}/images/{module_name}

manim/_config/utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ class MyScene(Scene):
245245
"""
246246

247247
_OPTS = {
248+
"assets_dir",
248249
"background_color",
249250
"background_opacity",
250251
"custom_folders",
@@ -523,6 +524,7 @@ def digest_parser(self, parser):
523524

524525
# str keys
525526
for key in [
527+
"assets_dir",
526528
"verbosity",
527529
"media_dir",
528530
"log_dir",
@@ -1153,6 +1155,7 @@ def get_dir(self, key, **kwargs):
11531155
11541156
"""
11551157
dirs = [
1158+
"assets_dir",
11561159
"media_dir",
11571160
"video_dir",
11581161
"images_dir",
@@ -1195,6 +1198,12 @@ def _set_dir(self, key, val):
11951198
else:
11961199
self._d.__setitem__(key, val)
11971200

1201+
assets_dir = property(
1202+
lambda self: self._d["assets_dir"],
1203+
lambda self, val: self._set_dir("assets_dir", val),
1204+
doc="Directory to locate video assets.",
1205+
)
1206+
11981207
log_dir = property(
11991208
lambda self: self._d["log_dir"],
12001209
lambda self, val: self._set_dir("log_dir", val),

0 commit comments

Comments
 (0)