From 896b011d7624336cfbd9e1c1f464bbb88dea68b8 Mon Sep 17 00:00:00 2001 From: TonyCrane Date: Tue, 14 Dec 2021 12:11:25 +0800 Subject: [PATCH 01/14] docs: update changelog for #1688 --- docs/source/development/changelog.rst | 22 +++++++++++++++++++ docs/source/getting_started/configuration.rst | 1 + 2 files changed, 23 insertions(+) diff --git a/docs/source/development/changelog.rst b/docs/source/development/changelog.rst index ca18c88c..86b7484e 100644 --- a/docs/source/development/changelog.rst +++ b/docs/source/development/changelog.rst @@ -9,6 +9,11 @@ Fixed bugs - `#1653 `__: Fixed ``Mobject.stretch_to_fit_depth`` - `#1655 `__: Fixed the bug of rotating camera +- `c73d507 `__: Fixed ``SurfaceMesh`` to be evenly spaced +- `82bd02d `__: Fixed ``angle_between_vectors`` add ``rotation_between_vectors`` +- `a717314 `__: Fixed ``VMobject.fade`` +- `fbc329d `__: Fixed ``angle_between_vectors`` +- `bcd0990 `__: Fixed bug in ``ShowSubmobjectsOneByOne`` New Features ^^^^^^^^^^^^ @@ -21,12 +26,29 @@ New Features - ``Difference(subject, clip, **kwargs)`` - ``Intersection(*vmobjects, **kwargs)`` - ``Exclusion(*vmobjects, **kwargs)`` +- `81c3ae3 `__: Added reflectiveness +- `2c7689e `__: Enabled ``glow_factor`` on ``DotCloud`` +- `d065e19 `__: Added option ``-e`` to insert embed line from the command line +- `0e78027 `__: Improved ``point_from_proportion`` to account for arc length +- `781a993 `__: Added shortcut ``set_backstroke`` for setting black background stroke +- `0b898a5 `__: Added ``Suface.always_sort_to_camera`` +- `e899604 `__: Added getter methods for specific euler angles +- `407c53f `__: Hade ``rotation_between_vectors`` handle identical/similar vectors +- `49743da `__: Added ``Mobject.insert_submobject`` method +- `9dd1f47 `__: Created single progress display for full scene render Refactor ^^^^^^^^ - `#1662 `__: Refactored support for command ``A`` in path of SVG - `#1662 `__: Refactored ``SingleStringTex.balance_braces`` +- `8b454fb `__: Slight tweaks to how saturation_factor works on newton-fractal +- `317a5d6 `__: Made it possible to set full screen preview as a default +- `e764da3 `__: Used ``quick_point_from_proportion`` for graph points +- `d2182b9 `__: Made sure ``Line.set_length`` returns self +- `eea3c6b `__: Better align ``SurfaceMesh`` to the corresponding surface polygons +- `ee1594a `__: Match ``fix_in_frame`` status for ``FlashAround`` mobject +- `ba23fbe `__: Made sure ``Mobject.is_fixed_in_frame`` stays updated with uniforms Dependencies diff --git a/docs/source/getting_started/configuration.rst b/docs/source/getting_started/configuration.rst index 88a9e603..d62fcba3 100644 --- a/docs/source/getting_started/configuration.rst +++ b/docs/source/getting_started/configuration.rst @@ -53,6 +53,7 @@ flag abbr function ``--config`` Guide for automatic configuration ``--file_name FILE_NAME`` Name for the movie or image file ``--start_at_animation_number START_AT_ANIMATION_NUMBER`` ``-n`` Start rendering not from the first animation, but from another, specified by its index. If you passing two comma separated values, e.g. "3,6", it will end the rendering at the second value. +``--embed LINENO`` ``-e`` Takes a line number as an argument, and results in the scene being called as if the line ``self.embed()`` was inserted into the scene code at that line number ``--resolution RESOLUTION`` ``-r`` Resolution, passed as "WxH", e.g. "1920x1080" ``--frame_rate FRAME_RATE`` Frame rate, as an integer ``--color COLOR`` ``-c`` Background color From 0af46e149d111b45abd0fbfb14cb77ff2c80d37f Mon Sep 17 00:00:00 2001 From: TonyCrane Date: Tue, 14 Dec 2021 12:14:04 +0800 Subject: [PATCH 02/14] add metavar `LINENO` for --embed option --- manimlib/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manimlib/config.py b/manimlib/config.py index fef3d409..ed5da5a9 100644 --- a/manimlib/config.py +++ b/manimlib/config.py @@ -117,7 +117,7 @@ def parse_cli(): "the rendering at the second value", ) parser.add_argument( - "-e", "--embed", + "-e", "--embed", metavar="LINENO", help="Takes a line number as an argument, and results" "in the scene being called as if the line `self.embed()`" "was inserted into the scene code at that line number." From 4d6a0db1e1e44972ca06eb3a3ae93ff11cde6017 Mon Sep 17 00:00:00 2001 From: TonyCrane Date: Tue, 14 Dec 2021 13:31:44 +0800 Subject: [PATCH 03/14] docs: update changelog for #1691 and #1678 --- docs/source/development/changelog.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/source/development/changelog.rst b/docs/source/development/changelog.rst index 86b7484e..167a5a0b 100644 --- a/docs/source/development/changelog.rst +++ b/docs/source/development/changelog.rst @@ -14,6 +14,7 @@ Fixed bugs - `a717314 `__: Fixed ``VMobject.fade`` - `fbc329d `__: Fixed ``angle_between_vectors`` - `bcd0990 `__: Fixed bug in ``ShowSubmobjectsOneByOne`` +- `7023548 `__: Fixed bug in ``TransformMatchingParts`` New Features ^^^^^^^^^^^^ @@ -36,6 +37,10 @@ New Features - `407c53f `__: Hade ``rotation_between_vectors`` handle identical/similar vectors - `49743da `__: Added ``Mobject.insert_submobject`` method - `9dd1f47 `__: Created single progress display for full scene render +- `264f7b1 `__: Added ``Circle.get_radius`` +- `83841ae `__: Added ``Dodecahedron`` +- `a1d5147 `__: Added ``GlowDot`` +- `#1678 `__: Added ``MTex`` , see `#1678 `__ for details Refactor ^^^^^^^^ @@ -49,6 +54,10 @@ Refactor - `eea3c6b `__: Better align ``SurfaceMesh`` to the corresponding surface polygons - `ee1594a `__: Match ``fix_in_frame`` status for ``FlashAround`` mobject - `ba23fbe `__: Made sure ``Mobject.is_fixed_in_frame`` stays updated with uniforms +- `98b0d26 `__: Made sure ``skip_animations`` and ``start_at_animation_number`` play well together +- `f8e6e7d `__: Updated progress display for full scene render +- `8f1dfab `__: ``VectorizedPoint`` should call ``__init__`` for both super classes +- `758f329 `__: Used array copy when checking need for refreshing triangulation Dependencies From e3d5b49a55303a27be21893c298bb8e1a1e5eeab Mon Sep 17 00:00:00 2001 From: TonyCrane Date: Tue, 14 Dec 2021 13:35:50 +0800 Subject: [PATCH 04/14] docs: remove deprecated config usage example --- docs/source/getting_started/config.rst | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/docs/source/getting_started/config.rst b/docs/source/getting_started/config.rst index cdb9f734..80a0dc10 100644 --- a/docs/source/getting_started/config.rst +++ b/docs/source/getting_started/config.rst @@ -83,22 +83,3 @@ Its value is a dictionary, passed in as ``kwargs`` when initializing the ``Camer to modify the value of the properties of the ``Camera`` class. So the nesting of the ``CONFIG`` dictionary **essentially** passes in the value as ``kwargs``. - -Common usage ------------- - -When writing a class by yourself, you can add attributes or modify the attributes -of the parent class through ``CONFIG``. - -The most commonly used is to modify the properties of the camera when writing a ``Scene``: - -.. code-block:: python - - class YourScene(Scene): - CONFIG = { - "camera_config": { - "background_color": WHITE, - }, - } - -For example, the above dictionary will change the background color to white, etc. \ No newline at end of file From b61f1473a52316a6adbcad2e40436b3d8c1d9a24 Mon Sep 17 00:00:00 2001 From: TonyCrane Date: Tue, 14 Dec 2021 13:41:44 +0800 Subject: [PATCH 05/14] release: ready to release v1.3.0 --- docs/source/development/changelog.rst | 4 ++-- setup.cfg | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/development/changelog.rst b/docs/source/development/changelog.rst index 167a5a0b..8844ac9d 100644 --- a/docs/source/development/changelog.rst +++ b/docs/source/development/changelog.rst @@ -1,8 +1,8 @@ Changelog ========= -Unreleased ----------- +v1.3.0 +------ Fixed bugs ^^^^^^^^^^ diff --git a/setup.cfg b/setup.cfg index 9b073cc1..566c638a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = manimgl -version = 1.2.0 +version = 1.3.0 author = Grant Sanderson author_email= grant@3blue1brown.com description = Animation engine for explanatory math videos From bbf45f95c673aa1898256f6d5b9aeb8a6a21c3cb Mon Sep 17 00:00:00 2001 From: DangGiaChi Date: Thu, 16 Dec 2021 22:03:29 +0700 Subject: [PATCH 06/14] Add option to add ticks on x-axis in BarChart() --- manimlib/mobject/probability.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/manimlib/mobject/probability.py b/manimlib/mobject/probability.py index 69a71069..fb7a76b7 100644 --- a/manimlib/mobject/probability.py +++ b/manimlib/mobject/probability.py @@ -8,6 +8,7 @@ from manimlib.mobject.svg.tex_mobject import TexText from manimlib.mobject.types.vectorized_mobject import VGroup from manimlib.utils.color import color_gradient from manimlib.utils.iterables import listify +from numpy import ndarray EPSILON = 0.0001 @@ -149,7 +150,9 @@ class BarChart(VGroup): "height": 4, "width": 6, "n_ticks": 4, + "include_x_ticks": False, "tick_width": 0.2, + "tick_width_x": 0.15, "label_y_axis": True, "y_axis_label_height": 0.25, "max_value": 1, @@ -165,6 +168,7 @@ class BarChart(VGroup): if self.max_value is None: self.max_value = max(values) + self.n_ticks_x = len(values) self.add_axes() self.add_bars(values) self.center() @@ -182,6 +186,17 @@ class BarChart(VGroup): ticks.add(tick) y_axis.add(ticks) + if self.include_x_ticks == True: + ticks1 = VGroup() + widths = np.linspace(0, self.width, self.n_ticks_x + 1) + label_values = np.linspace(0, len(self.bar_names), self.n_ticks_x + 1) + for x, value in zip(widths, label_values): + tick1 = Line(UP*0.05, DOWN*0.05) + tick1.set_width(self.tick_width_x) + tick1.move_to(x * RIGHT) + ticks.add(tick1) + x_axis.add(ticks1) + self.add(x_axis, y_axis) self.x_axis, self.y_axis = x_axis, y_axis @@ -196,7 +211,7 @@ class BarChart(VGroup): self.add(labels) def add_bars(self, values): - buff = float(self.width) / (2 * len(values) + 1) + buff = float(self.width) / (2 * len(values)) bars = VGroup() for i, value in enumerate(values): bar = Rectangle( @@ -205,7 +220,7 @@ class BarChart(VGroup): stroke_width=self.bar_stroke_width, fill_opacity=self.bar_fill_opacity, ) - bar.move_to((2 * i + 1) * buff * RIGHT, DOWN + LEFT) + bar.move_to((2 * i + 0.5) * buff * RIGHT, DOWN + LEFT * 5) bars.add(bar) bars.set_color_by_gradient(*self.bar_colors) From b489490f41840ca2e7f02cd23f1b532d221c5959 Mon Sep 17 00:00:00 2001 From: DangGiaChi Date: Fri, 17 Dec 2021 07:14:37 +0700 Subject: [PATCH 07/14] Fixed things as suggestions --- manimlib/mobject/probability.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/manimlib/mobject/probability.py b/manimlib/mobject/probability.py index fb7a76b7..a7512007 100644 --- a/manimlib/mobject/probability.py +++ b/manimlib/mobject/probability.py @@ -8,7 +8,6 @@ from manimlib.mobject.svg.tex_mobject import TexText from manimlib.mobject.types.vectorized_mobject import VGroup from manimlib.utils.color import color_gradient from manimlib.utils.iterables import listify -from numpy import ndarray EPSILON = 0.0001 @@ -152,7 +151,7 @@ class BarChart(VGroup): "n_ticks": 4, "include_x_ticks": False, "tick_width": 0.2, - "tick_width_x": 0.15, + "tick_height": 0.15, "label_y_axis": True, "y_axis_label_height": 0.25, "max_value": 1, @@ -187,15 +186,14 @@ class BarChart(VGroup): y_axis.add(ticks) if self.include_x_ticks == True: - ticks1 = VGroup() widths = np.linspace(0, self.width, self.n_ticks_x + 1) label_values = np.linspace(0, len(self.bar_names), self.n_ticks_x + 1) for x, value in zip(widths, label_values): - tick1 = Line(UP*0.05, DOWN*0.05) - tick1.set_width(self.tick_width_x) + tick1 = Line(UP, DOWN) + tick1.set_height(self.tick_height) tick1.move_to(x * RIGHT) - ticks.add(tick1) - x_axis.add(ticks1) + ticks.add(tick) + x_axis.add(ticks) self.add(x_axis, y_axis) self.x_axis, self.y_axis = x_axis, y_axis From 84fd657d9b2519162a9c54e78dade9324b338fa6 Mon Sep 17 00:00:00 2001 From: DangGiaChi Date: Fri, 17 Dec 2021 15:02:10 +0700 Subject: [PATCH 08/14] Change variables names: x_tick, x_ticks, y_tick, y_ticks --- manimlib/mobject/probability.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/manimlib/mobject/probability.py b/manimlib/mobject/probability.py index a7512007..dd3dfd31 100644 --- a/manimlib/mobject/probability.py +++ b/manimlib/mobject/probability.py @@ -175,35 +175,36 @@ class BarChart(VGroup): def add_axes(self): x_axis = Line(self.tick_width * LEFT / 2, self.width * RIGHT) y_axis = Line(MED_LARGE_BUFF * DOWN, self.height * UP) - ticks = VGroup() + y_ticks = VGroup() heights = np.linspace(0, self.height, self.n_ticks + 1) values = np.linspace(0, self.max_value, self.n_ticks + 1) for y, value in zip(heights, values): - tick = Line(LEFT, RIGHT) - tick.set_width(self.tick_width) - tick.move_to(y * UP) - ticks.add(tick) - y_axis.add(ticks) + y_tick = Line(LEFT, RIGHT) + y_tick.set_width(self.tick_width) + y_tick.move_to(y * UP) + y_ticks.add(y_tick) + y_axis.add(y_ticks) if self.include_x_ticks == True: + x_ticks = VGroup() widths = np.linspace(0, self.width, self.n_ticks_x + 1) label_values = np.linspace(0, len(self.bar_names), self.n_ticks_x + 1) for x, value in zip(widths, label_values): - tick1 = Line(UP, DOWN) - tick1.set_height(self.tick_height) - tick1.move_to(x * RIGHT) - ticks.add(tick) - x_axis.add(ticks) + x_tick = Line(UP, DOWN) + x_tick.set_height(self.tick_height) + x_tick.move_to(x * RIGHT) + x_ticks.add(x_tick) + x_axis.add(x_ticks) self.add(x_axis, y_axis) self.x_axis, self.y_axis = x_axis, y_axis if self.label_y_axis: labels = VGroup() - for tick, value in zip(ticks, values): + for y_tick, value in zip(y_ticks, values): label = Tex(str(np.round(value, 2))) label.set_height(self.y_axis_label_height) - label.next_to(tick, LEFT, SMALL_BUFF) + label.next_to(y_tick, LEFT, SMALL_BUFF) labels.add(label) self.y_axis_labels = labels self.add(labels) From 09ced7ce9ad2543098c1c6278fbe28accba5abef Mon Sep 17 00:00:00 2001 From: TonyCrane Date: Thu, 23 Dec 2021 10:34:15 +0800 Subject: [PATCH 09/14] docs: update changelog for #1694 and #1697 --- docs/source/development/changelog.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/source/development/changelog.rst b/docs/source/development/changelog.rst index 8844ac9d..54d868f3 100644 --- a/docs/source/development/changelog.rst +++ b/docs/source/development/changelog.rst @@ -1,6 +1,22 @@ Changelog ========= +Unreleased +---------- + +Fixed bugs +^^^^^^^^^^ +- `f1996f8 `__: Temporarily fixed ``Lightbulb`` + +New Features +^^^^^^^^^^^^ +- `#1694 `__: Added option to add ticks on x-axis in ``BarChart`` + +Refactor +^^^^^^^^ +- `5aa8d15 `__: Used ``FFMPEG_BIN`` instead of ``"ffmpeg"`` for sound incorporation + + v1.3.0 ------ From 066a2ed5dc9863d743599da6114cf92abc8af26f Mon Sep 17 00:00:00 2001 From: Sujan Dutta Date: Fri, 31 Dec 2021 00:10:57 -0500 Subject: [PATCH 10/14] removed extra 'all' from comments --- example_scenes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example_scenes.py b/example_scenes.py index 3307e8f4..70321ce5 100644 --- a/example_scenes.py +++ b/example_scenes.py @@ -274,7 +274,7 @@ class UpdatersExample(Scene): square = Square() square.set_fill(BLUE_E, 1) - # On all all frames, the constructor Brace(square, UP) will + # On all frames, the constructor Brace(square, UP) will # be called, and the mobject brace will set its data to match # that of the newly constructed object brace = always_redraw(Brace, square, UP) From 0a318486c5a43fa400829a881b4144d213995b3a Mon Sep 17 00:00:00 2001 From: Bill Xi <86190295+TurkeyBilly@users.noreply.github.com> Date: Mon, 3 Jan 2022 14:57:16 +0800 Subject: [PATCH 11/14] Adding "lable_buff" config parameter for Brace --- manimlib/mobject/svg/brace.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manimlib/mobject/svg/brace.py b/manimlib/mobject/svg/brace.py index cd686fbb..ffce8179 100644 --- a/manimlib/mobject/svg/brace.py +++ b/manimlib/mobject/svg/brace.py @@ -88,6 +88,7 @@ class BraceLabel(VMobject): CONFIG = { "label_constructor": Tex, "label_scale": 1, + "lable_buff": DEFAULT_MOBJECT_TO_MOBJECT_BUFFER } def __init__(self, obj, text, brace_direction=DOWN, **kwargs): @@ -104,7 +105,7 @@ class BraceLabel(VMobject): if self.label_scale != 1: self.label.scale(self.label_scale) - self.brace.put_at_tip(self.label) + self.brace.put_at_tip(self.label, buff=self.lable_buff) self.set_submobjects([self.brace, self.label]) def creation_anim(self, label_anim=FadeIn, brace_anim=GrowFromCenter): From 9efd02c500da928a52e4b7ebfef85e74186f2e71 Mon Sep 17 00:00:00 2001 From: Bill Xi <86190295+TurkeyBilly@users.noreply.github.com> Date: Mon, 3 Jan 2022 16:37:26 +0800 Subject: [PATCH 12/14] Remove spelling mistake I misspelled "label" --- manimlib/mobject/svg/brace.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manimlib/mobject/svg/brace.py b/manimlib/mobject/svg/brace.py index ffce8179..2f6f4c7a 100644 --- a/manimlib/mobject/svg/brace.py +++ b/manimlib/mobject/svg/brace.py @@ -88,7 +88,7 @@ class BraceLabel(VMobject): CONFIG = { "label_constructor": Tex, "label_scale": 1, - "lable_buff": DEFAULT_MOBJECT_TO_MOBJECT_BUFFER + "label_buff": DEFAULT_MOBJECT_TO_MOBJECT_BUFFER } def __init__(self, obj, text, brace_direction=DOWN, **kwargs): @@ -105,7 +105,7 @@ class BraceLabel(VMobject): if self.label_scale != 1: self.label.scale(self.label_scale) - self.brace.put_at_tip(self.label, buff=self.lable_buff) + self.brace.put_at_tip(self.label, buff=self.label_buff) self.set_submobjects([self.brace, self.label]) def creation_anim(self, label_anim=FadeIn, brace_anim=GrowFromCenter): From 24e3caa072bd2bb4750cf3801e0a151cdf3e2c1f Mon Sep 17 00:00:00 2001 From: Bill Xi <86190295+TurkeyBilly@users.noreply.github.com> Date: Mon, 3 Jan 2022 16:49:00 +0800 Subject: [PATCH 13/14] fix no "import copy" bug added import copy --- manimlib/mobject/svg/brace.py | 1 + 1 file changed, 1 insertion(+) diff --git a/manimlib/mobject/svg/brace.py b/manimlib/mobject/svg/brace.py index 2f6f4c7a..31217a28 100644 --- a/manimlib/mobject/svg/brace.py +++ b/manimlib/mobject/svg/brace.py @@ -1,5 +1,6 @@ import numpy as np import math +import copy from manimlib.animation.composition import AnimationGroup from manimlib.constants import * From e80dd243f11986d9f6f7b41bfaaa5b20350b0f85 Mon Sep 17 00:00:00 2001 From: Bill Xi <86190295+TurkeyBilly@users.noreply.github.com> Date: Mon, 17 Jan 2022 20:27:34 +0800 Subject: [PATCH 14/14] Added abstract method decorator and override --- manimlib/mobject/coordinate_systems.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/manimlib/mobject/coordinate_systems.py b/manimlib/mobject/coordinate_systems.py index 0177a2d6..de663200 100644 --- a/manimlib/mobject/coordinate_systems.py +++ b/manimlib/mobject/coordinate_systems.py @@ -1,3 +1,4 @@ +from abc import abstractmethod import numpy as np import numbers @@ -51,13 +52,15 @@ class CoordinateSystem(): def p2c(self, point): """Abbreviation for point_to_coords""" return self.point_to_coords(point) - + def get_origin(self): return self.c2p(*[0] * self.dimension) - + + @abstractmethod def get_axes(self): raise Exception("Not implemented") + @abstractmethod def get_all_ranges(self): raise Exception("Not implemented") @@ -333,6 +336,18 @@ class Axes(VGroup, CoordinateSystem): def get_axes(self): return self.axes + + def get_axis(self, index): + return self.get_axes()[index] + + def get_x_axis(self): + return self.get_axis(0) + + def get_y_axis(self): + return self.get_axis(1) + + def get_z_axis(self): + return self.get_axis(2) def get_all_ranges(self): return [self.x_range, self.y_range]