mirror of
https://github.com/3b1b/manim.git
synced 2025-11-14 05:07:47 +00:00
sort_submobject -> sort and shuffle_submobjects -> shuffle
This commit is contained in:
parent
8f556ffb89
commit
eb0c63606d
24 changed files with 62 additions and 56 deletions
|
|
@ -2366,13 +2366,13 @@ class ChooseThreeFromFive(InitialFiveChooseThreeExample, PiCreatureScene):
|
|||
for x in range(6):
|
||||
line.generate_target()
|
||||
resorter = VGroup(*line.target)
|
||||
resorter.sort_submobjects(lambda p : random.random())
|
||||
resorter.sort(lambda p : random.random())
|
||||
resorter.arrange(RIGHT, buff = SMALL_BUFF)
|
||||
resorter.move_to(line)
|
||||
self.play(MoveToTarget(line, path_arc = np.pi))
|
||||
self.play(FadeOut(q_marks))
|
||||
|
||||
line.sort_submobjects(lambda p : p[0])
|
||||
line.sort(lambda p : p[0])
|
||||
words = VGroup(*list(map(TextMobject, ["First", "Second", "Fifth"])))
|
||||
words.set_color(YELLOW)
|
||||
words.scale(0.75)
|
||||
|
|
|
|||
|
|
@ -903,7 +903,7 @@ class ThousandPossibleQuizzes(Scene):
|
|||
top_split = VGroup(*self.quizzes[:n])
|
||||
bottom_split = VGroup(*self.quizzes[n:])
|
||||
for split, color, vect in (top_split, GREEN, UP), (bottom_split, RED, DOWN):
|
||||
split.sort_submobjects(lambda p : p[0])
|
||||
split.sort(lambda p : p[0])
|
||||
split.generate_target()
|
||||
split.target.shift(MED_LARGE_BUFF*vect)
|
||||
for quiz in split.target:
|
||||
|
|
@ -1175,7 +1175,7 @@ class ThousandPossibleQuizzes(Scene):
|
|||
proportions = [0.9, 0.8, 0.8, 0.4]
|
||||
for split, prop in zip(all_splits, proportions):
|
||||
n = int(prop*len(split))
|
||||
split.sort_submobjects(lambda p : -p[1])
|
||||
split.sort(lambda p : -p[1])
|
||||
split.generate_target()
|
||||
top_part = VGroup(*split.target[:n])
|
||||
top_part.shift(MED_SMALL_BUFF*UP)
|
||||
|
|
@ -2111,7 +2111,7 @@ class CorrelationsWith35Percent(ThousandPossibleQuizzes):
|
|||
self.wait()
|
||||
|
||||
self.quizzes = bottom_part
|
||||
self.quizzes.sort_submobjects(lambda p : p[0])
|
||||
self.quizzes.sort(lambda p : p[0])
|
||||
|
||||
def show_second_split(self):
|
||||
n = int(0.45*len(self.quizzes))
|
||||
|
|
@ -2143,7 +2143,7 @@ class CorrelationsWith35Percent(ThousandPossibleQuizzes):
|
|||
self.play(left_part.fade, 0.8)
|
||||
|
||||
self.quizzes = right_part
|
||||
self.quizzes.sort_submobjects(lambda p : -p[1])
|
||||
self.quizzes.sort(lambda p : -p[1])
|
||||
|
||||
def show_third_split(self):
|
||||
quizzes = self.quizzes
|
||||
|
|
|
|||
|
|
@ -859,10 +859,6 @@ class Mobject(Container):
|
|||
self.center()
|
||||
return self
|
||||
|
||||
# Just here to keep from breaking old scenes.
|
||||
def arrange_submobjects(self, *args, **kwargs):
|
||||
return self.arrange(*args, **kwargs)
|
||||
|
||||
def arrange_in_grid(self, n_rows=None, n_cols=None, **kwargs):
|
||||
submobs = self.submobjects
|
||||
if n_rows is None and n_cols is None:
|
||||
|
|
@ -882,16 +878,16 @@ class Mobject(Container):
|
|||
]).arrange(v2, **kwargs)
|
||||
return self
|
||||
|
||||
def sort_submobjects(self, point_to_num_func=lambda p: p[0]):
|
||||
def sort(self, point_to_num_func=lambda p: p[0]):
|
||||
self.submobjects.sort(
|
||||
key=lambda m: point_to_num_func(m.get_center())
|
||||
)
|
||||
return self
|
||||
|
||||
def shuffle_submobjects(self, recursive=False):
|
||||
def shuffle(self, recursive=False):
|
||||
if recursive:
|
||||
for submob in self.submobjects:
|
||||
submob.shuffle_submobjects(recursive=True)
|
||||
submob.shuffle(recursive=True)
|
||||
random.shuffle(self.submobjects)
|
||||
|
||||
def print_family(self, n_tabs=0):
|
||||
|
|
@ -900,6 +896,16 @@ class Mobject(Container):
|
|||
for submob in self.submobjects:
|
||||
submob.print_family(n_tabs + 1)
|
||||
|
||||
# Just here to keep from breaking old scenes.
|
||||
def arrange_submobjects(self, *args, **kwargs):
|
||||
return self.arrange(*args, **kwargs)
|
||||
|
||||
def sort_submobjects(self, *args, **kwargs):
|
||||
return self.sort(*args, **kwargs)
|
||||
|
||||
def shuffle_submobjects(self, *args, **kwargs):
|
||||
return self.shuffle(*args, **kwargs)
|
||||
|
||||
# Alignment
|
||||
def align_data(self, mobject):
|
||||
self.align_submobjects(mobject)
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ class Laptop(VGroup):
|
|||
body.stretch(scale_factor, dim=dim)
|
||||
body.set_width(self.width)
|
||||
body.set_fill(self.shaded_body_color, opacity=1)
|
||||
body.sort_submobjects(lambda p: p[2])
|
||||
body.sort(lambda p: p[2])
|
||||
body[-1].set_fill(self.body_color)
|
||||
screen_plate = body.copy()
|
||||
keyboard = VGroup(*[
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ class SingleStringTexMobject(SVGMobject):
|
|||
return TexSymbol(path_string)
|
||||
|
||||
def organize_submobjects_left_to_right(self):
|
||||
self.sort_submobjects(lambda p: p[0])
|
||||
self.sort(lambda p: p[0])
|
||||
return self
|
||||
|
||||
|
||||
|
|
@ -231,7 +231,7 @@ class TexMobject(SingleStringTexMobject):
|
|||
part = self.get_part_by_tex(tex, **kwargs)
|
||||
return self.index_of_part(part)
|
||||
|
||||
def sort_submobjects_alphabetically(self):
|
||||
def sort_alphabetically(self):
|
||||
self.submobjects.sort(
|
||||
key=lambda m: m.get_tex_string()
|
||||
)
|
||||
|
|
|
|||
|
|
@ -679,7 +679,7 @@ class StateOfBitcoin(TeacherStudentsScene):
|
|||
third = TexMobject("1 \\over 3")
|
||||
third.next_to(kilo, LEFT)
|
||||
kilogoogle = VGroup(*it.chain(third, kilo, google))
|
||||
kilogoogle.sort_submobjects()
|
||||
kilogoogle.sort()
|
||||
kilogoogle.next_to(rate, DOWN, MED_LARGE_BUFF)
|
||||
|
||||
rate.save_state()
|
||||
|
|
@ -818,7 +818,7 @@ class QAndA(PiCreatureScene):
|
|||
dots.next_to(self.pi_creature, UP)
|
||||
dots = VGroup(*it.chain(*dots))
|
||||
top = dots.get_top()
|
||||
dots.sort_submobjects(
|
||||
dots.sort(
|
||||
lambda p : get_norm(p-top)
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -597,7 +597,7 @@ class TransitionFromEquationSolverToZeroFinder(Introduce1DFunctionCase):
|
|||
new_equation[2].match_style(equation[2])
|
||||
new_equation.move_to(equation, RIGHT)
|
||||
for tex in equation, new_equation:
|
||||
tex.sort_submobjects_alphabetically()
|
||||
tex.sort_alphabetically()
|
||||
|
||||
self.play(ShowCreation(rect))
|
||||
self.play(FadeOut(rect))
|
||||
|
|
@ -636,7 +636,7 @@ class RewriteEquationWithTeacher(AltTeacherStudentsScene):
|
|||
TexMobject("x^2", "-", "2", "=", "0"),
|
||||
)
|
||||
for equation in root_two_equations:
|
||||
equation.sort_submobjects_alphabetically()
|
||||
equation.sort_alphabetically()
|
||||
for part in equation.get_parts_by_tex("text"):
|
||||
part[2:-1].set_color(YELLOW)
|
||||
part[2:-1].scale(0.9)
|
||||
|
|
@ -1425,7 +1425,7 @@ class Rearrange2DEquation(AltTeacherStudentsScene):
|
|||
for equation in equations:
|
||||
equation.set_color_by_tex(g_tex, BLUE)
|
||||
equation.set_color_by_tex(h_tex, YELLOW)
|
||||
equation.sort_submobjects_alphabetically()
|
||||
equation.sort_alphabetically()
|
||||
|
||||
|
||||
self.teacher_holds_up(equations[0])
|
||||
|
|
@ -2937,7 +2937,7 @@ class MentionQAndA(Scene):
|
|||
"Sridhar" : YELLOW,
|
||||
})
|
||||
patreon_logo = VGroup(*PatreonLogo().family_members_with_points())
|
||||
patreon_logo.sort_submobjects()
|
||||
patreon_logo.sort()
|
||||
patreon_logo.replace(title.get_parts_by_tex("Patreon"))
|
||||
patreon_logo.scale(1.3, about_edge = LEFT)
|
||||
patreon_logo.shift(0.5*SMALL_BUFF*DOWN)
|
||||
|
|
|
|||
|
|
@ -3555,7 +3555,7 @@ class PrinciplesOverlay(PiCreatureScene):
|
|||
mark.set_stroke(BLACK, 1)
|
||||
q_marks.next_to(morty, UP)
|
||||
q_marks.shift_onto_screen()
|
||||
q_marks.sort_submobjects(
|
||||
q_marks.sort(
|
||||
lambda p: get_norm(p - morty.get_top())
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1582,12 +1582,12 @@ class VennDiagramProofByContradiction(Scene):
|
|||
)
|
||||
|
||||
B_center = B.target.get_center()
|
||||
photons.sort_submobjects(
|
||||
photons.sort(
|
||||
lambda p : get_norm(p-B_center)
|
||||
)
|
||||
in_B = VGroup(*photons[:85])
|
||||
out_of_B = VGroup(*photons[85:])
|
||||
out_of_B.sort_submobjects(lambda p : np.dot(p, 2*UP+LEFT))
|
||||
out_of_B.sort(lambda p : np.dot(p, 2*UP+LEFT))
|
||||
|
||||
self.play(
|
||||
MoveToTarget(B),
|
||||
|
|
@ -1661,7 +1661,7 @@ class VennDiagramProofByContradiction(Scene):
|
|||
DOWN+RIGHT, buff = SMALL_BUFF
|
||||
)
|
||||
|
||||
in_B.sort_submobjects(
|
||||
in_B.sort(
|
||||
lambda p : get_norm(p - C_center)
|
||||
)
|
||||
in_C = VGroup(*in_B[:-11])
|
||||
|
|
@ -1923,7 +1923,7 @@ class VennDiagramProofByContradiction(Scene):
|
|||
|
||||
def photons_jump_to_A_not_C_region(self):
|
||||
in_C = self.in_C
|
||||
in_C.sort_submobjects(lambda p : np.dot(p, DOWN+RIGHT))
|
||||
in_C.sort(lambda p : np.dot(p, DOWN+RIGHT))
|
||||
movers = VGroup(*self.in_C[:30])
|
||||
for mover in movers:
|
||||
mover.generate_target()
|
||||
|
|
|
|||
|
|
@ -719,7 +719,7 @@ class PointOutVSauce(CheckOutMathologer):
|
|||
logo.to_corner(UP+LEFT)
|
||||
logo.set_stroke(width = 0)
|
||||
logo.set_fill(GREEN)
|
||||
logo.sort_submobjects()
|
||||
logo.sort()
|
||||
return logo
|
||||
|
||||
def get_logo_intro_animation(self, logo):
|
||||
|
|
@ -1569,7 +1569,7 @@ class MakeTwoJewelCaseContinuous(IntroduceStolenNecklaceProblem):
|
|||
left_segment.parts[0],
|
||||
right_segment.parts[1],
|
||||
)
|
||||
emerald_segments.sort_submobjects()
|
||||
emerald_segments.sort()
|
||||
|
||||
self.play(v_lines.shift, segment_width*RIGHT/2)
|
||||
self.play(*[
|
||||
|
|
@ -2158,7 +2158,7 @@ class TotalLengthOfEachJewelEquals(NecklaceDivisionSphereAssociation, ThreeDScen
|
|||
|
||||
def find_fair_division(self):
|
||||
segments, tick_marks = self.necklace
|
||||
segments.sort_submobjects()
|
||||
segments.sort()
|
||||
segment_colors = [
|
||||
segment.get_color()
|
||||
for segment in segments
|
||||
|
|
|
|||
|
|
@ -4889,7 +4889,7 @@ class ShowBitcoinBlockSize(LedgerScene):
|
|||
fill_opacity = 1,
|
||||
)
|
||||
visa_logo[-1].set_color("#faa61a")
|
||||
visa_logo.sort_submobjects()
|
||||
visa_logo.sort()
|
||||
avg_rate = TextMobject("Avg: $1{,}700$/second")
|
||||
max_rate = TextMobject("Max: $>24{,}000$/second")
|
||||
rates = VGroup(avg_rate, max_rate)
|
||||
|
|
|
|||
|
|
@ -487,7 +487,7 @@ class Introduction(MovingCameraScene):
|
|||
stream_lines = StreamLines(
|
||||
div_func, **self.stream_lines_config
|
||||
)
|
||||
stream_lines.shuffle_submobjects()
|
||||
stream_lines.shuffle()
|
||||
div_title = self.get_title("Divergence")
|
||||
|
||||
self.add(div_vector_field)
|
||||
|
|
@ -507,7 +507,7 @@ class Introduction(MovingCameraScene):
|
|||
stream_lines = StreamLines(
|
||||
curl_func, **self.stream_lines_config
|
||||
)
|
||||
stream_lines.shuffle_submobjects()
|
||||
stream_lines.shuffle()
|
||||
curl_title = self.get_title("Curl")
|
||||
|
||||
self.play(
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ class SphereRings(SecondProof):
|
|||
def flash_through_rings(self):
|
||||
rings = self.north_rings.copy()
|
||||
rings.fade(1)
|
||||
rings.sort_submobjects(lambda p: p[2])
|
||||
rings.sort(lambda p: p[2])
|
||||
|
||||
for x in range(8):
|
||||
self.play(LaggedStart(
|
||||
|
|
|
|||
|
|
@ -2929,7 +2929,7 @@ class WriteComplexExponentialExpression(DrawFrequencyPlot):
|
|||
self.play(ghost_dot.move_to, ORIGIN)
|
||||
|
||||
exp_expression[1].add(minus, f)
|
||||
exp_expression[1].sort_submobjects(lambda p : p[0])
|
||||
exp_expression[1].sort(lambda p : p[0])
|
||||
|
||||
self.set_variables_as_attrs(
|
||||
ambient_ghost_dot_movement, ghost_dot,
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class LatticePointScene(Scene):
|
|||
)
|
||||
dot.r_squared = r_squared
|
||||
self.lattice_points.add(dot)
|
||||
self.lattice_points.sort_submobjects(
|
||||
self.lattice_points.sort(
|
||||
lambda p : get_norm(p - self.plane_center)
|
||||
)
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ class LatticePointScene(Scene):
|
|||
|
||||
def get_lattice_points_on_r_squared_circle(self, r_squared):
|
||||
points = VGroup(*[dot for dot in self.lattice_points if dot.r_squared == r_squared])
|
||||
points.sort_submobjects(
|
||||
points.sort(
|
||||
lambda p : angle_of_vector(p-self.plane_center)%(2*np.pi)
|
||||
)
|
||||
return points
|
||||
|
|
@ -573,7 +573,7 @@ class Outline(PiCreatureScene):
|
|||
for b in range(-10, 11)
|
||||
if a**2 + b**2 <= 10**2
|
||||
])
|
||||
lattice_points.sort_submobjects(
|
||||
lattice_points.sort(
|
||||
lambda p : get_norm(p - plane_center)
|
||||
)
|
||||
lattice_group = VGroup(plane, circle, lattice_points)
|
||||
|
|
@ -4173,7 +4173,7 @@ class CountLatticePointsInBigCircle(LatticePointScene):
|
|||
if (x**2 + y**2) > self.max_lattice_point_radius**2
|
||||
if (x**2 + y**2) < new_max**2
|
||||
])
|
||||
new_dots.sort_submobjects(get_norm)
|
||||
new_dots.sort(get_norm)
|
||||
|
||||
self.play(*list(map(ShowCreation, [circle, arrow])))
|
||||
self.play(*list(map(FadeOut, [circle, arrow])))
|
||||
|
|
|
|||
|
|
@ -1017,7 +1017,7 @@ class FeynmanElementaryQuote(Scene):
|
|||
self.add_foreground_mobjects(nothing)
|
||||
self.play(ShowWord(nothing))
|
||||
self.wait(0.2)
|
||||
nothing.sort_submobjects(lambda p: -p[0])
|
||||
nothing.sort(lambda p: -p[0])
|
||||
self.play(LaggedStart(
|
||||
FadeOut, nothing,
|
||||
run_time=1
|
||||
|
|
@ -2600,7 +2600,7 @@ class AngularMomentumArgument(KeplersSecondLaw):
|
|||
get_force_field_func((sun_center, -1))
|
||||
)
|
||||
vector_field.set_fill(opacity=0.8)
|
||||
vector_field.sort_submobjects(
|
||||
vector_field.sort(
|
||||
lambda p: -get_norm(p - sun_center)
|
||||
)
|
||||
|
||||
|
|
@ -4131,7 +4131,7 @@ class ShowSunVectorField(Scene):
|
|||
get_force_field_func((sun_center, -1))
|
||||
)
|
||||
vector_field.set_fill(opacity=0.8)
|
||||
vector_field.sort_submobjects(
|
||||
vector_field.sort(
|
||||
lambda p: -get_norm(p - sun_center)
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1880,7 +1880,7 @@ class EulersFormulaForGeneralPlanarGraph(LightUpNodes, ThreeDScene):
|
|||
|
||||
self.play(FadeOut(self.vertices))
|
||||
self.play(ReplacementTransform(regions, cube, run_time = 2))
|
||||
cube.sort_submobjects(lambda p : -p[2])
|
||||
cube.sort(lambda p : -p[2])
|
||||
self.add(ContinualRotation(cube, axis = UP, in_place = False))
|
||||
self.wait(3)
|
||||
self.play(
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ class ExampleThrees(PiCreatureScene):
|
|||
self.three_mobs = self.get_three_mobs()
|
||||
three_mob = self.three_mobs[0]
|
||||
three_mob_copy = three_mob[1].copy()
|
||||
three_mob_copy.sort_submobjects(lambda p : np.dot(p, DOWN+RIGHT))
|
||||
three_mob_copy.sort(lambda p : np.dot(p, DOWN+RIGHT))
|
||||
|
||||
braces = VGroup(*[Brace(three_mob, v) for v in (LEFT, UP)])
|
||||
brace_labels = VGroup(*[
|
||||
|
|
@ -545,7 +545,7 @@ class WriteAProgram(Scene):
|
|||
three_array = get_organized_images()[3][0]
|
||||
im_mob = ImageMobject(layer_to_image_array(three_array))
|
||||
three = PixelsAsSquares(im_mob)
|
||||
three.sort_submobjects(lambda p : np.dot(p, DOWN+RIGHT))
|
||||
three.sort(lambda p : np.dot(p, DOWN+RIGHT))
|
||||
three.set_height(6)
|
||||
three.next_to(ORIGIN, LEFT)
|
||||
three_rect = SurroundingRectangle(
|
||||
|
|
|
|||
|
|
@ -1914,7 +1914,7 @@ class OrganizeDataIntoMiniBatches(Scene):
|
|||
|
||||
def divide_into_minibatches(self):
|
||||
examples = self.examples
|
||||
examples.sort_submobjects(lambda p : -p[1])
|
||||
examples.sort(lambda p : -p[1])
|
||||
rows = Group(*[
|
||||
Group(*examples[i*self.n_cols:(i+1)*self.n_cols])
|
||||
for i in range(self.n_rows)
|
||||
|
|
@ -1956,7 +1956,7 @@ class OrganizeDataIntoMiniBatches(Scene):
|
|||
buff = SMALL_BUFF
|
||||
)
|
||||
def indicate_row(row):
|
||||
row.sort_submobjects(lambda p : p[0])
|
||||
row.sort(lambda p : p[0])
|
||||
return LaggedStart(
|
||||
ApplyFunction, row,
|
||||
lambda row : (
|
||||
|
|
|
|||
|
|
@ -779,7 +779,7 @@ class EulerAnglesAndGimbal(ShowSeveralQuaternionRotations):
|
|||
)
|
||||
for u in [-1, 1]
|
||||
]))
|
||||
line.sort_submobjects(get_norm)
|
||||
line.sort(get_norm)
|
||||
line.set_shade_in_3d(True)
|
||||
line.set_stroke(YELLOW, 5)
|
||||
line.center()
|
||||
|
|
|
|||
|
|
@ -411,7 +411,7 @@ class RubiksCube(VGroup):
|
|||
# return VGroup(square, back)
|
||||
|
||||
def get_face(self, vect):
|
||||
self.sort_submobjects(lambda p: np.dot(p, vect))
|
||||
self.sort(lambda p: np.dot(p, vect))
|
||||
return self[-(12 + 9):]
|
||||
|
||||
|
||||
|
|
@ -1931,7 +1931,7 @@ class WalkThroughComplexMultiplication(ShowComplexMultiplicationExamples):
|
|||
pair = VGroup(p1, p2)
|
||||
pair.scale(0.3)
|
||||
sparkly_plane.add(pair)
|
||||
sparkly_plane.sort_submobjects(
|
||||
sparkly_plane.sort(
|
||||
lambda p: 0.1 * get_norm(p) + random.random()
|
||||
)
|
||||
sparkly_plane.set_color_by_gradient(YELLOW, RED, PINK, BLUE)
|
||||
|
|
|
|||
|
|
@ -942,7 +942,7 @@ class ReframeOnLattice(PiCreatureScene):
|
|||
for x in range(int(x_min), int(x_max)+1)
|
||||
for y in range(int(y_min), int(y_max)+1)
|
||||
])
|
||||
result.sort_submobjects(lambda p : np.dot(p, UP+RIGHT))
|
||||
result.sort(lambda p : np.dot(p, UP+RIGHT))
|
||||
return result
|
||||
|
||||
def create_pi_creature(self):
|
||||
|
|
@ -1682,7 +1682,7 @@ class VisualizeZSquared(Scene):
|
|||
for x in range(x_min, x_max+1)
|
||||
for y in range(y_min, y_max+1)
|
||||
])
|
||||
dots.sort_submobjects(lambda p : np.dot(p, UP+RIGHT))
|
||||
dots.sort(lambda p : np.dot(p, UP+RIGHT))
|
||||
|
||||
self.add_foreground_mobject(self.coordinate_labels)
|
||||
self.play(LaggedStart(
|
||||
|
|
@ -1906,7 +1906,7 @@ class PointsWeMiss(VisualizeZSquared):
|
|||
)
|
||||
for z in z_list
|
||||
])
|
||||
dots.sort_submobjects(get_norm)
|
||||
dots.sort(get_norm)
|
||||
self.add(dots)
|
||||
self.dots = dots
|
||||
|
||||
|
|
@ -2423,7 +2423,7 @@ class ProjectPointsOntoUnitCircle(DrawRadialLines):
|
|||
def project_all_dots(self):
|
||||
dots = self.dots
|
||||
dots.add(*self.new_dots)
|
||||
dots.sort_submobjects(
|
||||
dots.sort(
|
||||
lambda p : get_norm(p - self.plane_center)
|
||||
)
|
||||
unit_length = self.unit_circle.get_width()/2.0
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ class Diffusion(VMobject):
|
|||
dots.arrange_in_grid(buff=SMALL_BUFF)
|
||||
dots.center()
|
||||
dots.set_height(self.height)
|
||||
dots.sort_submobjects(lambda p: p[0])
|
||||
dots.sort(lambda p: p[0])
|
||||
dots[:len(dots) // 2].set_color(self.colors[0])
|
||||
dots[len(dots) // 2:].set_color(self.colors[1])
|
||||
dots.set_fill(opacity=0.8)
|
||||
|
|
|
|||
|
|
@ -693,7 +693,7 @@ class IntroduceElectricField(PiCreatureScene):
|
|||
)
|
||||
VGroup(*shading_list).set_color_by_gradient(*self.vector_field_colors)
|
||||
result.set_fill(opacity = 0.75)
|
||||
result.sort_submobjects(get_norm)
|
||||
result.sort(get_norm)
|
||||
|
||||
return result
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue