mirror of
https://github.com/3b1b/manim.git
synced 2025-07-28 04:23:16 +08:00
finish config, structure, constants and custom_default
This commit is contained in:
@ -1,2 +1,172 @@
|
||||
constants (TODO)
|
||||
================
|
||||
constants
|
||||
=========
|
||||
|
||||
The ``constants.py`` in the ``manimlib`` folder defines the constants
|
||||
needed when running manim. Some constants are not explained here because
|
||||
they are only used inside manim.
|
||||
|
||||
Frame and pixel shape
|
||||
---------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
ASPECT_RATIO = 16.0 / 9.0
|
||||
FRAME_HEIGHT = 8.0
|
||||
FRAME_WIDTH = FRAME_HEIGHT * ASPECT_RATIO
|
||||
FRAME_Y_RADIUS = FRAME_HEIGHT / 2
|
||||
FRAME_X_RADIUS = FRAME_WIDTH / 2
|
||||
|
||||
DEFAULT_PIXEL_HEIGHT = 1080
|
||||
DEFAULT_PIXEL_WIDTH = 1920
|
||||
DEFAULT_FRAME_RATE = 30
|
||||
|
||||
Buffs
|
||||
-----
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
SMALL_BUFF = 0.1
|
||||
MED_SMALL_BUFF = 0.25
|
||||
MED_LARGE_BUFF = 0.5
|
||||
LARGE_BUFF = 1
|
||||
|
||||
DEFAULT_MOBJECT_TO_EDGE_BUFFER = MED_LARGE_BUFF # Distance between object and edge
|
||||
DEFAULT_MOBJECT_TO_MOBJECT_BUFFER = MED_SMALL_BUFF # Distance between objects
|
||||
|
||||
Run times
|
||||
---------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
DEFAULT_POINTWISE_FUNCTION_RUN_TIME = 3.0
|
||||
DEFAULT_WAIT_TIME = 1.0
|
||||
|
||||
Coordinates
|
||||
-----------
|
||||
|
||||
manim uses three-dimensional coordinates and uses the type of ``ndarray``
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
ORIGIN = np.array((0., 0., 0.))
|
||||
UP = np.array((0., 1., 0.))
|
||||
DOWN = np.array((0., -1., 0.))
|
||||
RIGHT = np.array((1., 0., 0.))
|
||||
LEFT = np.array((-1., 0., 0.))
|
||||
IN = np.array((0., 0., -1.))
|
||||
OUT = np.array((0., 0., 1.))
|
||||
X_AXIS = np.array((1., 0., 0.))
|
||||
Y_AXIS = np.array((0., 1., 0.))
|
||||
Z_AXIS = np.array((0., 0., 1.))
|
||||
|
||||
# Useful abbreviations for diagonals
|
||||
UL = UP + LEFT
|
||||
UR = UP + RIGHT
|
||||
DL = DOWN + LEFT
|
||||
DR = DOWN + RIGHT
|
||||
|
||||
TOP = FRAME_Y_RADIUS * UP
|
||||
BOTTOM = FRAME_Y_RADIUS * DOWN
|
||||
LEFT_SIDE = FRAME_X_RADIUS * LEFT
|
||||
RIGHT_SIDE = FRAME_X_RADIUS * RIGHT
|
||||
|
||||
Mathematical constant
|
||||
---------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
PI = np.pi
|
||||
TAU = 2 * PI
|
||||
DEGREES = TAU / 360
|
||||
|
||||
Text
|
||||
----
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
START_X = 30
|
||||
START_Y = 20
|
||||
NORMAL = "NORMAL"
|
||||
ITALIC = "ITALIC"
|
||||
OBLIQUE = "OBLIQUE"
|
||||
BOLD = "BOLD"
|
||||
|
||||
Stroke width
|
||||
------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
DEFAULT_STROKE_WIDTH = 4
|
||||
|
||||
Colours
|
||||
-------
|
||||
|
||||
Here are the preview of default colours. (Modified from
|
||||
`elteoremadebeethoven <https://elteoremadebeethoven.github.io/manim_3feb_docs.github.io/html/_static/colors/colors.html>`_)
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<h3>BLUE</h3>
|
||||
<div class="colors BLUE_E"><p class="color-text">BLUE_E</p></div>
|
||||
<div class="colors BLUE_D"><p class="color-text">BLUE_D</p></div>
|
||||
<div class="colors BLUE_C"><p class="color-text">BLUE_C</p></div>
|
||||
<div class="colors BLUE_B"><p class="color-text">BLUE_B</p></div>
|
||||
<div class="colors BLUE_A"><p class="color-text">BLUE_A</p></div>
|
||||
<h3 style="margin-top: 6em">TEAL</h3>
|
||||
<div class="colors TEAL_E"><p class="color-text">TEAL_E</p></div>
|
||||
<div class="colors TEAL_D"><p class="color-text">TEAL_D</p></div>
|
||||
<div class="colors TEAL_C"><p class="color-text">TEAL_C</p></div>
|
||||
<div class="colors TEAL_B"><p class="color-text">TEAL_B</p></div>
|
||||
<div class="colors TEAL_A"><p class="color-text">TEAL_A</p></div>
|
||||
<h3 style="margin-top: 6em">GREEN</h3>
|
||||
<div class="colors GREEN_E"><p class="color-text">GREEN_E</p></div>
|
||||
<div class="colors GREEN_D"><p class="color-text">GREEN_D</p></div>
|
||||
<div class="colors GREEN_C"><p class="color-text">GREEN_C</p></div>
|
||||
<div class="colors GREEN_B"><p class="color-text">GREEN_B</p></div>
|
||||
<div class="colors GREEN_A"><p class="color-text">GREEN_A</p></div>
|
||||
<h3 style="margin-top: 6em">YELLOW</h3>
|
||||
<div class="colors YELLOW_E"><p class="color-text">YELLOW_E</p></div>
|
||||
<div class="colors YELLOW_D"><p class="color-text">YELLOW_D</p></div>
|
||||
<div class="colors YELLOW_C"><p class="color-text">YELLOW_C</p></div>
|
||||
<div class="colors YELLOW_B"><p class="color-text">YELLOW_B</p></div>
|
||||
<div class="colors YELLOW_A"><p class="color-text">YELLOW_A</p></div>
|
||||
<h3 style="margin-top: 6em">GOLD</h3>
|
||||
<div class="colors GOLD_E"><p class="color-text">GOLD_E</p></div>
|
||||
<div class="colors GOLD_D"><p class="color-text">GOLD_D</p></div>
|
||||
<div class="colors GOLD_C"><p class="color-text">GOLD_C</p></div>
|
||||
<div class="colors GOLD_B"><p class="color-text">GOLD_B</p></div>
|
||||
<div class="colors GOLD_A"><p class="color-text">GOLD_A</p></div>
|
||||
<h3 style="margin-top: 6em">RED</h3>
|
||||
<div class="colors RED_E"><p class="color-text">RED_E</p></div>
|
||||
<div class="colors RED_D"><p class="color-text">RED_D</p></div>
|
||||
<div class="colors RED_C"><p class="color-text">RED_C</p></div>
|
||||
<div class="colors RED_B"><p class="color-text">RED_B</p></div>
|
||||
<div class="colors RED_A"><p class="color-text">RED_A</p></div>
|
||||
<h3 style="margin-top: 6em">MAROON</h3>
|
||||
<div class="colors MAROON_E"><p class="color-text">MAROON_E</p></div>
|
||||
<div class="colors MAROON_D"><p class="color-text">MAROON_D</p></div>
|
||||
<div class="colors MAROON_C"><p class="color-text">MAROON_C</p></div>
|
||||
<div class="colors MAROON_B"><p class="color-text">MAROON_B</p></div>
|
||||
<div class="colors MAROON_A"><p class="color-text">MAROON_A</p></div>
|
||||
<h3 style="margin-top: 6em">PURPLE</h3>
|
||||
<div class="colors PURPLE_E"><p class="color-text">PURPLE_E</p></div>
|
||||
<div class="colors PURPLE_D"><p class="color-text">PURPLE_D</p></div>
|
||||
<div class="colors PURPLE_C"><p class="color-text">PURPLE_C</p></div>
|
||||
<div class="colors PURPLE_B"><p class="color-text">PURPLE_B</p></div>
|
||||
<div class="colors PURPLE_A"><p class="color-text">PURPLE_A</p></div>
|
||||
<h3 style="margin-top: 6em">GREY</h3>
|
||||
<div class="colors GREY_E"><p class="color-text">GREY_E</p></div>
|
||||
<div class="colors GREY_D"><p class="color-text">GREY_D</p></div>
|
||||
<div class="colors GREY_C"><p class="color-text">GREY_C</p></div>
|
||||
<div class="colors GREY_B"><p class="color-text">GREY_B</p></div>
|
||||
<div class="colors GREY_A"><p class="color-text">GREY_A</p></div>
|
||||
<h3 style="margin-top: 6em">Others</h3>
|
||||
<div class="colors WHITE"><p class="color-text" style="color: BLACK">WHITE</p></div>
|
||||
<div class="colors BLACK"><p class="color-text">BLACK</p></div>
|
||||
<div class="colors GREY_BROWN"><p class="color-text-small">GREY_BROWN</p></div>
|
||||
<div class="colors DARK_BROWN"><p class="color-text-small">DARK_BROWN</p></div>
|
||||
<div class="colors LIGHT_BROWN"><p class="color-text-small">LIGHT_BROWN</p></div>
|
||||
<div class="colors PINK"><p class="color-text">PINK</p></div>
|
||||
<div class="colors LIGHT_PINK"><p class="color-text-small">LIGHT_PINK</p></div>
|
||||
<div class="colors GREEN_SCREEN"><p class="color-text-small">GREEN_SCREEN</p></div>
|
||||
<div class="colors ORANGE"><p class="color-text">ORANGE</p></div>
|
||||
|
@ -1,2 +1,125 @@
|
||||
custom_default (TODO)
|
||||
=====================
|
||||
custom_default
|
||||
==============
|
||||
|
||||
``directories``
|
||||
---------------
|
||||
|
||||
- ``mirror_module_path``
|
||||
(``True`` or ``False``) Whether to create a folder named the name of the
|
||||
running file under the ``output`` path, and save the output (``images/``
|
||||
or ``videos/``) in it.
|
||||
|
||||
- ``output``
|
||||
Output file path, the videos will be saved in the ``videos/`` folder under it,
|
||||
and the pictures will be saved in the ``images/`` folder under it.
|
||||
|
||||
For example, if you set ``output`` to ``"/.../manim/output"`` and
|
||||
``mirror_module_path`` to ``False``, then you exported ``Scene1`` in the code
|
||||
file and saved the last frame, then the final directory structure will be like:
|
||||
|
||||
.. code-block:: text
|
||||
:emphasize-lines: 8, 10
|
||||
|
||||
manim/
|
||||
├── manimlib/
|
||||
│ ├── animation/
|
||||
│ ├── ...
|
||||
│ └── window.py
|
||||
├── output/
|
||||
│ ├── images
|
||||
│ │ └── Scene1.png
|
||||
│ └── videos
|
||||
│ └── Scene1.mp4
|
||||
├── code.py
|
||||
├── custom_default.yml
|
||||
└── manim.py
|
||||
|
||||
But if you set ``mirror_module_path`` to ``True``, the directory structure will be:
|
||||
|
||||
.. code-block:: text
|
||||
:emphasize-lines: 7
|
||||
|
||||
manim/
|
||||
├── manimlib/
|
||||
│ ├── animation/
|
||||
│ ├── ...
|
||||
│ └── window.py
|
||||
├── output/
|
||||
│ └── code/
|
||||
│ ├── images
|
||||
│ │ └── Scene1.png
|
||||
│ └── videos
|
||||
│ └── Scene1.mp4
|
||||
├── code.py
|
||||
├── custom_default.yml
|
||||
└── manim.py
|
||||
|
||||
- ``raster_images``
|
||||
The directory for storing raster images to be used in the code (including
|
||||
``.jpg``, ``.png`` and ``.gif``), which will be read by ``ImageMobject``.
|
||||
|
||||
- ``vector_images``
|
||||
The directory for storing vector images to be used in the code (including
|
||||
``.svg`` and ``.xdv``), which will be read by ``SVGMobject``.
|
||||
|
||||
- ``temporary_storage``
|
||||
The directory for storing temporarily generated cache files, including
|
||||
``Tex`` cache, ``Text`` cache and storage of object points.
|
||||
|
||||
``tex``
|
||||
-------
|
||||
|
||||
- ``executable``
|
||||
The executable program used to compile LaTeX (``latex`` or ``xelatex -no-pdf``
|
||||
is recommended)
|
||||
|
||||
- ``template_file``
|
||||
LaTeX template used, in ``manimlib/tex_templates``
|
||||
|
||||
- ``intermediate_filetype``
|
||||
The type of intermediate vector file generated after compilation (``dvi`` if
|
||||
``latex`` is used, ``xdv`` if ``xelatex`` is used)
|
||||
|
||||
- ``text_to_replace``
|
||||
The text to be replaced in the template (needn't to change)
|
||||
|
||||
``universal_import_line``
|
||||
-------------------------
|
||||
|
||||
Import line that need to execute when entering interactive mode directly.
|
||||
|
||||
``style``
|
||||
---------
|
||||
|
||||
- ``font``
|
||||
Default font of Text
|
||||
|
||||
- ``background_color``
|
||||
Default background color
|
||||
|
||||
``window_position``
|
||||
-------------------
|
||||
|
||||
The relative position of the playback window on the display (two characters,
|
||||
the first character means upper(U) / middle(O) / lower(D), the second character
|
||||
means left(L) / middle(O) / right(R)).
|
||||
|
||||
``camera_qualities``
|
||||
--------------------
|
||||
|
||||
Export quality
|
||||
|
||||
- ``low``
|
||||
Low quality (default is 480p15)
|
||||
|
||||
- ``medium``
|
||||
Medium quality (default is 720p30)
|
||||
|
||||
- ``high``
|
||||
High quality (default is 1080p30)
|
||||
|
||||
- ``ultra_high``
|
||||
Ultra high quality (default is 4K60)
|
||||
|
||||
- ``default_quality``
|
||||
Default quality (one of the above four)
|
Reference in New Issue
Block a user