@@ -8,6 +8,68 @@ can be configured programmatically via `the ManimConfig class`_, at the time
88of command invocation via `command-line arguments `_, or at the time the library
99is first imported via `the config files `_.
1010
11+ The most common, simplest and recommended way to set the configure Manim is
12+ via the command-line interface (CLI), which is described directly below.
13+
14+ Command-line arguments
15+ **********************
16+
17+ By far the most commonly used command in the CLI is the ``render `` command,
18+ which is used to render scene(s) to an output file.
19+ It is used with the following arguments:
20+
21+ .. program-output :: manim render --help
22+ :ellipsis: 9
23+
24+ However, since manim defaults to the :code: `render ` command whenever no command
25+ is specified, the following form is far more common and can be used instead:
26+
27+ .. code-block :: bash
28+
29+ manim [OPTIONS] FILE [SCENES]
30+
31+ An example of using the above form is:
32+
33+ .. code-block :: bash
34+
35+ manim -qm file.py SceneOne
36+
37+ This asks manim to search for a Scene class called :code: `SceneOne ` inside the
38+ file ``file.py `` and render it with medium quality (specified by the ``-qm `` flag).
39+
40+ Another frequently used flag is ``-p `` ("preview"), which makes manim
41+ open the rendered video after it's done rendering.
42+
43+ .. note :: The ``-p`` flag does not change any properties of the global
44+ ``config `` dict. The ``-p `` flag is only a command-line convenience.
45+
46+ Advanced examples
47+ =================
48+
49+ To render a scene in high quality, but only output the last frame of the scene
50+ instead of the whole video, you can execute
51+
52+ .. code-block :: bash
53+
54+ manim -sqh < file.py> SceneName
55+
56+ The following example specifies the output file name (with the :code: `-o `
57+ flag), renders only the first ten animations (:code: `-n ` flag) with a white
58+ background (:code: `-c ` flag), and saves the animation as a ``.gif `` instead of as a
59+ ``.mp4 `` file (``--format=gif `` flag). It uses the default quality and does not try to
60+ open the file after it is rendered.
61+
62+ .. code-block :: bash
63+
64+ manim -o myscene --format=gif -n 0,10 -c WHITE < file.py> SceneName
65+
66+ A list of all CLI flags
67+ ========================
68+
69+ .. command-output :: manim --help
70+ .. command-output :: manim render --help
71+ .. command-output :: manim cfg --help
72+ .. command-output :: manim plugins --help
1173
1274The ManimConfig class
1375*********************
@@ -74,70 +136,18 @@ rendered in our documentation with a reference frame.
74136 self.add(Text(str(pixel_height)).next_to(d2, RIGHT))
75137
76138
77- Command-line arguments
78- **********************
79-
80- Usually, manim is run from the command-line by executing
81-
82- .. code-block :: bash
83-
84- manim < file.py> SceneName
85-
86- This asks manim to search for a Scene class called :code: `SceneName ` inside the
87- file <file.py> and render it. One can also specify the render quality by using
88- the flags :code: `-ql `, :code: `-qm `, :code: `-qh `, or :code: `-qk `, for low, medium,
89- high, and 4k quality, respectively.
90-
91- .. code-block :: bash
92-
93- manim -ql < file.py> SceneName
94-
95- These flags set the values of the config options ``config.pixel_width ``,
96- ``config.pixel_height ``, ``config.frame_rate ``, and ``config.quality ``.
97-
98- Another frequent flag is ``-p `` ("preview"), which makes manim show the rendered video
99- right after it's done rendering.
100-
101- .. note :: The ``-p`` flag does not change any properties of the global
102- ``config `` dict. The ``-p `` flag is only a command-line convenience.
103-
104- Examples
105- ========
106-
107- To render a scene in high quality, but only output the last frame of the scene
108- instead of the whole video, you can execute
109-
110- .. code-block :: bash
111-
112- manim -sqh < file.py> SceneName
113-
114- The following example specifies the output file name (with the :code: `-o `
115- flag), renders only the first ten animations (:code: `-n ` flag) with a white
116- background (:code: `-c ` flag), and saves the animation as a .gif instead of as a
117- .mp4 file (:code: `-i ` flag). It uses the default quality and does not try to
118- open the file after it is rendered.
119-
120- .. code-block :: bash
121-
122- manim -o myscene -i -n 0,10 -c WHITE < file.py> SceneName
123-
124- .. tip :: There are many more command-line flags that manim accepts. All the
125- possible flags are shown by executing ``manim render --help ``. A complete list
126- of CLI flags is at the end of this document.
127-
128-
129139The config files
130140****************
131141
132142As the last example shows, executing manim from the command-line may involve
133143using many flags at the same time. This may become a nuisance if you must
134144execute the same script many times in a short time period, for example when
135- making small incremental tweaks to your scene script. For this purpose , manim
145+ making small incremental tweaks to your scene script. For this reason , manim
136146can also be configured using a configuration file. A configuration file is a
137147file ending with the suffix ``.cfg ``.
138148
139- To use a configuration file when rendering your scene, you must create a file
140- with name ``manim.cfg `` in the same directory as your scene code.
149+ To use a local configuration file when rendering your scene, you must create a
150+ file with name ``manim.cfg `` in the same directory as your scene code.
141151
142152.. warning :: The config file **must** be named ``manim.cfg``. Currently, manim
143153 does not support config files with any other name.
@@ -154,7 +164,7 @@ and serve the same purpose. Take for example the following config file.
154164 save_as_gif = True
155165 background_color = WHITE
156166
157- Config files are read with the standard python library ``configparser ``. In
167+ Config files are parsed with the standard python library ``configparser ``. In
158168particular, they will ignore any line that starts with a pound symbol ``# ``.
159169
160170Now, executing the following command
@@ -354,34 +364,3 @@ A list of all config options
354364 'verbosity', 'video_dir', 'webgl_renderer_path', 'window_position',
355365 'window_monitor', 'window_size', 'write_all', 'write_to_movie', 'enable_wireframe',
356366 'force_window']
357-
358-
359- A list of all CLI flags
360- ***********************
361-
362- .. code ::
363-
364- manim --help
365-
366- Usage: manim [OPTIONS] COMMAND [ARGS]...
367-
368- Animation engine for explanatory math videos
369-
370- Options:
371- --version Show the version and exit.
372- --help Show this message and exit.
373-
374- Commands:
375- render* Render SCENE(S) from the input FILE.
376- cfg Manages Manim configuration files.
377- plugins Manages Manim plugins.
378-
379- Made with <3 by Manim Community developers.
380-
381- Each of the subcommands has its own help page which can be
382-
383- .. code ::
384-
385- manim render --help
386- manim cfg --help
387- manim plugins --help
0 commit comments