Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

DEFAULT_POINT_THICKNESS -> DEFAULT_STROKE_WIDTH

Grant Sanderson114a37f32cad
diff --git a/camera/camera.py b/camera/camera.py
index 5195a1d39..fcaea8e7e 100644
--- a/camera/camera.py
+++ b/camera/camera.py
@@ -174,6 +174,7 @@ class Camera(object):
self.background = self.convert_pixel_array(
pixel_array, convert_from_floats)
+ # TODO, this should live in utils, not as a method of Camera
def make_background_from_func(self, coords_to_colors_func):
"""
Sets background by using coords_to_colors_func to determine each pixel's color. Each input
@@ -378,6 +379,8 @@ class Camera(object):
def apply_stroke(self, ctx, vmobject, background=False):
width = vmobject.get_stroke_width(background)
+ if width == 0:
+ return self
self.set_cairo_context_color(
ctx,
self.get_stroke_rgbas(vmobject, background=background),
@@ -584,6 +587,7 @@ class Camera(object):
size = pixel_coords.size
return pixel_coords.reshape((size / 2, 2))
+ # TODO, reimplement using cairo matrix
def get_coords_of_all_pixels(self):
# These are in x, y order, to help me keep things straight
full_space_dims = np.array([
diff --git a/for_3b1b_videos/common_scenes.py b/for_3b1b_videos/common_scenes.py
index 70592d83b..a21554154 100644
--- a/for_3b1b_videos/common_scenes.py
+++ b/for_3b1b_videos/common_scenes.py
@@ -162,7 +162,10 @@ class PatreonEndScreen(PatreonThanks):
random.shuffle(self.specific_patrons)
if self.capitalize:
self.specific_patrons = [
- " ".join(map(string.capitalize, patron.split(" ")))
+ " ".join(map(
+ lambda s: s.capitalize(),
+ patron.split(" ")
+ ))
for patron in self.specific_patrons
]
diff --git a/mobject/svg/tex_mobject.py b/mobject/svg/tex_mobject.py
index 63cd30d23..eea067f1d 100644
--- a/mobject/svg/tex_mobject.py
+++ b/mobject/svg/tex_mobject.py
@@ -240,6 +240,11 @@ class TexMobject(SingleStringTexMobject):
part = self.get_part_by_tex(tex, **kwargs)
return self.index_of_part(part)
+ def sort_submobjects_alphabetically(self):
+ self.submobjects.sort(
+ key=lambda m: m.get_tex_string()
+ )
+
def split(self):
# Many old scenes assume that when you pass in a single string
# to TexMobject, it indexes across the characters.
diff --git a/mobject/types/vectorized_mobject.py b/mobject/types/vectorized_mobject.py
index 9381b7203..f62df6a97 100644
--- a/mobject/types/vectorized_mobject.py
+++ b/mobject/types/vectorized_mobject.py
@@ -21,7 +21,7 @@ class VMobject(Mobject):
"fill_opacity": 0.0,
"stroke_color": None,
"stroke_opacity": 1.0,
- "stroke_width": DEFAULT_POINT_THICKNESS,
+ "stroke_width": DEFAULT_STROKE_WIDTH,
# The purpose of background stroke is to have
# something that won't overlap the fill, e.g.
# For text against some textured background