Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Sahil Makhijani 2021-02-02 16:05:47 +05:30
commit 74365065fe
9 changed files with 101 additions and 33 deletions

View file

@ -1,4 +1,4 @@
sphinx>=1.8 Sphinx==3.0.3
sphinx-copybutton sphinx-copybutton
furo==2020.10.5b9 furo==2020.10.5b9
jinja2 Jinja2

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 184 KiB

View file

@ -106,61 +106,80 @@ Here are the preview of default colours. (Modified from
.. raw:: html .. raw:: html
<div style="float: left;">
<h3>BLUE</h3> <h3>BLUE</h3>
<div class="colors BLUE_E"><p class="color-text">BLUE_E</p></div> <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_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_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_B"><p class="color-text">BLUE_B</p></div>
<div class="colors BLUE_A"><p class="color-text">BLUE_A</p></div> <div class="colors BLUE_A"><p class="color-text">BLUE_A</p></div>
<h3 style="margin-top: 6em">TEAL</h3> </div>
<div style="float: left;">
<h3>TEAL</h3>
<div class="colors TEAL_E"><p class="color-text">TEAL_E</p></div> <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_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_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_B"><p class="color-text">TEAL_B</p></div>
<div class="colors TEAL_A"><p class="color-text">TEAL_A</p></div> <div class="colors TEAL_A"><p class="color-text">TEAL_A</p></div>
<h3 style="margin-top: 6em">GREEN</h3> </div>
<div style="float: left;">
<h3>GREEN</h3>
<div class="colors GREEN_E"><p class="color-text">GREEN_E</p></div> <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_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_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_B"><p class="color-text">GREEN_B</p></div>
<div class="colors GREEN_A"><p class="color-text">GREEN_A</p></div> <div class="colors GREEN_A"><p class="color-text">GREEN_A</p></div>
<h3 style="margin-top: 6em">YELLOW</h3> </div>
<div style="float: left;">
<h3>YELLOW</h3>
<div class="colors YELLOW_E"><p class="color-text">YELLOW_E</p></div> <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_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_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_B"><p class="color-text">YELLOW_B</p></div>
<div class="colors YELLOW_A"><p class="color-text">YELLOW_A</p></div> <div class="colors YELLOW_A"><p class="color-text">YELLOW_A</p></div>
<h3 style="margin-top: 6em">GOLD</h3> </div>
<div style="float: left;">
<h3>GOLD</h3>
<div class="colors GOLD_E"><p class="color-text">GOLD_E</p></div> <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_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_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_B"><p class="color-text">GOLD_B</p></div>
<div class="colors GOLD_A"><p class="color-text">GOLD_A</p></div> <div class="colors GOLD_A"><p class="color-text">GOLD_A</p></div>
<h3 style="margin-top: 6em">RED</h3> </div>
<div style="float: left;">
<h3>RED</h3>
<div class="colors RED_E"><p class="color-text">RED_E</p></div> <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_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_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_B"><p class="color-text">RED_B</p></div>
<div class="colors RED_A"><p class="color-text">RED_A</p></div> <div class="colors RED_A"><p class="color-text">RED_A</p></div>
<h3 style="margin-top: 6em">MAROON</h3> </div>
<div style="float: left;">
<h3>MAROON</h3>
<div class="colors MAROON_E"><p class="color-text">MAROON_E</p></div> <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_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_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_B"><p class="color-text">MAROON_B</p></div>
<div class="colors MAROON_A"><p class="color-text">MAROON_A</p></div> <div class="colors MAROON_A"><p class="color-text">MAROON_A</p></div>
<h3 style="margin-top: 6em">PURPLE</h3> </div>
<div style="float: left;">
<h3>PURPLE</h3>
<div class="colors PURPLE_E"><p class="color-text">PURPLE_E</p></div> <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_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_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_B"><p class="color-text">PURPLE_B</p></div>
<div class="colors PURPLE_A"><p class="color-text">PURPLE_A</p></div> <div class="colors PURPLE_A"><p class="color-text">PURPLE_A</p></div>
<h3 style="margin-top: 6em">GREY</h3> </div>
<div style="float: left;">
<h3>GREY</h3>
<div class="colors GREY_E"><p class="color-text">GREY_E</p></div> <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_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_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_B"><p class="color-text">GREY_B</p></div>
<div class="colors GREY_A"><p class="color-text">GREY_A</p></div> <div class="colors GREY_A"><p class="color-text">GREY_A</p></div>
<h3 style="margin-top: 6em">Others</h3> </div>
<div style="float: left;">
<h3>Others</h3>
<div class="colors WHITE"><p class="color-text" style="color: BLACK">WHITE</p></div> <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 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 GREY_BROWN"><p class="color-text-small">GREY_BROWN</p></div>
@ -170,3 +189,4 @@ Here are the preview of default colours. (Modified from
<div class="colors LIGHT_PINK"><p class="color-text-small">LIGHT_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 GREEN_SCREEN"><p class="color-text-small">GREEN_SCREEN</p></div>
<div class="colors ORANGE"><p class="color-text">ORANGE</p></div> <div class="colors ORANGE"><p class="color-text">ORANGE</p></div>
</div>

View file

@ -62,6 +62,10 @@ custom_default
The directory for storing vector images to be used in the code (including The directory for storing vector images to be used in the code (including
``.svg`` and ``.xdv``), which will be read by ``SVGMobject``. ``.svg`` and ``.xdv``), which will be read by ``SVGMobject``.
- ``sounds``
The directory for storing sound files to be used in ``Scene.add_sound()`` (
including ``.wav`` and ``.mp3``).
- ``temporary_storage`` - ``temporary_storage``
The directory for storing temporarily generated cache files, including The directory for storing temporarily generated cache files, including
``Tex`` cache, ``Text`` cache and storage of object points. ``Tex`` cache, ``Text`` cache and storage of object points.
@ -104,6 +108,16 @@ 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 the first character means upper(U) / middle(O) / lower(D), the second character
means left(L) / middle(O) / right(R)). means left(L) / middle(O) / right(R)).
``break_into_partial_movies``
-----------------------------
If this is set to ``True``, then many small files will be written corresponding
to each ``Scene.play`` and ``Scene.wait`` call, and these files will then be combined
to form the full scene.
Sometimes video-editing is made easier when working with the broken up scene, which
effectively has cuts at all the places you might want.
``camera_qualities`` ``camera_qualities``
-------------------- --------------------

View file

@ -21,7 +21,9 @@ Some useful flags
- ``-w`` to write the scene to a file. - ``-w`` to write the scene to a file.
- ``-o`` to write the scene to a file and open the result. - ``-o`` to write the scene to a file and open the result.
- ``-s`` to skip to the end and just show the final frame. - ``-s`` to skip to the end and just show the final frame.
- ``-so`` will save the final frame to an image and show it.
- ``-so`` will save the final frame to an image and show it.
- ``-n <number>`` to skip ahead to the ``n``\ th animation of a scene. - ``-n <number>`` to skip ahead to the ``n``\ th animation of a scene.
- ``-f`` to make the playback window fullscreen. - ``-f`` to make the playback window fullscreen.

View file

@ -28,28 +28,57 @@ SquareToCircle
This scene is what we wrote in :doc:`quickstart`. This scene is what we wrote in :doc:`quickstart`.
No more explanation here No more explanation here
WarpSquare AnimatingMethods
---------- ----------------
.. manim-example:: WarpSquare .. manim-example:: AnimatingMethods
:media: ../_static/example_scenes/WarpSquare.mp4 :media: ../_static/example_scenes/AnimatingMethods.mp4
class WarpSquare(Scene): class AnimatingMethods(Scene):
def construct(self): def construct(self):
square = Square() grid = Tex(r"\pi").get_grid(10, 10, height=4)
self.play(square.apply_complex_function, np.exp) self.add(grid)
self.wait()
The new usage in this scene is ``self.play(square.apply_complex_function, np.exp)``, # If you pass in a mobject method to the scene's "play" function,
which shows an animation of applying a complex function :math:`f(z)=e^z` to a square. # it will apply an animation interpolating between the mobject's
It is equivalent to transforming the original square into the result after # initial state and whatever happens when you apply that method.
applying a function. # For example, calling grid.shift(2 * LEFT) would shift it two units
# to the left, but the following line animates that motion.
self.play(grid.shift, 2 * LEFT)
# The same applies for any method, including those setting colors.
self.play(grid.set_submobject_colors_by_gradient, BLUE, GREEN)
self.play(grid.set_height, TAU - MED_SMALL_BUFF)
self.wait()
# The method Mobject.apply_complex_function lets you apply arbitrary
# complex functions, treating the points defining the mobject as
# complex numbers.
self.play(grid.apply_complex_function, np.exp, run_time=5)
self.wait()
# Even more generally, you could apply Mobject.apply_function,
# which takes in functions form R^3 to R^3
self.play(
grid.apply_function,
lambda p: [
p[0] + 0.5 * math.sin(p[1]),
p[1] + 0.5 * math.sin(p[0]),
p[2]
],
run_time=5,
)
self.wait()
The new usage in this scene is ``.get_grid()`` and ``self.play(mob.method, args)``.
- ``.get_grid()`` method will return a new mobject containing multiple copies of this one arranged in a grid.
- ``self.play(mob.method, args)`` animate the method, and the details are in the comments above.
TextExample TextExample
----------- -----------
.. manim-example:: TextExample .. manim-example:: TextExample
:media: ../_static/example_scenes/TextExample.mp4 :media: ../_static/example_scenes/TextExample.mp4
class TextExample(Scene): class TextExample(Scene):
def construct(self): def construct(self):
@ -99,7 +128,7 @@ TexTransformExample
------------------- -------------------
.. manim-example:: TexTransformExample .. manim-example:: TexTransformExample
:media: ../_static/example_scenes/TexTransformExample.mp4 :media: ../_static/example_scenes/TexTransformExample.mp4
class TexTransformExample(Scene): class TexTransformExample(Scene):
def construct(self): def construct(self):
@ -220,7 +249,7 @@ UpdatersExample
--------------- ---------------
.. manim-example:: UpdatersExample .. manim-example:: UpdatersExample
:media: ../_static/example_scenes/UpdatersExample.mp4 :media: ../_static/example_scenes/UpdatersExample.mp4
class UpdatersExample(Scene): class UpdatersExample(Scene):
def construct(self): def construct(self):
@ -289,10 +318,11 @@ UpdatersExample
) )
self.wait(4 * PI) self.wait(4 * PI)
The new classes and usage in this scene are ``DecimalNumber``, ``.to_edge()``, The new classes and usage in this scene are ``always_redraw()``, ``DecimalNumber``, ``.to_edge()``,
``.center()``, ``always_become()``, ``always()``, ``f_always()``, ``.set_y()`` and ``.add_updater()``. ``.center()``, ``always()``, ``f_always()``, ``.set_y()`` and ``.add_updater()``.
- ``DecimalNumber`` is a variable number, speed it up by breaking it into ``Tex`` characters. - ``always_redraw()`` function create a new mobject every frame.
- ``DecimalNumber`` is a variable number, speed it up by breaking it into ``Text`` characters.
- ``.to_edge()`` means to place the object on the edge of the screen. - ``.to_edge()`` means to place the object on the edge of the screen.
- ``.center()`` means to place the object in the center of the screen. - ``.center()`` means to place the object in the center of the screen.
- ``always(f, x)`` means that a certain function (``f(x)``) is executed every frame. - ``always(f, x)`` means that a certain function (``f(x)``) is executed every frame.
@ -304,7 +334,7 @@ SurfaceExample
-------------- --------------
.. manim-example:: SurfaceExample .. manim-example:: SurfaceExample
:media: ../_static/example_scenes/SurfaceExample.mp4 :media: ../_static/example_scenes/SurfaceExample.mp4
class SurfaceExample(Scene): class SurfaceExample(Scene):
CONFIG = { CONFIG = {
@ -405,7 +435,7 @@ OpeningManimExample
------------------- -------------------
.. manim-example:: OpeningManimExample .. manim-example:: OpeningManimExample
:media: ../_static/example_scenes/OpeningManimExample.mp4 :media: ../_static/example_scenes/OpeningManimExample.mp4
class OpeningManimExample(Scene): class OpeningManimExample(Scene):
def construct(self): def construct(self):

View file

@ -6,6 +6,8 @@ Manim's documentation
Manim is an animation engine for explanatory math videos. It's used to create precise animations programmatically, as seen in the videos 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/>`_. at `3Blue1Brown <https://www.3blue1brown.com/>`_.
And here is a Chinese version of this documentation: https://manim.ml/shaders
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
:caption: Getting Started :caption: Getting Started