mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Merge branch 'master' of github.com:3b1b/manim into video-work
This commit is contained in:
commit
a33df4ae9c
9 changed files with 95 additions and 35 deletions
|
@ -4,11 +4,33 @@ Changelog
|
||||||
Unreleased
|
Unreleased
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
Fixed bugs
|
||||||
|
^^^^^^^^^^
|
||||||
|
- `f1996f8 <https://github.com/3b1b/manim/pull/1697/commits/f1996f8479f9e33d626b3b66e9eb6995ce231d86>`__: Temporarily fixed ``Lightbulb``
|
||||||
|
|
||||||
|
New Features
|
||||||
|
^^^^^^^^^^^^
|
||||||
|
- `#1694 <https://github.com/3b1b/manim/pull/1694>`__: Added option to add ticks on x-axis in ``BarChart``
|
||||||
|
|
||||||
|
Refactor
|
||||||
|
^^^^^^^^
|
||||||
|
- `5aa8d15 <https://github.com/3b1b/manim/pull/1697/commits/5aa8d15d85797f68a8f169ca69fd90d441a3abbe>`__: Used ``FFMPEG_BIN`` instead of ``"ffmpeg"`` for sound incorporation
|
||||||
|
|
||||||
|
|
||||||
|
v1.3.0
|
||||||
|
------
|
||||||
|
|
||||||
Fixed bugs
|
Fixed bugs
|
||||||
^^^^^^^^^^
|
^^^^^^^^^^
|
||||||
|
|
||||||
- `#1653 <https://github.com/3b1b/manim/pull/1653>`__: Fixed ``Mobject.stretch_to_fit_depth``
|
- `#1653 <https://github.com/3b1b/manim/pull/1653>`__: Fixed ``Mobject.stretch_to_fit_depth``
|
||||||
- `#1655 <https://github.com/3b1b/manim/pull/1655>`__: Fixed the bug of rotating camera
|
- `#1655 <https://github.com/3b1b/manim/pull/1655>`__: Fixed the bug of rotating camera
|
||||||
|
- `c73d507 <https://github.com/3b1b/manim/pull/1688/commits/c73d507c76af5c8602d4118bc7538ba04c03ebae>`__: Fixed ``SurfaceMesh`` to be evenly spaced
|
||||||
|
- `82bd02d <https://github.com/3b1b/manim/pull/1688/commits/82bd02d21fbd89b71baa21e077e143f440df9014>`__: Fixed ``angle_between_vectors`` add ``rotation_between_vectors``
|
||||||
|
- `a717314 <https://github.com/3b1b/manim/pull/1688/commits/a7173142bf93fd309def0cc10f3c56f5e6972332>`__: Fixed ``VMobject.fade``
|
||||||
|
- `fbc329d <https://github.com/3b1b/manim/pull/1688/commits/fbc329d7ce3b11821d47adf6052d932f7eff724a>`__: Fixed ``angle_between_vectors``
|
||||||
|
- `bcd0990 <https://github.com/3b1b/manim/pull/1688/commits/bcd09906bea5eaaa5352e7bee8f3153f434cf606>`__: Fixed bug in ``ShowSubmobjectsOneByOne``
|
||||||
|
- `7023548 <https://github.com/3b1b/manim/pull/1691/commits/7023548ec62c4adb2f371aab6a8c7f62deb7c33c>`__: Fixed bug in ``TransformMatchingParts``
|
||||||
|
|
||||||
New Features
|
New Features
|
||||||
^^^^^^^^^^^^
|
^^^^^^^^^^^^
|
||||||
|
@ -21,12 +43,37 @@ New Features
|
||||||
- ``Difference(subject, clip, **kwargs)``
|
- ``Difference(subject, clip, **kwargs)``
|
||||||
- ``Intersection(*vmobjects, **kwargs)``
|
- ``Intersection(*vmobjects, **kwargs)``
|
||||||
- ``Exclusion(*vmobjects, **kwargs)``
|
- ``Exclusion(*vmobjects, **kwargs)``
|
||||||
|
- `81c3ae3 <https://github.com/3b1b/manim/pull/1688/commits/81c3ae30372e288dc772633dbd17def6e603753e>`__: Added reflectiveness
|
||||||
|
- `2c7689e <https://github.com/3b1b/manim/pull/1688/commits/2c7689ed9e81229ce87c648f97f26267956c0bc9>`__: Enabled ``glow_factor`` on ``DotCloud``
|
||||||
|
- `d065e19 <https://github.com/3b1b/manim/pull/1688/commits/d065e1973d1d6ebd2bece81ce4bdf0c2fff7c772>`__: Added option ``-e`` to insert embed line from the command line
|
||||||
|
- `0e78027 <https://github.com/3b1b/manim/pull/1688/commits/0e78027186a976f7e5fa8d586f586bf6e6baab8d>`__: Improved ``point_from_proportion`` to account for arc length
|
||||||
|
- `781a993 <https://github.com/3b1b/manim/pull/1688/commits/781a9934fda6ba11f22ba32e8ccddcb3ba78592e>`__: Added shortcut ``set_backstroke`` for setting black background stroke
|
||||||
|
- `0b898a5 <https://github.com/3b1b/manim/pull/1688/commits/0b898a5594203668ed9cad38b490ab49ba233bd4>`__: Added ``Suface.always_sort_to_camera``
|
||||||
|
- `e899604 <https://github.com/3b1b/manim/pull/1688/commits/e899604a2d05f78202fcb3b9824ec34647237eae>`__: Added getter methods for specific euler angles
|
||||||
|
- `407c53f <https://github.com/3b1b/manim/pull/1688/commits/407c53f97c061bfd8a53beacd88af4c786f9e9ee>`__: Hade ``rotation_between_vectors`` handle identical/similar vectors
|
||||||
|
- `49743da <https://github.com/3b1b/manim/pull/1688/commits/49743daf3244bfa11a427040bdde8e2bb79589e8>`__: Added ``Mobject.insert_submobject`` method
|
||||||
|
- `9dd1f47 <https://github.com/3b1b/manim/pull/1688/commits/9dd1f47dabca1580d6102e34e44574b0cba556e7>`__: Created single progress display for full scene render
|
||||||
|
- `264f7b1 <https://github.com/3b1b/manim/pull/1691/commits/264f7b11726e9e736f0fe472f66e38539f74e848>`__: Added ``Circle.get_radius``
|
||||||
|
- `83841ae <https://github.com/3b1b/manim/pull/1691/commits/83841ae41568a9c9dff44cd163106c19a74ac281>`__: Added ``Dodecahedron``
|
||||||
|
- `a1d5147 <https://github.com/3b1b/manim/pull/1691/commits/a1d51474ea1ce3b7aa3efbe4c5e221be70ee2f5b>`__: Added ``GlowDot``
|
||||||
|
- `#1678 <https://github.com/3b1b/manim/pull/1678>`__: Added ``MTex`` , see `#1678 <https://github.com/3b1b/manim/pull/1678>`__ for details
|
||||||
|
|
||||||
Refactor
|
Refactor
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
- `#1662 <https://github.com/3b1b/manim/pull/1662>`__: Refactored support for command ``A`` in path of SVG
|
- `#1662 <https://github.com/3b1b/manim/pull/1662>`__: Refactored support for command ``A`` in path of SVG
|
||||||
- `#1662 <https://github.com/3b1b/manim/pull/1662>`__: Refactored ``SingleStringTex.balance_braces``
|
- `#1662 <https://github.com/3b1b/manim/pull/1662>`__: Refactored ``SingleStringTex.balance_braces``
|
||||||
|
- `8b454fb <https://github.com/3b1b/manim/pull/1688/commits/8b454fbe9335a7011e947093230b07a74ba9c653>`__: Slight tweaks to how saturation_factor works on newton-fractal
|
||||||
|
- `317a5d6 <https://github.com/3b1b/manim/pull/1688/commits/317a5d6226475b6b54a78db7116c373ef84ea923>`__: Made it possible to set full screen preview as a default
|
||||||
|
- `e764da3 <https://github.com/3b1b/manim/pull/1688/commits/e764da3c3adc5ae2a4ce877b340d2b6abcddc2fc>`__: Used ``quick_point_from_proportion`` for graph points
|
||||||
|
- `d2182b9 <https://github.com/3b1b/manim/pull/1688/commits/d2182b9112300558b6c074cefd685f97c10b3898>`__: Made sure ``Line.set_length`` returns self
|
||||||
|
- `eea3c6b <https://github.com/3b1b/manim/pull/1688/commits/eea3c6b29438f9e9325329c4355e76b9f635e97a>`__: Better align ``SurfaceMesh`` to the corresponding surface polygons
|
||||||
|
- `ee1594a <https://github.com/3b1b/manim/pull/1688/commits/ee1594a3cb7a79b8fc361e4c4397a88c7d20c7e3>`__: Match ``fix_in_frame`` status for ``FlashAround`` mobject
|
||||||
|
- `ba23fbe <https://github.com/3b1b/manim/pull/1688/commits/ba23fbe71e4a038201cd7df1d200514ed1c13bc2>`__: Made sure ``Mobject.is_fixed_in_frame`` stays updated with uniforms
|
||||||
|
- `98b0d26 <https://github.com/3b1b/manim/pull/1691/commits/98b0d266d2475926a606331923cca3dc1dea97ad>`__: Made sure ``skip_animations`` and ``start_at_animation_number`` play well together
|
||||||
|
- `f8e6e7d <https://github.com/3b1b/manim/pull/1691/commits/f8e6e7df3ceb6f3d845ced4b690a85b35e0b8d00>`__: Updated progress display for full scene render
|
||||||
|
- `8f1dfab <https://github.com/3b1b/manim/pull/1691/commits/8f1dfabff04a8456f5c4df75b0f97d50b2755003>`__: ``VectorizedPoint`` should call ``__init__`` for both super classes
|
||||||
|
- `758f329 <https://github.com/3b1b/manim/pull/1691/commits/758f329a06a0c198b27a48c577575d94554305bf>`__: Used array copy when checking need for refreshing triangulation
|
||||||
|
|
||||||
|
|
||||||
Dependencies
|
Dependencies
|
||||||
|
|
|
@ -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.
|
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``.
|
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.
|
|
|
@ -53,6 +53,7 @@ flag abbr function
|
||||||
``--config`` Guide for automatic configuration
|
``--config`` Guide for automatic configuration
|
||||||
``--file_name FILE_NAME`` Name for the movie or image file
|
``--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.
|
``--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"
|
``--resolution RESOLUTION`` ``-r`` Resolution, passed as "WxH", e.g. "1920x1080"
|
||||||
``--frame_rate FRAME_RATE`` Frame rate, as an integer
|
``--frame_rate FRAME_RATE`` Frame rate, as an integer
|
||||||
``--color COLOR`` ``-c`` Background color
|
``--color COLOR`` ``-c`` Background color
|
||||||
|
|
|
@ -274,7 +274,7 @@ class UpdatersExample(Scene):
|
||||||
square = Square()
|
square = Square()
|
||||||
square.set_fill(BLUE_E, 1)
|
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
|
# be called, and the mobject brace will set its data to match
|
||||||
# that of the newly constructed object
|
# that of the newly constructed object
|
||||||
brace = always_redraw(Brace, square, UP)
|
brace = always_redraw(Brace, square, UP)
|
||||||
|
|
|
@ -123,7 +123,7 @@ def parse_cli():
|
||||||
"the rendering at the second value",
|
"the rendering at the second value",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-e", "--embed",
|
"-e", "--embed", metavar="LINENO",
|
||||||
help="Takes a line number as an argument, and results"
|
help="Takes a line number as an argument, and results"
|
||||||
"in the scene being called as if the line `self.embed()`"
|
"in the scene being called as if the line `self.embed()`"
|
||||||
"was inserted into the scene code at that line number."
|
"was inserted into the scene code at that line number."
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from abc import abstractmethod
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import numbers
|
import numbers
|
||||||
|
|
||||||
|
@ -55,9 +56,11 @@ class CoordinateSystem():
|
||||||
def get_origin(self):
|
def get_origin(self):
|
||||||
return self.c2p(*[0] * self.dimension)
|
return self.c2p(*[0] * self.dimension)
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
def get_axes(self):
|
def get_axes(self):
|
||||||
raise Exception("Not implemented")
|
raise Exception("Not implemented")
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
def get_all_ranges(self):
|
def get_all_ranges(self):
|
||||||
raise Exception("Not implemented")
|
raise Exception("Not implemented")
|
||||||
|
|
||||||
|
@ -334,6 +337,18 @@ class Axes(VGroup, CoordinateSystem):
|
||||||
def get_axes(self):
|
def get_axes(self):
|
||||||
return self.axes
|
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):
|
def get_all_ranges(self):
|
||||||
return [self.x_range, self.y_range]
|
return [self.x_range, self.y_range]
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,9 @@ class BarChart(VGroup):
|
||||||
"height": 4,
|
"height": 4,
|
||||||
"width": 6,
|
"width": 6,
|
||||||
"n_ticks": 4,
|
"n_ticks": 4,
|
||||||
|
"include_x_ticks": False,
|
||||||
"tick_width": 0.2,
|
"tick_width": 0.2,
|
||||||
|
"tick_height": 0.15,
|
||||||
"label_y_axis": True,
|
"label_y_axis": True,
|
||||||
"y_axis_label_height": 0.25,
|
"y_axis_label_height": 0.25,
|
||||||
"max_value": 1,
|
"max_value": 1,
|
||||||
|
@ -165,6 +167,7 @@ class BarChart(VGroup):
|
||||||
if self.max_value is None:
|
if self.max_value is None:
|
||||||
self.max_value = max(values)
|
self.max_value = max(values)
|
||||||
|
|
||||||
|
self.n_ticks_x = len(values)
|
||||||
self.add_axes()
|
self.add_axes()
|
||||||
self.add_bars(values)
|
self.add_bars(values)
|
||||||
self.center()
|
self.center()
|
||||||
|
@ -172,31 +175,42 @@ class BarChart(VGroup):
|
||||||
def add_axes(self):
|
def add_axes(self):
|
||||||
x_axis = Line(self.tick_width * LEFT / 2, self.width * RIGHT)
|
x_axis = Line(self.tick_width * LEFT / 2, self.width * RIGHT)
|
||||||
y_axis = Line(MED_LARGE_BUFF * DOWN, self.height * UP)
|
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)
|
heights = np.linspace(0, self.height, self.n_ticks + 1)
|
||||||
values = np.linspace(0, self.max_value, self.n_ticks + 1)
|
values = np.linspace(0, self.max_value, self.n_ticks + 1)
|
||||||
for y, value in zip(heights, values):
|
for y, value in zip(heights, values):
|
||||||
tick = Line(LEFT, RIGHT)
|
y_tick = Line(LEFT, RIGHT)
|
||||||
tick.set_width(self.tick_width)
|
y_tick.set_width(self.tick_width)
|
||||||
tick.move_to(y * UP)
|
y_tick.move_to(y * UP)
|
||||||
ticks.add(tick)
|
y_ticks.add(y_tick)
|
||||||
y_axis.add(ticks)
|
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.add(x_axis, y_axis)
|
||||||
self.x_axis, self.y_axis = x_axis, y_axis
|
self.x_axis, self.y_axis = x_axis, y_axis
|
||||||
|
|
||||||
if self.label_y_axis:
|
if self.label_y_axis:
|
||||||
labels = VGroup()
|
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 = Tex(str(np.round(value, 2)))
|
||||||
label.set_height(self.y_axis_label_height)
|
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)
|
labels.add(label)
|
||||||
self.y_axis_labels = labels
|
self.y_axis_labels = labels
|
||||||
self.add(labels)
|
self.add(labels)
|
||||||
|
|
||||||
def add_bars(self, values):
|
def add_bars(self, values):
|
||||||
buff = float(self.width) / (2 * len(values) + 1)
|
buff = float(self.width) / (2 * len(values))
|
||||||
bars = VGroup()
|
bars = VGroup()
|
||||||
for i, value in enumerate(values):
|
for i, value in enumerate(values):
|
||||||
bar = Rectangle(
|
bar = Rectangle(
|
||||||
|
@ -205,7 +219,7 @@ class BarChart(VGroup):
|
||||||
stroke_width=self.bar_stroke_width,
|
stroke_width=self.bar_stroke_width,
|
||||||
fill_opacity=self.bar_fill_opacity,
|
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.add(bar)
|
||||||
bars.set_color_by_gradient(*self.bar_colors)
|
bars.set_color_by_gradient(*self.bar_colors)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import math
|
import math
|
||||||
|
import copy
|
||||||
|
|
||||||
from manimlib.animation.composition import AnimationGroup
|
from manimlib.animation.composition import AnimationGroup
|
||||||
from manimlib.constants import *
|
from manimlib.constants import *
|
||||||
|
@ -88,6 +89,7 @@ class BraceLabel(VMobject):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"label_constructor": Tex,
|
"label_constructor": Tex,
|
||||||
"label_scale": 1,
|
"label_scale": 1,
|
||||||
|
"label_buff": DEFAULT_MOBJECT_TO_MOBJECT_BUFFER
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, obj, text, brace_direction=DOWN, **kwargs):
|
def __init__(self, obj, text, brace_direction=DOWN, **kwargs):
|
||||||
|
@ -104,7 +106,7 @@ class BraceLabel(VMobject):
|
||||||
if self.label_scale != 1:
|
if self.label_scale != 1:
|
||||||
self.label.scale(self.label_scale)
|
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])
|
self.set_submobjects([self.brace, self.label])
|
||||||
|
|
||||||
def creation_anim(self, label_anim=FadeIn, brace_anim=GrowFromCenter):
|
def creation_anim(self, label_anim=FadeIn, brace_anim=GrowFromCenter):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[metadata]
|
[metadata]
|
||||||
name = manimgl
|
name = manimgl
|
||||||
version = 1.2.0
|
version = 1.3.0
|
||||||
author = Grant Sanderson
|
author = Grant Sanderson
|
||||||
author_email= grant@3blue1brown.com
|
author_email= grant@3blue1brown.com
|
||||||
description = Animation engine for explanatory math videos
|
description = Animation engine for explanatory math videos
|
||||||
|
|
Loading…
Add table
Reference in a new issue