Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Remove Carriage Return (#1281)

Aron053e40060d5a
diff --git a/docs/source/changelog/0.5.0-changelog.rst b/docs/source/changelog/0.5.0-changelog.rst
index 1feaeeebb..e413d2633 100644
--- a/docs/source/changelog/0.5.0-changelog.rst
+++ b/docs/source/changelog/0.5.0-changelog.rst
@@ -76,7 +76,7 @@ Deprecated classes and functions
--------------------------------
* `#1124 <https://github.com/ManimCommunity/manim/pull/1124>`__: Deprecated :class:`ShowCreation` in favor of :class:`Create`
- 1. Deprecated :class:`ShowCreation` in favor of :class:`Create` across the library with the exception of the `show_creation` boolean variable `vector_space_scene.py`
+ 1. Deprecated :class:`ShowCreation` in favor of :class:`Create` across the library with the exception of the `show_creation` boolean variable `vector_space_scene.py`
2. Added a deprecation warning in the original :class:`ShowCreation` class.
* `#1110 <https://github.com/ManimCommunity/manim/pull/1110>`__: Deprecated SmallDot + OpenGLSmallDot
@@ -86,8 +86,8 @@ New features
------------
* `#1037 <https://github.com/ManimCommunity/manim/pull/1037>`__: Added new fade and transform animations (:class:`~.TransformMatchingShapes`, :class:`~.TransformMatchingTex`, :class:`~.FadeTransform`) from 3b1b/manim
- Added new Fade animation: :class:`~FadeOutToPoint`
- Added :class:`~FadeTransform` and :class:`~FadeTransformPieces` for transforming mobjects and submobjects with a fade
+ Added new Fade animation: :class:`~FadeOutToPoint`
+ Added :class:`~FadeTransform` and :class:`~FadeTransformPieces` for transforming mobjects and submobjects with a fade
Added :class:`~TransformMatchingShapes` and :class:`~TransformMatchingTex` for transforming mobjects and tex that have matching parts
* `#1097 <https://github.com/ManimCommunity/manim/pull/1097>`__: Added 3D Mobject :class:`~.Dot3D`
@@ -109,8 +109,8 @@ Enhancements
* `#1157 <https://github.com/ManimCommunity/manim/pull/1157>`__: Refresh triangulation on call to :meth:`~.OpenGLVMobject.apply_points_function`
- Rotate called apply_points_function, which was previous not subclassed by OpenGLMobject - now it is. Then, the vertex normals can be updated too.
-
+ Rotate called apply_points_function, which was previous not subclassed by OpenGLMobject - now it is. Then, the vertex normals can be updated too.
+
Additionally, the old_points matrix would change after rotating, making the old points / new points test irrelevant. This is addressed with a .copy call.
* `#1151 <https://github.com/ManimCommunity/manim/pull/1151>`__: Added parametric function support to :class:`OpenGLSurface`
@@ -123,12 +123,12 @@ Enhancements
OpenGL play logic has been improved to support caching and skipping with `-n` argument ( it is now similar to Cairo play logic). A random bug was fixed in OpenGLSurface and OpenGL background color can now be changed via `background_color` argument.
* `#1118 <https://github.com/ManimCommunity/manim/pull/1118>`__: Allow passing animation arguments with .animate syntax
- Users will now be able to do things like `obj.animate(run_time=2).method(arg)` if they want to specify animation arguments for an individual `.animate` call, and can still not specify any arguments like `obj.animate.method(arg)`.
-
+ Users will now be able to do things like `obj.animate(run_time=2).method(arg)` if they want to specify animation arguments for an individual `.animate` call, and can still not specify any arguments like `obj.animate.method(arg)`.
+
Passing animation arguments is only allowed directly after `.animate` is accessed, if passed elsewhere then a `ValueError` is raised.
* `#718 <https://github.com/ManimCommunity/manim/pull/718>`__: Rotating the numbers in y axis
- In Axes, the y axis will be rotated 90deg but the numbers are
+ In Axes, the y axis will be rotated 90deg but the numbers are
also rotated and shouldn't be. Fixes this issue.
* `#1070 <https://github.com/ManimCommunity/manim/pull/1070>`__: Raise FileNotFoundError when unable to locate the .cfg file specified via ``--config_file``
@@ -165,9 +165,9 @@ Fixed bugs
Fixed undefined variables and converted :class:`Mobject` to :class:`OpenGLMobject`. Also, fixed assert statement in :class:`ApplyMethod`.
* `#1092 <https://github.com/ManimCommunity/manim/pull/1092>`__: Refactored coordinate_systems.py, fixed bugs, added :class:`~.NumberPlane` test
- The default behavior of :meth:`~.Mobject.rotate` is to rotate about the center of :class:`~.Mobject`. :class:`~.NumberLine` is symmetric about the point at the number 0 only when ``|x_min|`` == ``|x_max|``. Ideally, the rotation should coincide with
- the point at number 0 on the line.
-
+ The default behavior of :meth:`~.Mobject.rotate` is to rotate about the center of :class:`~.Mobject`. :class:`~.NumberLine` is symmetric about the point at the number 0 only when ``|x_min|`` == ``|x_max|``. Ideally, the rotation should coincide with
+ the point at number 0 on the line.
+
Added a regression test and additionally fixed some bugs introduced in :pr:`718`.
* `#1078 <https://github.com/ManimCommunity/manim/pull/1078>`__: Removed stray print statements from `__main__.py`
@@ -276,8 +276,8 @@ Changes to our development infrastructure
* `#1071 <https://github.com/ManimCommunity/manim/pull/1071>`__: Enable pytest-cov based code coverage
- - Include pytest-cov as a python module as part of developer dependencies
- - In updating poetry to include pytest-cov, manimpango moved from version 0.2.3 to 0.2.4, and libpango1.0-dev needed to be installed in Ubuntu.
+ - Include pytest-cov as a python module as part of developer dependencies
+ - In updating poetry to include pytest-cov, manimpango moved from version 0.2.3 to 0.2.4, and libpango1.0-dev needed to be installed in Ubuntu.
- Add to the CI workflow (`ci.yml`) to create and upload test coverage.
* `#1073 <https://github.com/ManimCommunity/manim/pull/1073>`__: Removed "one line summary" from PULL_REQUEST_TEMPLATE.md
@@ -296,12 +296,12 @@ Code quality improvements and similar refactors
* `#1019 <https://github.com/ManimCommunity/manim/pull/1019>`__: Refactored :meth:`~.Scene.play`
- - Removed the _**three**_ decorators of :meth:`~.Scene.play`, in particular: caching logic and file writer logic are now included within :meth:`~.Scene.play` (it wasn't possible before, because `scene.wait` and `scene.play` were two different things).
- - Added `is_static_wait` attributes to Wait. (<=> if wait is a frozen frame).
- - Renamed and moved `scene.add_static_frame` to `renderer.freeze_current_frame`.
- - Now when calling play without animation, it raises `ValueError` instead of just a warning.
- - Fixed :pr:`874` by modfying `renderer.update_skipping_status`
- - `renderer` starts the animation with `scene.begin_animations` (`scene.compile_animation_data` used to do this)
- - The run time and the time progression generation is now done in `scene.play_internal` although it'd make more sense that renderer processes it later.
+ - Removed the _**three**_ decorators of :meth:`~.Scene.play`, in particular: caching logic and file writer logic are now included within :meth:`~.Scene.play` (it wasn't possible before, because `scene.wait` and `scene.play` were two different things).
+ - Added `is_static_wait` attributes to Wait. (<=> if wait is a frozen frame).
+ - Renamed and moved `scene.add_static_frame` to `renderer.freeze_current_frame`.
+ - Now when calling play without animation, it raises `ValueError` instead of just a warning.
+ - Fixed :pr:`874` by modfying `renderer.update_skipping_status`
+ - `renderer` starts the animation with `scene.begin_animations` (`scene.compile_animation_data` used to do this)
+ - The run time and the time progression generation is now done in `scene.play_internal` although it'd make more sense that renderer processes it later.
- Added a bunch of cool tests thanks to mocks, and thanks to the new syntax `scene.render`
diff --git a/docs/source/contributing/reference/manim_directive.rst b/docs/source/contributing/reference/manim_directive.rst
index 2b0269375..1f40a739a 100644
--- a/docs/source/contributing/reference/manim_directive.rst
+++ b/docs/source/contributing/reference/manim_directive.rst
@@ -1,4 +1,4 @@
-manim\_directive
+manim\_directive
================
.. currentmodule:: manim_directive
diff --git a/manim/cli/render/ease_of_access_options.py b/manim/cli/render/ease_of_access_options.py
index 8e0fc252b..858b4e011 100644
--- a/manim/cli/render/ease_of_access_options.py
+++ b/manim/cli/render/ease_of_access_options.py
@@ -1,31 +1,31 @@
-import click
-from cloup import option, option_group
-
-ease_of_access_options = option_group(
- "Ease of access options",
- option(
- "--progress_bar",
- default="display",
- show_default=True,
- type=click.Choice(
- ["display", "leave", "none"],
- case_sensitive=False,
- ),
- help="Display progress bars and/or keep them displayed.",
- ),
- option(
- "-p",
- "--preview",
- is_flag=True,
- help="Preview the Scene's animation. OpenGL does a live preview in a "
- "popup window. Cairo opens the rendered video file in the system "
- "default media player.",
- ),
- option(
- "-f",
- "--show_in_file_browser",
- is_flag=True,
- help="Show the output file in the file browser.",
- ),
- option("--jupyter", is_flag=True, help="Using jupyter notebook magic."),
-)
+import click
+from cloup import option, option_group
+
+ease_of_access_options = option_group(
+ "Ease of access options",
+ option(
+ "--progress_bar",
+ default="display",
+ show_default=True,
+ type=click.Choice(
+ ["display", "leave", "none"],
+ case_sensitive=False,
+ ),
+ help="Display progress bars and/or keep them displayed.",
+ ),
+ option(
+ "-p",
+ "--preview",
+ is_flag=True,
+ help="Preview the Scene's animation. OpenGL does a live preview in a "
+ "popup window. Cairo opens the rendered video file in the system "
+ "default media player.",
+ ),
+ option(
+ "-f",
+ "--show_in_file_browser",
+ is_flag=True,
+ help="Show the output file in the file browser.",
+ ),
+ option("--jupyter", is_flag=True, help="Using jupyter notebook magic."),
+)
diff --git a/manim/cli/render/global_options.py b/manim/cli/render/global_options.py
index e23f90961..7c3b6d402 100644
--- a/manim/cli/render/global_options.py
+++ b/manim/cli/render/global_options.py
@@ -1,33 +1,33 @@
-import click
-from cloup import option, option_group
-
-global_options = option_group(
- "Global options",
- option(
- "-c",
- "--config_file",
- help="Specify the configuration file to use for render settings.",
- ),
- option(
- "--custom_folders",
- is_flag=True,
- help="Use the folders defined in the [custom_folders] section of the "
- "config file to define the output folder structure.",
- ),
- option(
- "--disable_caching",
- is_flag=True,
- help="Disable the use of the cache (still generates cache files).",
- ),
- option("--flush_cache", is_flag=True, help="Remove cached partial movie files."),
- option("--tex_template", help="Specify a custom TeX template file."),
- option(
- "-v",
- "--verbosity",
- type=click.Choice(
- ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
- case_sensitive=False,
- ),
- help="Verbosity of CLI output. Changes ffmpeg log level unless 5+.",
- ),
-)
+import click
+from cloup import option, option_group
+
+global_options = option_group(
+ "Global options",
+ option(
+ "-c",
+ "--config_file",
+ help="Specify the configuration file to use for render settings.",
+ ),
+ option(
+ "--custom_folders",
+ is_flag=True,
+ help="Use the folders defined in the [custom_folders] section of the "
+ "config file to define the output folder structure.",
+ ),
+ option(
+ "--disable_caching",
+ is_flag=True,
+ help="Disable the use of the cache (still generates cache files).",
+ ),
+ option("--flush_cache", is_flag=True, help="Remove cached partial movie files."),
+ option("--tex_template", help="Specify a custom TeX template file."),
+ option(
+ "-v",
+ "--verbosity",
+ type=click.Choice(
+ ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
+ case_sensitive=False,
+ ),
+ help="Verbosity of CLI output. Changes ffmpeg log level unless 5+.",
+ ),
+)
diff --git a/manim/cli/render/output_options.py b/manim/cli/render/output_options.py
index 551ac36e1..3f9f1251a 100644
--- a/manim/cli/render/output_options.py
+++ b/manim/cli/render/output_options.py
@@ -1,29 +1,29 @@
-import click
-from cloup import option, option_group
-
-output_options = option_group(
- "Output options",
- option(
- "-o",
- "--output_file",
- multiple=True,
- help="Specify the filename(s) of the rendered scene(s).",
- ),
- option(
- "--write_to_movie",
- is_flag=True,
- default=None,
- help="Write to a file.",
- ),
- option(
- "--media_dir",
- type=click.Path(),
- help="Path to store rendered videos and latex.",
- ),
- option("--log_dir", type=click.Path(), help="Path to store render logs."),
- option(
- "--log_to_file",
- is_flag=True,
- help="Log terminal output to file.",
- ),
-)
+import click
+from cloup import option, option_group
+
+output_options = option_group(
+ "Output options",
+ option(
+ "-o",
+ "--output_file",
+ multiple=True,
+ help="Specify the filename(s) of the rendered scene(s).",
+ ),
+ option(
+ "--write_to_movie",
+ is_flag=True,
+ default=None,
+ help="Write to a file.",
+ ),
+ option(
+ "--media_dir",
+ type=click.Path(),
+ help="Path to store rendered videos and latex.",
+ ),
+ option("--log_dir", type=click.Path(), help="Path to store render logs."),
+ option(
+ "--log_to_file",
+ is_flag=True,
+ help="Log terminal output to file.",
+ ),
+)
diff --git a/manim/cli/render/render_options.py b/manim/cli/render/render_options.py
index b4d36f16b..b560178e5 100644
--- a/manim/cli/render/render_options.py
+++ b/manim/cli/render/render_options.py
@@ -1,112 +1,112 @@
-import re
-
-import click
-from cloup import option, option_group
-
-from ... import logger
-
-
-def validate_scene_range(ctx, param, value):
- try:
- start = int(value)
- return (start,)
- except Exception:
- pass
-
- if value:
- try:
- start, end = map(int, re.split(";|,|-", value))
- return start, end
- except Exception:
- logger.error("Couldn't determine a range for -n option.")
- exit()
-
-
-def validate_resolution(ctx, param, value):
- if value:
- try:
- start, end = map(int, re.split(";|,|-", value))
- return (
- start,
- end,
- )
- except Exception:
- logger.error("Resolution option is invalid.")
- exit()
-
-
-render_options = option_group(
- "Render Options",
- option(
- "-n",
- "--from_animation_number",
- callback=validate_scene_range,
- help="Start rendering from n_0 until n_1. If n_1 is left unspecified, "
- "renders all scenes after n_0.",
- ),
- option(
- "-a",
- "--write_all",
- is_flag=True,
- help="Render all scenes in the input file.",
- ),
- option(
- "-f",
- "--format",
- "file_format",
- default="mp4",
- type=click.Choice(["png", "gif", "mp4"], case_sensitive=False),
- ),
- option("-s", "--save_last_frame", is_flag=True),
- option(
- "-q",
- "--quality",
- default="h",
- type=click.Choice(["l", "m", "h", "p", "k"], case_sensitive=False),
- help="""
- Render quality at the follow resolution framerates, respectively:
- 854x480 30FPS,
- 1280x720 30FPS,
- 1920x1080 60FPS,
- 2560x1440 60FPS,
- 3840x2160 60FPS
- """,
- ),
- option(
- "-r",
- "--resolution",
- callback=validate_resolution,
- help="Resolution in (W,H) for when 16:9 aspect ratio isn't possible.",
- ),
- option(
- "--fps",
- "--frame_rate",
- "frame_rate",
- type=float,
- help="Render at this frame rate.",
- ),
- option(
- "--renderer",
- type=click.Choice(["cairo", "opengl", "webgl"], case_sensitive=False),
- help="Select a renderer for your Scene.",
- ),
- option(
- "--use_opengl_renderer",
- is_flag=True,
- help="Render scenes using OpenGL (Deprecated).",
- ),
- option(
- "--use_webgl_renderer",
- is_flag=True,
- help="Render scenes using the WebGL frontend (Deprecated).",
- ),
- option(
- "--webgl_renderer_path",
- default=None,
- type=click.Path(),
- help="The path to the WebGL frontend.",
- ),
- option(
- "-t", "--transparent", is_flag=True, help="Render scenes with alpha channel."
- ),
-)
+import re
+
+import click
+from cloup import option, option_group
+
+from ... import logger
+
+
+def validate_scene_range(ctx, param, value):
+ try:
+ start = int(value)
+ return (start,)
+ except Exception:
+ pass
+
+ if value:
+ try:
+ start, end = map(int, re.split(";|,|-", value))
+ return start, end
+ except Exception:
+ logger.error("Couldn't determine a range for -n option.")
+ exit()
+
+
+def validate_resolution(ctx, param, value):
+ if value:
+ try:
+ start, end = map(int, re.split(";|,|-", value))
+ return (
+ start,
+ end,
+ )
+ except Exception:
+ logger.error("Resolution option is invalid.")
+ exit()
+
+
+render_options = option_group(
+ "Render Options",
+ option(
+ "-n",
+ "--from_animation_number",
+ callback=validate_scene_range,
+ help="Start rendering from n_0 until n_1. If n_1 is left unspecified, "
+ "renders all scenes after n_0.",
+ ),
+ option(
+ "-a",
+ "--write_all",
+ is_flag=True,
+ help="Render all scenes in the input file.",
+ ),
+ option(
+ "-f",
+ "--format",
+ "file_format",
+ default="mp4",
+ type=click.Choice(["png", "gif", "mp4"], case_sensitive=False),
+ ),
+ option("-s", "--save_last_frame", is_flag=True),
+ option(
+ "-q",
+ "--quality",
+ default="h",
+ type=click.Choice(["l", "m", "h", "p", "k"], case_sensitive=False),
+ help="""
+ Render quality at the follow resolution framerates, respectively:
+ 854x480 30FPS,
+ 1280x720 30FPS,
+ 1920x1080 60FPS,
+ 2560x1440 60FPS,
+ 3840x2160 60FPS
+ """,
+ ),
+ option(
+ "-r",
+ "--resolution",
+ callback=validate_resolution,
+ help="Resolution in (W,H) for when 16:9 aspect ratio isn't possible.",
+ ),
+ option(
+ "--fps",
+ "--frame_rate",
+ "frame_rate",
+ type=float,
+ help="Render at this frame rate.",
+ ),
+ option(
+ "--renderer",
+ type=click.Choice(["cairo", "opengl", "webgl"], case_sensitive=False),
+ help="Select a renderer for your Scene.",
+ ),
+ option(
+ "--use_opengl_renderer",
+ is_flag=True,
+ help="Render scenes using OpenGL (Deprecated).",
+ ),
+ option(
+ "--use_webgl_renderer",
+ is_flag=True,
+ help="Render scenes using the WebGL frontend (Deprecated).",
+ ),
+ option(
+ "--webgl_renderer_path",
+ default=None,
+ type=click.Path(),
+ help="The path to the WebGL frontend.",
+ ),
+ option(
+ "-t", "--transparent", is_flag=True, help="Render scenes with alpha channel."
+ ),
+)