diff --git a/docs/source/development/changelog.rst b/docs/source/development/changelog.rst index ca18c88c..54d868f3 100644 --- a/docs/source/development/changelog.rst +++ b/docs/source/development/changelog.rst @@ -4,11 +4,33 @@ 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 +------ + 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`` +- `7023548 `__: Fixed bug in ``TransformMatchingParts`` New Features ^^^^^^^^^^^^ @@ -21,12 +43,37 @@ 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 +- `264f7b1 `__: Added ``Circle.get_radius`` +- `83841ae `__: Added ``Dodecahedron`` +- `a1d5147 `__: Added ``GlowDot`` +- `#1678 `__: Added ``MTex`` , see `#1678 `__ for details 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 +- `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 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 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 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) diff --git a/manimlib/config.py b/manimlib/config.py index 6dc65941..e22d2ea3 100644 --- a/manimlib/config.py +++ b/manimlib/config.py @@ -123,7 +123,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." diff --git a/manimlib/mobject/coordinate_systems.py b/manimlib/mobject/coordinate_systems.py index e068c9ac..05d23785 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] diff --git a/manimlib/mobject/probability.py b/manimlib/mobject/probability.py index 69a71069..dd3dfd31 100644 --- a/manimlib/mobject/probability.py +++ b/manimlib/mobject/probability.py @@ -149,7 +149,9 @@ class BarChart(VGroup): "height": 4, "width": 6, "n_ticks": 4, + "include_x_ticks": False, "tick_width": 0.2, + "tick_height": 0.15, "label_y_axis": True, "y_axis_label_height": 0.25, "max_value": 1, @@ -165,6 +167,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() @@ -172,31 +175,42 @@ 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): + 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) 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 +219,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) diff --git a/manimlib/mobject/svg/brace.py b/manimlib/mobject/svg/brace.py index cd686fbb..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 * @@ -88,6 +89,7 @@ class BraceLabel(VMobject): CONFIG = { "label_constructor": Tex, "label_scale": 1, + "label_buff": DEFAULT_MOBJECT_TO_MOBJECT_BUFFER } def __init__(self, obj, text, brace_direction=DOWN, **kwargs): @@ -104,7 +106,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.label_buff) self.set_submobjects([self.brace, self.label]) def creation_anim(self, label_anim=FadeIn, brace_anim=GrowFromCenter): 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