mirror of
https://github.com/3b1b/manim.git
synced 2025-11-14 17:58:02 +00:00
some fixes of doc
This commit is contained in:
parent
876f06cc37
commit
f16277f100
5 changed files with 27 additions and 18 deletions
|
|
@ -56,7 +56,7 @@ custom_config
|
||||||
|
|
||||||
- ``raster_images``
|
- ``raster_images``
|
||||||
The directory for storing raster images to be used in the code (including
|
The directory for storing raster images to be used in the code (including
|
||||||
``.jpg``, ``.png`` and ``.gif``), which will be read by ``ImageMobject``.
|
``.jpg``, ``.jpeg``, ``.png`` and ``.gif``), which will be read by ``ImageMobject``.
|
||||||
|
|
||||||
- ``vector_images``
|
- ``vector_images``
|
||||||
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
|
||||||
|
|
|
||||||
|
|
@ -85,5 +85,5 @@ following the directory structure:
|
||||||
└── custom_config.yml
|
└── custom_config.yml
|
||||||
|
|
||||||
When you enter the ``project/`` folder and run ``manimgl code.py <Scene>``,
|
When you enter the ``project/`` folder and run ``manimgl code.py <Scene>``,
|
||||||
it will overwrite ``manim/custom_config.yml`` with ``custom_config.yml``
|
it will overwrite ``manim/default_config.yml`` with ``custom_config.yml``
|
||||||
in the ``project`` folder.
|
in the ``project`` folder.
|
||||||
|
|
@ -128,6 +128,8 @@ TextExample
|
||||||
|
|
||||||
class TextExample(Scene):
|
class TextExample(Scene):
|
||||||
def construct(self):
|
def construct(self):
|
||||||
|
# To run this scene properly, you should have "Consolas" font in your computer
|
||||||
|
# for full usage, you can see https://github.com/3b1b/manim/pull/680
|
||||||
text = Text("Here is a text", font="Consolas", font_size=90)
|
text = Text("Here is a text", font="Consolas", font_size=90)
|
||||||
difference = Text(
|
difference = Text(
|
||||||
"""
|
"""
|
||||||
|
|
@ -135,6 +137,7 @@ TextExample
|
||||||
you can change the font more easily, but can't use the LaTeX grammar
|
you can change the font more easily, but can't use the LaTeX grammar
|
||||||
""",
|
""",
|
||||||
font="Arial", font_size=24,
|
font="Arial", font_size=24,
|
||||||
|
# t2c is a dict that you can choose color for different text
|
||||||
t2c={"Text": BLUE, "TexText": BLUE, "LaTeX": ORANGE}
|
t2c={"Text": BLUE, "TexText": BLUE, "LaTeX": ORANGE}
|
||||||
)
|
)
|
||||||
VGroup(text, difference).arrange(DOWN, buff=1)
|
VGroup(text, difference).arrange(DOWN, buff=1)
|
||||||
|
|
@ -148,6 +151,7 @@ TextExample
|
||||||
t2f={"font": "Consolas", "words": "Consolas"},
|
t2f={"font": "Consolas", "words": "Consolas"},
|
||||||
t2c={"font": BLUE, "words": GREEN}
|
t2c={"font": BLUE, "words": GREEN}
|
||||||
)
|
)
|
||||||
|
fonts.set_width(FRAME_WIDTH - 1)
|
||||||
slant = Text(
|
slant = Text(
|
||||||
"And the same as slant and weight",
|
"And the same as slant and weight",
|
||||||
font="Consolas",
|
font="Consolas",
|
||||||
|
|
@ -180,20 +184,24 @@ TexTransformExample
|
||||||
def construct(self):
|
def construct(self):
|
||||||
to_isolate = ["B", "C", "=", "(", ")"]
|
to_isolate = ["B", "C", "=", "(", ")"]
|
||||||
lines = VGroup(
|
lines = VGroup(
|
||||||
# Surrounding substrings with double braces
|
# Passing in muliple arguments to Tex will result
|
||||||
# will ensure that those parts are separated
|
# in the same expression as if those arguments had
|
||||||
# out in the Tex. For example, here the
|
# been joined together, except that the submobject
|
||||||
# Tex will have 5 submobjects, corresponding
|
# heirarchy of the resulting mobject ensure that the
|
||||||
# to the strings [A^2, +, B^2, =, C^2]
|
# Tex mobject has a subject corresponding to
|
||||||
Tex("{{A^2}} + {{B^2}} = {{C^2}}"),
|
# each of these strings. For example, the Tex mobject
|
||||||
Tex("{{A^2}} = {{C^2}} - {{B^2}}"),
|
# below will have 5 subjects, corresponding to the
|
||||||
|
# expressions [A^2, +, B^2, =, C^2]
|
||||||
|
Tex("A^2", "+", "B^2", "=", "C^2"),
|
||||||
|
# Likewise here
|
||||||
|
Tex("A^2", "=", "C^2", "-", "B^2"),
|
||||||
# Alternatively, you can pass in the keyword argument
|
# Alternatively, you can pass in the keyword argument
|
||||||
# "isolate" with a list of strings that should be out as
|
# "isolate" with a list of strings that should be out as
|
||||||
# their own submobject. So both lines below are equivalent
|
# their own submobject. So the line below is equivalent
|
||||||
# to what you'd get by wrapping every instance of "B", "C"
|
# to the commented out line below it.
|
||||||
# "=", "(" and ")" with double braces
|
Tex("A^2 = (C + B)(C - B)", isolate=["A^2", *to_isolate]),
|
||||||
Tex("{{A^2}} = (C + B)(C - B)", isolate=to_isolate),
|
# Tex("A^2", "=", "(", "C", "+", "B", ")", "(", "C", "-", "B", ")"),
|
||||||
Tex("A = \\sqrt{(C + B)(C - B)}", isolate=to_isolate)
|
Tex("A = \\sqrt{(C + B)(C - B)}", isolate=["A", *to_isolate])
|
||||||
)
|
)
|
||||||
lines.arrange(DOWN, buff=LARGE_BUFF)
|
lines.arrange(DOWN, buff=LARGE_BUFF)
|
||||||
for line in lines:
|
for line in lines:
|
||||||
|
|
@ -252,7 +260,7 @@ TexTransformExample
|
||||||
# new_line2 and the "\sqrt" from the final line. By passing in,
|
# new_line2 and the "\sqrt" from the final line. By passing in,
|
||||||
# transform_mismatches=True, it will transform this "^2" part into
|
# transform_mismatches=True, it will transform this "^2" part into
|
||||||
# the "\sqrt" part.
|
# the "\sqrt" part.
|
||||||
new_line2 = Tex("{{A}}^2 = (C + B)(C - B)", isolate=to_isolate)
|
new_line2 = Tex("A^2 = (C + B)(C - B)", isolate=["A", *to_isolate])
|
||||||
new_line2.replace(lines[2])
|
new_line2.replace(lines[2])
|
||||||
new_line2.match_style(lines[2])
|
new_line2.match_style(lines[2])
|
||||||
|
|
||||||
|
|
@ -343,7 +351,7 @@ UpdatersExample
|
||||||
)
|
)
|
||||||
self.wait()
|
self.wait()
|
||||||
self.play(
|
self.play(
|
||||||
square.set_width(5, stretch=True),
|
square.animate.set_width(5, stretch=True),
|
||||||
run_time=3,
|
run_time=3,
|
||||||
)
|
)
|
||||||
self.wait()
|
self.wait()
|
||||||
|
|
@ -387,7 +395,7 @@ CoordinateSystemExample
|
||||||
axes = Axes(
|
axes = Axes(
|
||||||
# x-axis ranges from -1 to 10, with a default step size of 1
|
# x-axis ranges from -1 to 10, with a default step size of 1
|
||||||
x_range=(-1, 10),
|
x_range=(-1, 10),
|
||||||
# y-axis ranges from -2 to 10 with a step size of 0.5
|
# y-axis ranges from -2 to 2 with a step size of 0.5
|
||||||
y_range=(-2, 2, 0.5),
|
y_range=(-2, 2, 0.5),
|
||||||
# The axes will be stretched so as to match the specified
|
# The axes will be stretched so as to match the specified
|
||||||
# height and width
|
# height and width
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,7 @@ Below is the directory structure of manim:
|
||||||
├── config_ops.py # Process CONFIG
|
├── config_ops.py # Process CONFIG
|
||||||
├── customization.py # Read from custom_config.yml
|
├── customization.py # Read from custom_config.yml
|
||||||
├── debug.py # Utilities for debugging in program
|
├── debug.py # Utilities for debugging in program
|
||||||
|
├── directories.py # Read directories from config file
|
||||||
├── family_ops.py # Process family members
|
├── family_ops.py # Process family members
|
||||||
├── file_ops.py # Process files and directories
|
├── file_ops.py # Process files and directories
|
||||||
├── images.py # Read image
|
├── images.py # Read image
|
||||||
|
|
|
||||||
|
|
@ -342,7 +342,7 @@ class CoordinateSystemExample(Scene):
|
||||||
axes = Axes(
|
axes = Axes(
|
||||||
# x-axis ranges from -1 to 10, with a default step size of 1
|
# x-axis ranges from -1 to 10, with a default step size of 1
|
||||||
x_range=(-1, 10),
|
x_range=(-1, 10),
|
||||||
# y-axis ranges from -2 to 10 with a step size of 0.5
|
# y-axis ranges from -2 to 2 with a step size of 0.5
|
||||||
y_range=(-2, 2, 0.5),
|
y_range=(-2, 2, 0.5),
|
||||||
# The axes will be stretched so as to match the specified
|
# The axes will be stretched so as to match the specified
|
||||||
# height and width
|
# height and width
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue