Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Renamed gradient_highlight to set_color_by_gradient

Grant Sanderson380a87accaab
diff --git a/active_projects/eop/combinations.py b/active_projects/eop/combinations.py
index 3da82f0f9..ab423a2e0 100644
--- a/active_projects/eop/combinations.py
+++ b/active_projects/eop/combinations.py
@@ -3006,7 +3006,7 @@ class HowToComputeNChooseK(ChooseThreeFromFive):
for n0 in range(n, n-k, -1)
])
choice_counts.arrange_submobjects(RIGHT, buff = SMALL_BUFF)
- choice_counts.gradient_highlight(*self.line_colors)
+ choice_counts.set_color_by_gradient(*self.line_colors)
choice_counts.next_to(people_braces, DOWN)
return choice_counts
@@ -3038,7 +3038,7 @@ class HowToComputeNChooseK(ChooseThreeFromFive):
)
])
for mob in place_words, lines:
- mob.gradient_highlight(*self.line_colors)
+ mob.set_color_by_gradient(*self.line_colors)
for word, line in zip(place_words, lines):
word.next_to(line, DOWN, SMALL_BUFF)
@@ -3068,7 +3068,7 @@ class NineChooseFourExample(HowToComputeNChooseK):
chr(ord('A') + i )
for i in range(self.n)
]))
- self.people.gradient_highlight(BLUE, YELLOW)
+ self.people.set_color_by_gradient(BLUE, YELLOW)
self.names = self.people
self.people.to_edge(UP, buff = LARGE_BUFF + MED_SMALL_BUFF)
lb, rb = braces = TextMobject("\\{\\}")
@@ -3212,7 +3212,7 @@ class WeirdKindOfCancelation(TeacherStudentsScene):
)
top_numbers, ordered, triplets, frac_line, bottom_numbers, orderings = fraction
for mob in top_numbers, bottom_numbers:
- mob.gradient_highlight(GREEN, YELLOW)
+ mob.set_color_by_gradient(GREEN, YELLOW)
fraction.next_to(self.teacher, UP+LEFT)
names = VGroup(*map(TextMobject, [
@@ -3512,7 +3512,7 @@ class AskWhyTheyAreCalledBinomial(TeacherStudentsScene):
pascals = PascalsTraingle(n_rows = 6)
pascals.scale_to_fit_height(3)
pascals.to_corner(UP+LEFT, buff = MED_SMALL_BUFF)
- pascals.gradient_highlight(BLUE, YELLOW)
+ pascals.set_color_by_gradient(BLUE, YELLOW)
binomial_word = TextMobject(
"Bi", "nomials",
diff --git a/active_projects/eop/independence.py b/active_projects/eop/independence.py
index da8309099..9a4ef5da8 100644
--- a/active_projects/eop/independence.py
+++ b/active_projects/eop/independence.py
@@ -1945,7 +1945,7 @@ class ShowTrueDistribution(PiCreatureScene):
for arrow in arrows[1:3]:
arrow.rotate_in_place(np.pi)
arrow.set_color(RED)
- arrows.gradient_highlight(BLUE, YELLOW)
+ arrows.set_color_by_gradient(BLUE, YELLOW)
self.add(chart)
self.play(*map(MoveToTarget, it.chain(bars, old_bars)))
@@ -2825,14 +2825,14 @@ class GeneralBinomialDistributionValues(Scene):
ten_choose_k.stretch(0.8, 0)
ten_choose_k.next_to(mob, DOWN)
ten_choose_ks.add(ten_choose_k)
- ten_choose_ks.gradient_highlight(BLUE, YELLOW)
+ ten_choose_ks.set_color_by_gradient(BLUE, YELLOW)
self.play(
LaggedStart(FadeIn, triangle),
FadeOut(self.shown_prob)
)
self.play(
- last_row.gradient_highlight, BLUE, YELLOW,
+ last_row.set_color_by_gradient, BLUE, YELLOW,
Write(ten_choose_ks, run_time = 2)
)
self.wait()
diff --git a/mobject/mobject.py b/mobject/mobject.py
index 29dee8c9c..9a5bc4648 100644
--- a/mobject/mobject.py
+++ b/mobject/mobject.py
@@ -485,7 +485,7 @@ class Mobject(Container):
self.color = color
return self
- def gradient_highlight(self, *colors):
+ def set_color_by_gradient(self, *colors):
self.submobject_gradient_highlight(*colors)
return self
diff --git a/mobject/point_cloud_mobject.py b/mobject/point_cloud_mobject.py
index cd9d40f17..0d4aa06bf 100644
--- a/mobject/point_cloud_mobject.py
+++ b/mobject/point_cloud_mobject.py
@@ -38,8 +38,8 @@ class PMobject(Mobject):
self.color = color
return self
- # def gradient_highlight(self, start_color, end_color):
- def gradient_highlight(self, *colors):
+ # def set_color_by_gradient(self, start_color, end_color):
+ def set_color_by_gradient(self, *colors):
self.rgbas = np.array(map(
color_to_rgba,
color_gradient(colors, len(self.points))
diff --git a/old_projects/256.py b/old_projects/256.py
index 357a8435f..3b42fdbcd 100644
--- a/old_projects/256.py
+++ b/old_projects/256.py
@@ -40,7 +40,7 @@ def get_google_logo():
"#4885ed", "#db3236", "#f4c20d", "#3cba54"
]
colors = [red, yellow, blue, green, red, blue]
- result.gradient_highlight(*colors)
+ result.set_color_by_gradient(*colors)
return result
class LastVideo(Scene):
@@ -291,7 +291,7 @@ class MainBreakdown(Scene):
])
paths.add(path)
paths.set_stroke(width = 3)
- paths.gradient_highlight(BLUE, GREEN)
+ paths.set_color_by_gradient(BLUE, GREEN)
def get_passing_flash():
return ShowPassingFlash(
paths,
@@ -745,7 +745,7 @@ class StateOfBitcoin(TeacherStudentsScene):
fill_color = WHITE,
)
random.shuffle(circuit.submobjects)
- circuit.gradient_highlight(WHITE, GREY)
+ circuit.set_color_by_gradient(WHITE, GREY)
circuit.next_to(asic, RIGHT)
asic_rate = TextMobject("Trillion hashes/sec")
asic_rate.next_to(asic, DOWN, MED_LARGE_BUFF)
diff --git a/old_projects/WindingNumber_G.py b/old_projects/WindingNumber_G.py
index 83a008ddd..cde49ccf4 100644
--- a/old_projects/WindingNumber_G.py
+++ b/old_projects/WindingNumber_G.py
@@ -109,8 +109,8 @@ class IntroSceneWrapper(PiCreatureScene):
rainbow_solver1 = solver.copy()
rainbow_solver2 = solver.copy()
colors = ["RED", "ORANGE", "YELLOW", "GREEN", BLUE, "PURPLE", PINK]
- rainbow_solver1.gradient_highlight(*colors)
- rainbow_solver2.gradient_highlight(*reversed(colors))
+ rainbow_solver1.set_color_by_gradient(*colors)
+ rainbow_solver2.set_color_by_gradient(*reversed(colors))
xy_equation = TexMobject("""
@@ -1133,8 +1133,8 @@ class TwoDScreenInOurThreeDWorld(AltTeacherStudentsScene, ThreeDScene):
))
dots.add(dot)
dots_target.add(dot.target)
- dots.gradient_highlight(YELLOW, RED)
- dots_target.gradient_highlight(YELLOW, RED)
+ dots.set_color_by_gradient(YELLOW, RED)
+ dots_target.set_color_by_gradient(YELLOW, RED)
self.play(
self.teacher.change, "raise_right_hand",
@@ -1771,7 +1771,7 @@ class HypothesisAboutFullyColoredBoundary(ColorMappedObjectsScene):
s = hypothesis[1].get_tex_string()
s = filter(lambda c : c not in string.whitespace, s)
n = s.index("colors")
- hypothesis[1][n:n+len("colors")].gradient_highlight(
+ hypothesis[1][n:n+len("colors")].set_color_by_gradient(
# RED, GOLD_E, YELLOW, GREEN, BLUE, PINK,
BLUE, PINK, YELLOW,
)
diff --git a/old_projects/basel/basel2.py b/old_projects/basel/basel2.py
index 08bac0c45..c443ba683 100644
--- a/old_projects/basel/basel2.py
+++ b/old_projects/basel/basel2.py
@@ -3864,7 +3864,7 @@ class ThinkBackToHowAmazingThisIs(ThreeDScene):
p_term.next_to(number_line.number_to_point(n), UP, LARGE_BUFF)
n_term.next_to(number_line.number_to_point(-n), UP, LARGE_BUFF)
term_mobjects.add(group)
- term_mobjects.gradient_highlight(BLUE, YELLOW)
+ term_mobjects.set_color_by_gradient(BLUE, YELLOW)
plusses = VGroup(*[
VGroup(*[
TexMobject("+").next_to(
diff --git a/old_projects/brachistochrone/curves.py b/old_projects/brachistochrone/curves.py
index 91c8da122..3f3b163ec 100644
--- a/old_projects/brachistochrone/curves.py
+++ b/old_projects/brachistochrone/curves.py
@@ -126,7 +126,7 @@ class SlideWordDownCycloid(Animation):
class BrachistochroneWordSliding(Scene):
def construct(self):
anim = SlideWordDownCycloid("Brachistochrone")
- anim.path.gradient_highlight(WHITE, BLUE_E)
+ anim.path.set_color_by_gradient(WHITE, BLUE_E)
self.play(ShowCreation(anim.path))
self.play(anim)
self.wait()
@@ -332,7 +332,7 @@ class NotTheCircle(PathSlidingScene):
end = self.point_b.get_center()
angle = 2*np.pi/3
path = Arc(angle, radius = 3)
- path.gradient_highlight(RED_D, WHITE)
+ path.set_color_by_gradient(RED_D, WHITE)
radius = Line(ORIGIN, path.points[0])
randy = Randolph()
randy.scale(RANDY_SCALE_FACTOR)
diff --git a/old_projects/brachistochrone/graveyard.py b/old_projects/brachistochrone/graveyard.py
index a3e5bf2c0..76ea241b3 100644
--- a/old_projects/brachistochrone/graveyard.py
+++ b/old_projects/brachistochrone/graveyard.py
@@ -78,7 +78,7 @@ class MultilayeredGlass(PhotonScene, ZoomedScene):
)
glass.sort_points(lambda p : -p[1])
glass.shift((self.top-glass.get_top()[1])*UP)
- glass.gradient_highlight(self.top_color, self.bottom_color)
+ glass.set_color_by_gradient(self.top_color, self.bottom_color)
return glass
def generate_layer_info(self):
diff --git a/old_projects/brachistochrone/multilayered.py b/old_projects/brachistochrone/multilayered.py
index fd2fe63ad..34dfec663 100644
--- a/old_projects/brachistochrone/multilayered.py
+++ b/old_projects/brachistochrone/multilayered.py
@@ -79,7 +79,7 @@ class MultilayeredScene(Scene):
height = self.total_glass_height,
)
result.sort_points(lambda p : -p[1])
- result.gradient_highlight(self.top_color, self.bottom_color)
+ result.set_color_by_gradient(self.top_color, self.bottom_color)
result.shift(self.top-result.get_top())
return result
diff --git a/old_projects/crypto.py b/old_projects/crypto.py
index 88a55cb49..98c787dae 100644
--- a/old_projects/crypto.py
+++ b/old_projects/crypto.py
@@ -303,7 +303,7 @@ class ListRecentCurrencies(Scene):
EthereumLogo(),
ImageMobject("ripple_logo"),
LitecoinLogo(),
- EthereumLogo().gradient_highlight(GREEN_B, GREEN_D),
+ EthereumLogo().set_color_by_gradient(GREEN_B, GREEN_D),
)
for logo in logos:
logo.scale_to_fit_height(0.75)
@@ -4714,7 +4714,7 @@ class CompareBlockTimes(Scene):
# )
# logo.set_fill(GREEN, 1)
# logo.set_stroke(WHITE, 3)
- # logo.gradient_highlight(GREEN_B, GREEN_D)
+ # logo.set_color_by_gradient(GREEN_B, GREEN_D)
# logo.scale_to_fit_width(1)
# logo.center()
# self.add(SurroundingRectangle(logo))
@@ -5268,7 +5268,7 @@ class Thumbnail(DistributedBlockChainScene):
block_chain = self.get_block_chain()
block_chain.arrows.set_color(RED)
- block_chain.blocks.gradient_highlight(BLUE, GREEN)
+ block_chain.blocks.set_color_by_gradient(BLUE, GREEN)
block_chain.scale_to_fit_width(FRAME_WIDTH-1)
block_chain.set_stroke(width = 12)
self.add(block_chain)
diff --git a/old_projects/efvgt.py b/old_projects/efvgt.py
index dd9a5ba3c..df8aac70c 100644
--- a/old_projects/efvgt.py
+++ b/old_projects/efvgt.py
@@ -793,7 +793,7 @@ class GroupOfCubeSymmetries(ThreeDScene):
def get_cube(self):
cube = Cube(fill_opacity = self.cube_opacity)
- cube.gradient_highlight(*self.cube_colors)
+ cube.set_color_by_gradient(*self.cube_colors)
if self.put_randy_on_cube:
randy = Randolph(mode = "pondering")
# randy.pupils.shift(0.01*OUT)
diff --git a/old_projects/eoc/chapter2.py b/old_projects/eoc/chapter2.py
index db713b4d8..38ddcbe6f 100644
--- a/old_projects/eoc/chapter2.py
+++ b/old_projects/eoc/chapter2.py
@@ -171,7 +171,7 @@ class Introduction(TeacherStudentsScene):
)
self.play(FadeIn(clock))
self.play(
- change.gradient_highlight, BLUE, YELLOW,
+ change.set_color_by_gradient, BLUE, YELLOW,
GrowFromCenter(change_brace),
Write(change_description),
get_clock_anim()
@@ -2595,7 +2595,7 @@ class Thumbnail(SecantLineToTangentLine):
title.scale_to_fit_width(FRAME_WIDTH-1)
title.to_edge(UP)
title.add_background_rectangle()
- title.gradient_highlight(GREEN, YELLOW)
+ title.set_color_by_gradient(GREEN, YELLOW)
randy = Randolph(mode = "confused")
randy.scale(1.7)
diff --git a/old_projects/eoc/chapter9.py b/old_projects/eoc/chapter9.py
index 5d0f02777..c18844573 100644
--- a/old_projects/eoc/chapter9.py
+++ b/old_projects/eoc/chapter9.py
@@ -395,7 +395,7 @@ class AverageOfFiniteSet(Scene):
for length in lengths
])
colors = Color(BLUE).range_to(RED, len(lengths))
- lines.gradient_highlight(*colors)
+ lines.set_color_by_gradient(*colors)
lines.arrange_submobjects(RIGHT)
lines.generate_target()
lines.target.arrange_submobjects(RIGHT, buff = 0)
@@ -965,7 +965,7 @@ class IntegralOfSine(FiniteSample):
area_over_width = TexMobject(
"{\\text{Area}", "\\over\\,", "\\text{Width}}", "="
)
- area_over_width.get_part_by_tex("Area").gradient_highlight(
+ area_over_width.get_part_by_tex("Area").set_color_by_gradient(
BLUE, GREEN
)
area_over_width.next_to(self.integral_over_pi[1][0], LEFT)
diff --git a/old_projects/eoc/old_chapter1.py b/old_projects/eoc/old_chapter1.py
index c7d92e6e1..1e4691a4e 100644
--- a/old_projects/eoc/old_chapter1.py
+++ b/old_projects/eoc/old_chapter1.py
@@ -1318,7 +1318,7 @@ class NameDerivative(IntroduceTinyChangeInArea):
fracs.add(frac)
fracs.add(TexMobject("\\cdots \\rightarrow"))
fracs.add(TexMobject("???"))
- fracs[-1].gradient_highlight(self.dR_color, self.outer_ring.get_color())
+ fracs[-1].set_color_by_gradient(self.dR_color, self.outer_ring.get_color())
fracs.arrange_submobjects(RIGHT, buff = MED_LARGE_BUFF)
fracs.to_corner(DOWN+LEFT)
@@ -1709,7 +1709,7 @@ class IntroduceConcentricRings(CircleScene):
self.get_ring(r, self.dR)
for r in np.arange(0, self.radius, self.dR)
])
- rings.gradient_highlight(BLUE_E, GREEN_E)
+ rings.set_color_by_gradient(BLUE_E, GREEN_E)
rings.set_stroke(BLACK, width = 1)
outermost_ring = rings[-1]
dr_line = Line(
@@ -2022,7 +2022,7 @@ class IntroduceConcentricRings(CircleScene):
)
self.wait(2)
self.play(
- self.integral_expression.gradient_highlight, BLUE, GREEN,
+ self.integral_expression.set_color_by_gradient, BLUE, GREEN,
GrowFromCenter(int_brace),
Write(integral_word)
)
@@ -2382,7 +2382,7 @@ class FundamentalTheorem(CircleScene):
self.get_ring(radius = r, dR = self.dR)
for r in np.arange(0, self.radius, self.dR)
])
- rings.gradient_highlight(BLUE_E, GREEN_E)
+ rings.set_color_by_gradient(BLUE_E, GREEN_E)
rings.save_state()
integrand = self.integral_terms[1][1]
for ring in rings:
@@ -2471,7 +2471,7 @@ class CalculusInANutshell(CircleScene):
for ring in rings:
ring.add(ring.copy().rotate(np.pi))
for mob in calculus, rings:
- mob.gradient_highlight(BLUE, GREEN)
+ mob.set_color_by_gradient(BLUE, GREEN)
rings.set_stroke(width = 0)
self.play(Write(calculus))
diff --git a/old_projects/eola/chapter10.py b/old_projects/eola/chapter10.py
index b6d67b356..a4001770d 100644
--- a/old_projects/eola/chapter10.py
+++ b/old_projects/eola/chapter10.py
@@ -332,7 +332,7 @@ class AllXAxisVectorsAreEigenvectors(ExampleTranformationScene):
for x in reversed(range(1, int(FRAME_X_RADIUS)+1))
for u in -1, 1
])
- vectors.gradient_highlight(YELLOW, X_COLOR)
+ vectors.set_color_by_gradient(YELLOW, X_COLOR)
self.play(ShowCreation(vectors))
self.wait()
self.apply_transposed_matrix(self.t_matrix, path_arc = 0)
@@ -383,7 +383,7 @@ class FullSneakyEigenspace(ExampleTranformationScene):
for x in reversed(np.arange(0.5, 5, 0.5))
for u in -1, 1
])
- vectors.gradient_highlight(MAROON_B, YELLOW)
+ vectors.set_color_by_gradient(MAROON_B, YELLOW)
words = TextMobject("Stretch by 2")
words.add_background_rectangle()
words.next_to(ORIGIN, DOWN+LEFT, buff = MED_SMALL_BUFF)
@@ -414,14 +414,14 @@ class NameEigenvectorsAndEigenvalues(ExampleTranformationScene):
for x in range(int(FRAME_X_RADIUS)+1, 0, -1)
for u in -1, 1
])
- x_vectors.gradient_highlight(YELLOW, X_COLOR)
+ x_vectors.set_color_by_gradient(YELLOW, X_COLOR)
self.remove(x_vectors)
sneak_vectors = VGroup(*[
self.add_vector(u*x*(LEFT+UP), animate = False)
for x in np.arange(int(FRAME_Y_RADIUS), 0, -0.5)
for u in -1, 1
])
- sneak_vectors.gradient_highlight(MAROON_B, YELLOW)
+ sneak_vectors.set_color_by_gradient(MAROON_B, YELLOW)
self.remove(sneak_vectors)
x_words = TextMobject("Stretched by 3")
@@ -807,7 +807,7 @@ class SymbolicEigenvectors(Scene):
TexMobject("?").replace(entry)
for entry in matrix.get_entries()
])
- q_marks.gradient_highlight(X_COLOR, Y_COLOR, Z_COLOR)
+ q_marks.set_color_by_gradient(X_COLOR, Y_COLOR, Z_COLOR)
diag_entries = VGroup(*[
matrix.get_mob_matrix()[i,i]
for i in range(3)
@@ -1465,7 +1465,7 @@ class RevisitExampleTransformation(ExampleTranformationScene):
for x in range(4, 0, -1)
for u in -1, 1
])
- vectors.gradient_highlight(MAROON_B, YELLOW)
+ vectors.set_color_by_gradient(MAROON_B, YELLOW)
vectors.save_state()
self.play(
ShowCreation(
@@ -1658,7 +1658,7 @@ class ShearExample(RevisitExampleTransformation):
for x in range(int(FRAME_X_RADIUS)+1, 0, -1)
for u in -1, 1
])
- vectors.gradient_highlight(YELLOW, X_COLOR)
+ vectors.set_color_by_gradient(YELLOW, X_COLOR)
words = VGroup(
TextMobject("Eigenvectors"),
TextMobject("with eigenvalue", "1")
@@ -2135,8 +2135,8 @@ class ChangeToEigenBasis(ExampleTranformationScene):
])
for vect, num in (RIGHT, 7), (UP+LEFT, 4)
]
- x_vectors.gradient_highlight(YELLOW, X_COLOR)
- v_vectors.gradient_highlight(MAROON_B, YELLOW)
+ x_vectors.set_color_by_gradient(YELLOW, X_COLOR)
+ v_vectors.set_color_by_gradient(MAROON_B, YELLOW)
self.remove(x_vectors, v_vectors)
self.play(ShowCreation(x_vectors, run_time = 2))
self.play(ShowCreation(v_vectors, run_time = 2))
diff --git a/old_projects/eola/chapter11.py b/old_projects/eola/chapter11.py
index e6b11bc97..e33f4defc 100644
--- a/old_projects/eola/chapter11.py
+++ b/old_projects/eola/chapter11.py
@@ -175,7 +175,7 @@ class WhatIsA2DVector(LinearTransformationScene):
group.scale_to_fit_height(coords.get_height())
group.next_to(student.arrow, RIGHT)
student.q_marks = TexMobject("???")
- student.q_marks.gradient_highlight(BLUE, YELLOW)
+ student.q_marks.set_color_by_gradient(BLUE, YELLOW)
student.q_marks.next_to(student.arrow, LEFT)
anims += [
Write(student.q_marks),
@@ -286,7 +286,7 @@ class HyperCube(VMobject):
continue
self.add(Line(project(a1), project(a2)))
self.pose_at_angle()
- self.gradient_highlight(self.color, self.color2)
+ self.set_color_by_gradient(self.color, self.color2)
class AskAbout4DPhysicsStudent(Scene):
def construct(self):
@@ -527,7 +527,7 @@ class DeterminantAndEigenvectorDontCare(LinearTransformationScene):
for x in range(7, 0, -1)
for u in -1, 1
])
- vectors.gradient_highlight(MAROON_A, MAROON_C)
+ vectors.set_color_by_gradient(MAROON_A, MAROON_C)
result += list(vectors)
return result
@@ -844,7 +844,7 @@ class ScaleVectorByCoordinates(Scene):
def construct(self):
two, dot, equals = TexMobject("2 \\cdot =")
v1 = Matrix(list("xyz"))
- v1.get_entries().gradient_highlight(X_COLOR, Y_COLOR, Z_COLOR)
+ v1.get_entries().set_color_by_gradient(X_COLOR, Y_COLOR, Z_COLOR)
v2 = v1.copy()
two_targets = VGroup(*[
two.copy().next_to(entry, LEFT)
@@ -942,7 +942,7 @@ class FromVectorsToFunctions(VectorScene):
"Eigen-everything",
]
])
- words.gradient_highlight(BLUE_B, BLUE_D)
+ words.set_color_by_gradient(BLUE_B, BLUE_D)
words.arrange_submobjects(DOWN, aligned_edge = LEFT)
words.to_corner(UP+LEFT)
self.play(FadeIn(
@@ -1442,7 +1442,7 @@ class PolynomialsHaveArbitrarilyLargeDegree(Scene):
"3x^{\\left(10^{100}\\right)}",
"\\vdots"
]))
- polys.gradient_highlight(BLUE_B, BLUE_D)
+ polys.set_color_by_gradient(BLUE_B, BLUE_D)
polys.arrange_submobjects(DOWN, buff = MED_LARGE_BUFF)
polys.scale(1.3)
@@ -1548,7 +1548,7 @@ class IntroducePolynomialSpace(Scene):
TexMobject("x^{1{,}000{,}000{,}000}+1"),
TexMobject("\\vdots"),
)
- polys.gradient_highlight(BLUE_B, BLUE_D)
+ polys.set_color_by_gradient(BLUE_B, BLUE_D)
polys.arrange_submobjects(DOWN, buff = MED_SMALL_BUFF)
polys.next_to(cloud.get_top(), DOWN, buff = MED_LARGE_BUFF)
@@ -1962,7 +1962,7 @@ class CompareTermsInLinearAlgebraToFunction(Scene):
concepts.arrange_submobjects(DOWN, buff = MED_LARGE_BUFF, aligned_edge = LEFT)
concepts.next_to(h_line, DOWN, buff = LARGE_BUFF)
concepts.shift(vect*FRAME_X_RADIUS/2)
- concepts.gradient_highlight(YELLOW_B, YELLOW_C)
+ concepts.set_color_by_gradient(YELLOW_B, YELLOW_C)
for concept in concepts:
self.play(Write(concept, run_time = 1))
@@ -2083,7 +2083,7 @@ class ShowVectorSpaces(Scene):
np.linspace(0, 6, n_vectors)
)
])
- vectors.gradient_highlight(YELLOW, MAROON_B)
+ vectors.set_color_by_gradient(YELLOW, MAROON_B)
return vectors
def get_arrays(self):
@@ -2098,7 +2098,7 @@ class ShowVectorSpaces(Scene):
subgroup.arrange_submobjects(DOWN, buff = MED_SMALL_BUFF)
arrays.arrange_submobjects(RIGHT)
arrays.scale(0.7)
- arrays.gradient_highlight(YELLOW, MAROON_B)
+ arrays.set_color_by_gradient(YELLOW, MAROON_B)
return arrays
def get_functions(self):
@@ -2114,7 +2114,7 @@ class ShowVectorSpaces(Scene):
])
functions.stretch_to_fit_width(FRAME_X_RADIUS/2.)
functions.stretch_to_fit_height(6)
- functions.gradient_highlight(YELLOW, MAROON_B)
+ functions.set_color_by_gradient(YELLOW, MAROON_B)
functions.center()
return VGroup(axes, functions)
@@ -2513,7 +2513,7 @@ class WhatIsThree(Scene):
pass
elif isinstance(group[0], Vector):
group.arrange_submobjects(RIGHT)
- group.gradient_highlight(YELLOW, MAROON_B)
+ group.set_color_by_gradient(YELLOW, MAROON_B)
else:
m1, m2, m3 = group
m2.next_to(m1, buff = MED_SMALL_BUFF)
diff --git a/old_projects/eola/chapter7.py b/old_projects/eola/chapter7.py
index ccd64a437..1b08ea1b9 100644
--- a/old_projects/eola/chapter7.py
+++ b/old_projects/eola/chapter7.py
@@ -686,7 +686,7 @@ class LurkingQuestion(TeacherStudentsScene):
answer comes from""",
"duality"
)
- answer[-1].gradient_highlight(BLUE, YELLOW)
+ answer[-1].set_color_by_gradient(BLUE, YELLOW)
self.teacher_says(answer)
self.random_blink(2)
self.teacher_thinks("")
@@ -1115,7 +1115,7 @@ class FollowVectorViaCoordinates(TwoDToOneDScene):
def construct(self):
v = Vector(self.v_coords)
array = Matrix(self.v_coords if self.concrete else self.written_v_coords)
- array.get_entries().gradient_highlight(X_COLOR, Y_COLOR)
+ array.get_entries().set_color_by_gradient(X_COLOR, Y_COLOR)
array.add_to_back(BackgroundRectangle(array))
v_label = TexMobject("\\vec{\\textbf{v}}", "=")
v_label[0].set_color(YELLOW)
@@ -1524,7 +1524,7 @@ class ProjectOntoUnitVectorNumberline(VectorScene):
Vector(x*RIGHT + y*UP)
for x, y in zip(x_vals, y_vals)
])
- vectors.gradient_highlight(PINK, MAROON_B)
+ vectors.set_color_by_gradient(PINK, MAROON_B)
return vectors
def get_dots(self, vectors):
@@ -2133,7 +2133,7 @@ class IsntThisBeautiful(TeacherStudentsScene):
duality_words = TextMobject(
"It's called", "duality"
)
- duality_words[1].gradient_highlight(BLUE, YELLOW)
+ duality_words[1].set_color_by_gradient(BLUE, YELLOW)
self.teacher_says(duality_words)
self.random_blink()
@@ -2151,10 +2151,10 @@ class RememberGraphDuality(Scene):
class LooseDualityDescription(Scene):
def construct(self):
duality = TextMobject("Duality")
- duality.gradient_highlight(BLUE, YELLOW)
+ duality.set_color_by_gradient(BLUE, YELLOW)
arrow = TexMobject("\\Leftrightarrow")
words = TextMobject("Natural-but-surprising", "correspondence")
- words[1].gradient_highlight(BLUE, YELLOW)
+ words[1].set_color_by_gradient(BLUE, YELLOW)
VGroup(duality, arrow, words).arrange_submobjects(buff = MED_SMALL_BUFF)
self.add(duality)
diff --git a/old_projects/eola/chapter8.py b/old_projects/eola/chapter8.py
index 64bc294ae..322b69631 100644
--- a/old_projects/eola/chapter8.py
+++ b/old_projects/eola/chapter8.py
@@ -899,7 +899,7 @@ class Define2dCrossProduct(LinearTransformationScene):
self.wait()
pm = VGroup(*map(TexMobject, ["+", "-"]))
- pm.gradient_highlight(GREEN, RED)
+ pm.set_color_by_gradient(GREEN, RED)
pm.arrange_submobjects(DOWN, buff = SMALL_BUFF)
pm.add_to_back(BackgroundRectangle(pm))
pm.next_to(area_words[0], LEFT, aligned_edge = DOWN)
@@ -1649,7 +1649,7 @@ class ThereIsAReason(TeacherStudentsScene):
class RememberDuality(TeacherStudentsScene):
def construct(self):
words = TextMobject("Remember ", "duality", "?", arg_separator = "")
- words[1].gradient_highlight(BLUE, YELLOW)
+ words[1].set_color_by_gradient(BLUE, YELLOW)
self.teacher_says(words, target_mode = "sassy")
self.random_blink(2)
diff --git a/old_projects/eola/chapter8p2.py b/old_projects/eola/chapter8p2.py
index 6ba598522..1672f076a 100644
--- a/old_projects/eola/chapter8p2.py
+++ b/old_projects/eola/chapter8p2.py
@@ -201,7 +201,7 @@ class Prerequisites(Scene):
class DualityReview(TeacherStudentsScene):
def construct(self):
words = TextMobject("Quick", "duality", "review")
- words[1].gradient_highlight(BLUE, YELLOW)
+ words[1].set_color_by_gradient(BLUE, YELLOW)
self.teacher_says(words, target_mode = "surprised")
self.change_student_modes("pondering")
self.random_blink(2)
@@ -219,7 +219,7 @@ class DotProductToTransformSymbol(Scene):
matrix.set_color_columns(X_COLOR, Y_COLOR)
vector.set_color_columns(YELLOW)
_input = Matrix(["x", "y"])
- _input.get_entries().gradient_highlight(X_COLOR, Y_COLOR)
+ _input.get_entries().set_color_by_gradient(X_COLOR, Y_COLOR)
left_input, right_input = [_input.copy() for x in range(2)]
dot, equals = map(TexMobject, ["\\cdot", "="])
equation = VGroup(
@@ -284,7 +284,7 @@ class MathematicalWild(Scene):
vector = Vector([1, 2])
vector.move_to(randy.get_corner(UP+LEFT), aligned_edge = DOWN+LEFT)
dual_words = TextMobject("Dual vector")
- dual_words.gradient_highlight(BLUE, YELLOW)
+ dual_words.set_color_by_gradient(BLUE, YELLOW)
dual_words.next_to(vector, LEFT)
self.add(randy)
@@ -331,7 +331,7 @@ class ThreeStepPlan(Scene):
linear, transformation = steps[0][1:1+2]
steps[0].set_color_by_tex(v_text, V_COLOR)
steps[0].set_color_by_tex(w_text, W_COLOR)
- steps[1][1].gradient_highlight(BLUE, YELLOW)
+ steps[1][1].set_color_by_gradient(BLUE, YELLOW)
steps[2].set_color_by_tex(cross_text, P_COLOR)
VGroup(*steps).arrange_submobjects(
DOWN, aligned_edge = LEFT, buff = LARGE_BUFF
@@ -563,7 +563,7 @@ class DefineDualTransform(Scene):
colors = [X_COLOR, Y_COLOR, Z_COLOR]
q_marks = VGroup(*map(TextMobject, "???"))
q_marks.scale(2)
- q_marks.gradient_highlight(*colors)
+ q_marks.set_color_by_gradient(*colors)
title = VGroup(TextMobject("This function is linear"))
title.set_color(GREEN)
diff --git a/old_projects/eola/chapter9.py b/old_projects/eola/chapter9.py
index b4ff06e6e..de478b939 100644
--- a/old_projects/eola/chapter9.py
+++ b/old_projects/eola/chapter9.py
@@ -837,7 +837,7 @@ class TranslateFromJenny(JenniferScene):
)
self.jenny.coords = Matrix(self.coords)
self.you.coords = Matrix(["?", "?"])
- self.you.coords.get_entries().gradient_highlight(X_COLOR, Y_COLOR)
+ self.you.coords.get_entries().set_color_by_gradient(X_COLOR, Y_COLOR)
for pi in self.jenny, self.you:
pi.bubble = get_small_bubble(pi)
pi.bubble.set_fill(BLACK, opacity = 0.8)
@@ -1556,7 +1556,7 @@ class JennyWatchesRotation(JenniferScene):
self.add_vector(vect)
matrix = Matrix([["?", "?"], ["?", "?"]])
- matrix.get_entries().gradient_highlight(X_COLOR, Y_COLOR)
+ matrix.get_entries().set_color_by_gradient(X_COLOR, Y_COLOR)
jenny.bubble = get_small_bubble(jenny)
jenny.bubble.add_content(matrix)
matrix.scale_in_place(0.8)
@@ -1640,10 +1640,10 @@ class HowToTranslateAMatrix(Scene):
submobs.sort(lambda m1, m2: cmp(m1.get_center()[0], m2.get_center()[0]))
array.submobjects = submobs
her_vector.set_color(MAROON_B)
- cob_matrix.gradient_highlight(BLUE, MAROON_B)
+ cob_matrix.set_color_by_gradient(BLUE, MAROON_B)
transform.set_color_columns(X_COLOR, Y_COLOR)
transform.get_brackets().set_color(BLUE)
- inv_cob.gradient_highlight(MAROON_B, BLUE)
+ inv_cob.set_color_by_gradient(MAROON_B, BLUE)
result.set_color_columns(X_COLOR, Y_COLOR)
result.get_brackets().set_color(MAROON_B)
diff --git a/old_projects/fourier.py b/old_projects/fourier.py
index b024e70c6..b084a45b5 100644
--- a/old_projects/fourier.py
+++ b/old_projects/fourier.py
@@ -639,7 +639,7 @@ class BreakApartSum(Scene):
)
for freq in self.frequencies
])
- pure_graphs.gradient_highlight(BLUE, RED)
+ pure_graphs.set_color_by_gradient(BLUE, RED)
pure_graphs.arrange_submobjects(DOWN, buff = MED_LARGE_BUFF)
h_line = DashedLine(6*LEFT, 6*RIGHT)
@@ -4288,7 +4288,7 @@ class Thumbnail(Scene):
pol_graph.scale_to_fit_height(2)
pol_graphs.add(pol_graph)
pol_graphs.arrange_submobjects(RIGHT, buff = LARGE_BUFF)
- pol_graphs.gradient_highlight(BLUE_C, YELLOW)
+ pol_graphs.set_color_by_gradient(BLUE_C, YELLOW)
pol_graphs.match_width(graph)
pol_graphs.set_stroke(width = 2)
diff --git a/old_projects/fractal_dimension.py b/old_projects/fractal_dimension.py
index e2d15b1f5..7291fc8e9 100644
--- a/old_projects/fractal_dimension.py
+++ b/old_projects/fractal_dimension.py
@@ -220,7 +220,7 @@ class IntroduceVonKochCurve(Scene):
(np.sqrt(3)/6)*width*UP, DOWN
)
curve.rotate(-index*2*np.pi/3)
- curves.gradient_highlight(BLUE, WHITE, BLUE)
+ curves.set_color_by_gradient(BLUE, WHITE, BLUE)
return curves
@@ -244,7 +244,7 @@ class IntroduceVonKochCurve(Scene):
)
larger_curve.replace(curve)
larger_curve.scale(3, about_point = curve.get_corner(DOWN+LEFT))
- larger_curve.gradient_highlight(
+ larger_curve.set_color_by_gradient(
curve[0].get_color(),
curve[-1].get_color(),
)
@@ -504,7 +504,7 @@ class ShowIdealizations(Scene):
koch_snowflake.next_to(arrow, UP)
koch_snowflake.to_edge(RIGHT)
- VGroup(smooth_britain, britain, koch_snowflake).gradient_highlight(
+ VGroup(smooth_britain, britain, koch_snowflake).set_color_by_gradient(
BLUE_B, BLUE_D
)
@@ -809,7 +809,7 @@ class ImagineShapesAsMetal(FourSelfSimilarShapes):
for shape in shapes:
shape.generate_target()
shape.target.set_color(LIGHT_GREY)
- shapes[-1].target.gradient_highlight(GREY, WHITE)
+ shapes[-1].target.set_color_by_gradient(GREY, WHITE)
for shape, title in zip(shapes, titles):
self.play(
MoveToTarget(title),
@@ -1627,7 +1627,7 @@ class ShowDiskScaling(Scene):
shape.scale_to_fit_width(1.5)
shape.set_stroke(width = 0)
shape.set_fill(opacity = 1)
- shapes.gradient_highlight(BLUE_B, BLUE_E)
+ shapes.set_color_by_gradient(BLUE_B, BLUE_E)
shapes.arrange_submobjects(RIGHT, buff = LARGE_BUFF)
shapes.next_to(title, DOWN)
for shape in shapes:
diff --git a/old_projects/hanoi.py b/old_projects/hanoi.py
index a6be14408..def3569a4 100644
--- a/old_projects/hanoi.py
+++ b/old_projects/hanoi.py
@@ -1000,7 +1000,7 @@ class DecimalCountingAtHundredsScale(CountingScene):
added_zeros = TexMobject("00")
added_zeros.scale(self.num_scale_factor)
added_zeros.next_to(self.number_mob, RIGHT, SMALL_BUFF, aligned_edge = DOWN)
- added_zeros.gradient_highlight(MAROON_B, YELLOW)
+ added_zeros.set_color_by_gradient(MAROON_B, YELLOW)
self.add(added_zeros)
self.increment(run_time_per_anim = 0)
@@ -1450,7 +1450,7 @@ class RecursionTime(Scene):
self.play(
morty.change_mode, "hooray",
Transform(keith, keith_hooray),
- bubble.content.gradient_highlight, BLUE_A, BLUE_E
+ bubble.content.set_color_by_gradient, BLUE_A, BLUE_E
)
self.play(Blink(morty))
self.wait()
@@ -2281,7 +2281,7 @@ class SolveConstrainedByCounting(ConstrainedTowersOfHanoiScene):
for num in range(3**self.num_disks):
ternary_mob = get_ternary_tex_mob(num, self.num_disks)
ternary_mob.scale(self.ternary_mob_scale_factor)
- ternary_mob.gradient_highlight(*self.disk_start_and_end_colors)
+ ternary_mob.set_color_by_gradient(*self.disk_start_and_end_colors)
ternary_mobs.add(ternary_mob)
ternary_mobs.next_to(self.peg_labels, DOWN)
self.ternary_mob_iter = it.cycle(ternary_mobs)
@@ -2323,14 +2323,14 @@ class CompareNumberSystems(Scene):
zero_one.next_to(binary, DOWN, buff = LARGE_BUFF)
zero_one_two = TextMobject("0, 1, 2")
zero_one_two.next_to(ternary, DOWN, buff = LARGE_BUFF)
- zero_one_two.gradient_highlight(BLUE, GREEN)
+ zero_one_two.set_color_by_gradient(BLUE, GREEN)
symbols = [zero_to_nine, zero_one, zero_one_two]
names = ["Digits", "Bits", "Trits?"]
for mob, text in zip(symbols, names):
mob.brace = Brace(mob)
mob.name = mob.brace.get_text(text)
- zero_one_two.name.gradient_highlight(BLUE, GREEN)
+ zero_one_two.name.set_color_by_gradient(BLUE, GREEN)
dots = TexMobject("\\dots")
dots.next_to(zero_one.name, RIGHT, aligned_edge = DOWN, buff = SMALL_BUFF)
@@ -2516,7 +2516,7 @@ class SolveConstrainedWithTernaryCounting(ConstrainedTowersOfHanoiScene):
for trits in ternary_mobs:
trits.align_data(ternary_mobs[0])
- trits.gradient_highlight(*self.disk_start_and_end_colors)
+ trits.set_color_by_gradient(*self.disk_start_and_end_colors)
self.ternary_mob_iter = it.cycle(ternary_mobs)
self.curr_ternary_mob = self.ternary_mob_iter.next().copy()
self.disk_index_iter = it.cycle(
@@ -2833,7 +2833,7 @@ class ShowSomeGraph(Scene):
self.play(Write(title))
for mob in nodes, edges:
- mob.gradient_highlight(YELLOW, MAROON_B)
+ mob.set_color_by_gradient(YELLOW, MAROON_B)
self.play(ShowCreation(
mob,
submobject_mode = "lagged_start",
@@ -2868,7 +2868,7 @@ class SierpinskiGraphScene(Scene):
def initialize_nodes(self):
circles = self.get_node_circles(self.num_disks)
- circles.gradient_highlight(self.start_color, self.end_color)
+ circles.set_color_by_gradient(self.start_color, self.end_color)
circles.set_fill(BLACK, opacity = 0.7)
circles.set_stroke(width = self.graph_stroke_width)
@@ -3338,7 +3338,7 @@ class ShowSierpinskiCurvesOfIncreasingOrder(Scene):
n3.get_center(),
])
path.add(segment)
- path.gradient_highlight(
+ path.set_color_by_gradient(
graph_scene.start_color,
graph_scene.end_color,
)
@@ -3378,7 +3378,7 @@ class Part1Thumbnail(Scene):
binary = TexMobject("01011")
binary.set_color_by_tex("0", GREEN)
binary.set_color_by_tex("1", BLUE)
- binary.gradient_highlight(GREEN, RED)
+ binary.set_color_by_gradient(GREEN, RED)
binary.add_background_rectangle()
binary.background_rectangle.set_fill(opacity = 0.5)
# binary.set_fill(opacity = 0.5)
diff --git a/old_projects/highD.py b/old_projects/highD.py
index e2d6bc3ff..327fe3c41 100644
--- a/old_projects/highD.py
+++ b/old_projects/highD.py
@@ -93,7 +93,7 @@ class Slider(NumberLine):
for u in [-1, 1]
])
self.real_estate_ticks.set_stroke(width = 3)
- self.real_estate_ticks.gradient_highlight(*colors)
+ self.real_estate_ticks.set_color_by_gradient(*colors)
self.add(self.real_estate_ticks)
self.add(self.dial)
return self.real_estate_ticks
diff --git a/old_projects/hilbert/section1.py b/old_projects/hilbert/section1.py
index 16d9234c0..b0747c6c2 100644
--- a/old_projects/hilbert/section1.py
+++ b/old_projects/hilbert/section1.py
@@ -422,7 +422,7 @@ class ListenToAllPixels(Scene):
freq_line = get_freq_line()
freq_line.sort_points(lambda p : p[0])
red, blue = Color(RED), Color(BLUE)
- freq_line.gradient_highlight(red, blue)
+ freq_line.set_color_by_gradient(red, blue)
colors = [
Color(rgb = interpolate(
@@ -452,7 +452,7 @@ class ListenToAllPixels(Scene):
self.add(grid)
self.wait()
self.play(DelayByOrder(ApplyMethod(
- grid.gradient_highlight, red, blue
+ grid.set_color_by_gradient, red, blue
)))
self.play(Transform(grid, freq_line))
self.wait()
@@ -611,7 +611,7 @@ class WeaveLineThroughPixels(Scene):
curve = HilbertCurve(order = order)
line = Line(5*LEFT, 5*RIGHT)
for mob in curve, line:
- mob.gradient_highlight(start_color, end_color)
+ mob.set_color_by_gradient(start_color, end_color)
freq_line = get_freq_line()
freq_line.replace(line, stretch = True)
@@ -794,7 +794,7 @@ class Order2PseudoHilbertCurve(Scene):
naive_curve.add(line, mini_curve)
last_curve = mini_curve
naive_curve.ingest_submobjects()
- naive_curve.gradient_highlight(RED, GREEN)
+ naive_curve.set_color_by_gradient(RED, GREEN)
order_2_curve = HilbertCurve(order = 2)
self.add(words, grid2)
diff --git a/old_projects/hilbert/section2.py b/old_projects/hilbert/section2.py
index 74e1e0905..8ef5b41c8 100644
--- a/old_projects/hilbert/section2.py
+++ b/old_projects/hilbert/section2.py
@@ -51,7 +51,7 @@ def get_time_line():
numbers_with_elongated_ticks = range(1700, 2100, 100)
)
time_line.sort_points(lambda p : p[0])
- time_line.gradient_highlight(
+ time_line.set_color_by_gradient(
PeanoCurve.CONFIG["start_color"],
PeanoCurve.CONFIG["end_color"]
)
@@ -177,7 +177,7 @@ class NotPixelatedSpace(Scene):
space_mobject = MobjectFromRegion(space_region, DARK_GREY)
curve = PeanoCurve(order = 5).replace(space_mobject)
line = Line(5*LEFT, 5*RIGHT)
- line.gradient_highlight(curve.start_color, curve.end_color)
+ line.set_color_by_gradient(curve.start_color, curve.end_color)
for mob in grid, space_mobject:
mob.sort_points(np.linalg.norm)
infinitely = TextMobject("Infinitely")
@@ -235,7 +235,7 @@ class HistoryOfDiscover(Scene):
point = time_line.number_to_point(year)
point[1] = 0.2
arrow = Arrow(point+2*vect, point, buff = 0.1)
- arrow.gradient_highlight(curve.start_color, curve.end_color)
+ arrow.set_color_by_gradient(curve.start_color, curve.end_color)
year_mob = TexMobject(str(year))
year_mob.next_to(arrow, vect)
words = TextMobject(text)
diff --git a/old_projects/leibniz.py b/old_projects/leibniz.py
index f854ce2ab..f4faa5495 100644
--- a/old_projects/leibniz.py
+++ b/old_projects/leibniz.py
@@ -841,7 +841,7 @@ class CountLatticePoints(LatticePointScene):
square.copy().move_to(point)
for point in self.lattice_points
])
- squares.gradient_highlight(BLUE_E, GREEN_E)
+ squares.set_color_by_gradient(BLUE_E, GREEN_E)
squares.set_stroke(WHITE, 1)
point_copies = self.lattice_points.copy()
@@ -4156,7 +4156,7 @@ class CountLatticePointsInBigCircle(LatticePointScene):
self.get_circle(radius = np.sqrt(N))
for N in N_range
])
- rings.gradient_highlight(TEAL, GREEN)
+ rings.set_color_by_gradient(TEAL, GREEN)
rings.set_stroke(width = 2)
dot_groups = VGroup(*[
self.get_lattice_points_on_r_squared_circle(N)
@@ -4777,7 +4777,7 @@ class Sponsorship(PiCreatureScene):
logo.center()
logo.set_stroke(width = 0)
logo.set_fill(BLUE_D, 1)
- VGroup(*logo[6:]).gradient_highlight(BLUE_B, BLUE_E)
+ VGroup(*logo[6:]).set_color_by_gradient(BLUE_B, BLUE_E)
logo.next_to(morty.get_corner(UP+LEFT), UP)
url = TextMobject("www.remix.com")
diff --git a/old_projects/mug.py b/old_projects/mug.py
index e2a06e21e..f099ac516 100644
--- a/old_projects/mug.py
+++ b/old_projects/mug.py
@@ -856,7 +856,7 @@ class IntroduceRegions(UtilitiesPuzzleScene):
front_regions = VGroup(*regions[1:])
back_region.set_color(BLUE_E)
- front_regions.gradient_highlight(GREEN_E, MAROON_E)
+ front_regions.set_color_by_gradient(GREEN_E, MAROON_E)
return flat_lines, line_groups, regions
@@ -1551,7 +1551,7 @@ class FiveRegionsFourEdgesEachGraph(Scene):
squares.scale(0.5)
squares.set_stroke(width = 0)
squares.set_fill(opacity = 1)
- squares.gradient_highlight(*self.f_colors)
+ squares.set_color_by_gradient(*self.f_colors)
squares.arrange_submobjects(RIGHT, buff = MED_LARGE_BUFF)
squares.next_to(words, DOWN, LARGE_BUFF)
all_edges = VGroup()
@@ -1612,7 +1612,7 @@ class FiveRegionsFourEdgesEachGraph(Scene):
])
regions.set_stroke(width = 0)
regions.set_fill(opacity = 1)
- regions.gradient_highlight(*self.f_colors)
+ regions.set_color_by_gradient(*self.f_colors)
all_edges = VGroup()
all_movers = VGroup()
@@ -1806,7 +1806,7 @@ class EulersFormulaForGeneralPlanarGraph(LightUpNodes, ThreeDScene):
regions = self.get_cube_faces(points)
regions.set_stroke(width = 0)
regions.set_fill(opacity = 1)
- regions.gradient_highlight(GREEN, RED, BLUE_E)
+ regions.set_color_by_gradient(GREEN, RED, BLUE_E)
regions[-1].set_fill(opacity = 0)
pairs = [
diff --git a/old_projects/nn/part1.py b/old_projects/nn/part1.py
index 13118756f..e7f854f89 100644
--- a/old_projects/nn/part1.py
+++ b/old_projects/nn/part1.py
@@ -1334,7 +1334,7 @@ class IntroduceEachLayer(PreviewMNistNetwork):
q_mark.scale_to_fit_height(0.8*neuron.get_height())
q_mark.move_to(neuron)
q_marks.add(q_mark)
- q_marks.gradient_highlight(BLUE, YELLOW)
+ q_marks.set_color_by_gradient(BLUE, YELLOW)
q_mark = TextMobject("?").scale(4)
q_mark.move_to(hidden_layers)
q_mark.set_color(YELLOW)
diff --git a/old_projects/nn/part2.py b/old_projects/nn/part2.py
index 891b0d0b5..2d76cff2d 100644
--- a/old_projects/nn/part2.py
+++ b/old_projects/nn/part2.py
@@ -590,7 +590,7 @@ class FunctionMinmization(GraphScene):
Dot().move_to(self.input_to_graph_point(x, graph))
for x in range(10)
])
- dots.gradient_highlight(YELLOW, RED)
+ dots.set_color_by_gradient(YELLOW, RED)
def update_dot(dot, dt):
x = self.x_axis.point_to_number(dot.get_center())
@@ -1785,7 +1785,7 @@ class SingleVariableCostFunction(GraphScene):
ContinualUpdateFromFunc(point, update_point),
ContinualUpdateFromFunc(new_ball, update_ball)
]
- balls.gradient_highlight(BLUE, GREEN)
+ balls.set_color_by_gradient(BLUE, GREEN)
self.play(ReplacementTransform(ball, balls))
self.add(*updates)
@@ -3337,7 +3337,7 @@ class SomethingToImproveUpon(PiCreatureScene, TestPerformance):
Dot(line.point_from_proportion(a))
for a in np.linspace(0, 1, 5)
])
- dots.gradient_highlight(BLUE, YELLOW)
+ dots.set_color_by_gradient(BLUE, YELLOW)
path = VGroup(line, dots)
words = TextMobject("This series")
words.next_to(line, DOWN)
diff --git a/old_projects/nn/part3.py b/old_projects/nn/part3.py
index f24e22201..5b14b69b5 100644
--- a/old_projects/nn/part3.py
+++ b/old_projects/nn/part3.py
@@ -4010,7 +4010,7 @@ class GeneralFormulas(SimplestNetworkExample):
SurroundingRectangle(term, buff = 0.5*SMALL_BUFF)
for term in terms
])
- rects.gradient_highlight(GREEN, WHITE, RED)
+ rects.set_color_by_gradient(GREEN, WHITE, RED)
self.play(Transform(
self.z_formula, self.compact_z_formula
diff --git a/old_projects/patreon.py b/old_projects/patreon.py
index 4db3b6596..5f3d59f05 100644
--- a/old_projects/patreon.py
+++ b/old_projects/patreon.py
@@ -163,7 +163,7 @@ class GrowingToDoList(Scene):
]))
lines.scale(0.65)
lines.arrange_submobjects(DOWN, buff = MED_SMALL_BUFF, aligned_edge = LEFT)
- lines.gradient_highlight(BLUE_C, YELLOW)
+ lines.set_color_by_gradient(BLUE_C, YELLOW)
lines.next_to(title, DOWN, buff = LARGE_BUFF/2.)
lines.to_edge(RIGHT)
@@ -409,7 +409,7 @@ class GrowRonaksSierpinski(Scene):
ronaks_sierpinski = VGroup()
for n in range(n_layers):
ronaks_sierpinski.add(self.get_lines_at_layer(n))
- ronaks_sierpinski.gradient_highlight(*self.colors)
+ ronaks_sierpinski.set_color_by_gradient(*self.colors)
ronaks_sierpinski.set_stroke(width = 0)##TODO
return ronaks_sierpinski
diff --git a/old_projects/pi_day.py b/old_projects/pi_day.py
index 38ab05de9..504dc3adc 100644
--- a/old_projects/pi_day.py
+++ b/old_projects/pi_day.py
@@ -798,7 +798,7 @@ class EulerThinking(Scene):
"\\frac{1}{1} + \\frac{1}{4} + \\frac{1}{9} + \\frac{1}{16} + \\cdots = ",
"\\;???"
)
- question[0].gradient_highlight(BLUE_C, BLUE_B)
+ question[0].set_color_by_gradient(BLUE_C, BLUE_B)
question.move_to(bubble.get_bubble_center())
question.shift(2*SMALL_BUFF*UP)
@@ -868,8 +868,8 @@ class WhatIsRight(PiCreatureScene):
mob.next_to(randy, UP)
mob.shift(3.5*RIGHT)
- left_mobs.gradient_highlight(YELLOW_C, YELLOW_D)
- right_mobs.gradient_highlight(GREEN_C, GREEN_D)
+ left_mobs.set_color_by_gradient(YELLOW_C, YELLOW_D)
+ right_mobs.set_color_by_gradient(GREEN_C, GREEN_D)
self.play(randy.change, "pondering", title)
self.wait()
@@ -905,7 +905,7 @@ class AskPuzzle(TeacherStudentsScene):
"\\frac{1}{1} + \\frac{1}{4} + \\frac{1}{9} + \\cdots + " +\
"\\frac{1}{n^2} + \\cdots = ", "\\,???"
)
- series[0].gradient_highlight(BLUE_C, BLUE_B)
+ series[0].set_color_by_gradient(BLUE_C, BLUE_B)
series[1].set_color(YELLOW)
question = TextMobject(
@@ -967,7 +967,7 @@ class ChangeTopic(PiCreatureScene):
"\\frac{6}{5} \\cdot \\frac{6}{7} \\cdots = \\frac{\\pi}{2}$", "?"
)
question[0].shift(MED_SMALL_BUFF*UP)
- question[1].gradient_highlight(YELLOW, GREEN)
+ question[1].set_color_by_gradient(YELLOW, GREEN)
self.play(
PiCreatureSays(
diff --git a/old_projects/putnam.py b/old_projects/putnam.py
index 7bc01b18e..66d589eb7 100644
--- a/old_projects/putnam.py
+++ b/old_projects/putnam.py
@@ -744,7 +744,7 @@ class TwoDCase(Scene):
)
arc.shift(self.center)
all_arcs.add(arc)
- all_arcs.gradient_highlight(RED, MAROON_B, PINK, BLUE)
+ all_arcs.set_color_by_gradient(RED, MAROON_B, PINK, BLUE)
self.all_arcs = all_arcs
return all_arcs
diff --git a/old_projects/qa_round_two.py b/old_projects/qa_round_two.py
index e50ec90ae..b6d300485 100644
--- a/old_projects/qa_round_two.py
+++ b/old_projects/qa_round_two.py
@@ -63,7 +63,7 @@ class Announcements(PiCreatureScene):
aligned_edge = LEFT,
)
announcements.next_to(underline, DOWN, LARGE_BUFF, aligned_edge = LEFT)
- announcements.gradient_highlight(GREEN, YELLOW)
+ announcements.set_color_by_gradient(GREEN, YELLOW)
self.play(
Write(title),
@@ -143,7 +143,7 @@ class PowersOfTwo(Scene):
curr_po2_outline = curr_po2[-1].copy()
curr_po2_outline.set_fill(opacity = 0)
curr_po2_outline.set_stroke(width = 2)
- curr_po2_outline.gradient_highlight(
+ curr_po2_outline.set_color_by_gradient(
YELLOW, RED, PINK, PURPLE, BLUE, GREEN
)
@@ -202,7 +202,7 @@ class Thumbnail(Scene):
equation.to_edge(DOWN, buff = LARGE_BUFF)
q_and_a = TextMobject("Q\\&A \\\\ Round 2")
- q_and_a.gradient_highlight(BLUE, YELLOW)
+ q_and_a.set_color_by_gradient(BLUE, YELLOW)
q_and_a.scale_to_fit_width(FRAME_X_RADIUS)
q_and_a.to_edge(UP, buff = LARGE_BUFF)
diff --git a/old_projects/triples.py b/old_projects/triples.py
index 29100b793..e56195567 100644
--- a/old_projects/triples.py
+++ b/old_projects/triples.py
@@ -1839,7 +1839,7 @@ class VisualizeZSquared(Scene):
secondary_line_ratio = 0,
stroke_width = 2,
)
- color_grid.main_lines.gradient_highlight(
+ color_grid.main_lines.set_color_by_gradient(
*[GREEN, RED, MAROON_B, TEAL]*2
)
color_grid.remove(color_grid.axes[0])
diff --git a/old_projects/uncertainty.py b/old_projects/uncertainty.py
index 96ae8d028..51b65ca6b 100644
--- a/old_projects/uncertainty.py
+++ b/old_projects/uncertainty.py
@@ -2548,7 +2548,7 @@ class AmbiguityInLongEchos(IntroduceDopplerRadar, PiCreatureScene):
self.get_frequency_pulse_graph(x)
for x in x_coords
])
- graphs.gradient_highlight(BLUE, YELLOW)
+ graphs.set_color_by_gradient(BLUE, YELLOW)
sum_graph = self.axes.get_graph(
lambda t : sum([
graph.underlying_function(t)
@@ -2756,7 +2756,7 @@ class AmbiguityInLongEchos(IntroduceDopplerRadar, PiCreatureScene):
fourier_graph = self.fourier_graph
shifted_graphs = self.get_shifted_frequency_graphs(fourier_graph)
color = fourier_graph.get_color()
- shifted_graphs.gradient_highlight(
+ shifted_graphs.set_color_by_gradient(
average_color(color, WHITE),
color,
average_color(color, BLACK),
@@ -3594,7 +3594,7 @@ class HangingWeightsScene(MovingCameraScene):
weight_anims.append(weight_anim)
weights.add(weight)
weights.set_fill(opacity = 1)
- weights.gradient_highlight(BLUE_D, BLUE_E, BLUE_D)
+ weights.set_color_by_gradient(BLUE_D, BLUE_E, BLUE_D)
weights.set_stroke(WHITE, 1)
self.play(LaggedStart(GrowFromCenter, weights))
@@ -4803,7 +4803,7 @@ class Thumbnail(Scene):
])
graphs.arrange_submobjects(DOWN, buff = 0.6)
graphs.to_corner(UP+LEFT)
- graphs.gradient_highlight(BLUE_B, BLUE_D)
+ graphs.set_color_by_gradient(BLUE_B, BLUE_D)
frequency_axes = Axes(
x_min = 0, x_max = 2,
diff --git a/old_projects/waves.py b/old_projects/waves.py
index 7aa9a15b4..5bc6ce292 100644
--- a/old_projects/waves.py
+++ b/old_projects/waves.py
@@ -720,7 +720,7 @@ class IntroduceElectricField(PiCreatureScene):
shading_list.sort(
lambda m1, m2 : cmp(m1.get_length(), m2.get_length())
)
- VGroup(*shading_list).gradient_highlight(*self.vector_field_colors)
+ VGroup(*shading_list).set_color_by_gradient(*self.vector_field_colors)
result.set_fill(opacity = 0.75)
result.sort_submobjects(np.linalg.norm)
diff --git a/old_projects/wcat.py b/old_projects/wcat.py
index d3f608b79..1ebed584b 100644
--- a/old_projects/wcat.py
+++ b/old_projects/wcat.py
@@ -759,7 +759,7 @@ class DeclareFunction(ClosedLoopScene):
xyz_brace = Brace(tex[-1], RIGHT)
ab_brace.add(ab_brace.get_text("Pair of points on the loop"))
xyz_brace.add(xyz_brace.get_text("Point in 3d space"))
- ab_brace.gradient_highlight(MAROON_B, PURPLE_B)
+ ab_brace.set_color_by_gradient(MAROON_B, PURPLE_B)
xyz_brace.set_color(BLUE)
self.add(tex)
@@ -1036,7 +1036,7 @@ class DeformToInterval(ClosedLoopScene):
self.play(FadeIn(self.loop))
self.add(original_loop)
self.add_dots_at_alphas(*np.linspace(0, 1, 20))
- self.dots.gradient_highlight(BLUE, MAROON_C, BLUE)
+ self.dots.set_color_by_gradient(BLUE, MAROON_C, BLUE)
dot_at_1 = self.dots[-1]
dot_at_1.generate_target()
dot_at_1.target.move_to(interval.get_right())
@@ -1106,7 +1106,7 @@ class RepresentPairInUnitSquare(ClosedLoopScene):
self.loop.scale(0.7)
self.loop.to_edge(UP)
self.add_dots_at_alphas(*dot_coords)
- self.dots.gradient_highlight(GREEN, RED)
+ self.dots.set_color_by_gradient(GREEN, RED)
self.play(
Write(self.dots),
@@ -1256,7 +1256,7 @@ class EdgesOfSquare(Scene):
for vect in LEFT, RIGHT
]
for group in dot_groups:
- group.gradient_highlight(YELLOW, PURPLE_B)
+ group.set_color_by_gradient(YELLOW, PURPLE_B)
label_groups = [
VGroup(*[
TexMobject("(%s, %s)"%(a, b)).scale(0.7)
@@ -1337,7 +1337,7 @@ class TorusPlaneAnalogy(ClosedLoopScene):
self.loop.next_to(top_arrow, RIGHT)
self.loop.shift_onto_screen()
self.add_dots_at_alphas(0.3, 0.5)
- self.dots.gradient_highlight(GREEN, RED)
+ self.dots.set_color_by_gradient(GREEN, RED)
plane = NumberPlane()
plane.scale(0.3).next_to(low_arrow, LEFT)
@@ -1367,7 +1367,7 @@ class WigglingPairOfPoints(ClosedLoopScene):
]
self.add_dots_at_alphas(*alpha_pairs[-1])
self.add_connecting_lines()
- self.dots.gradient_highlight(GREEN, RED)
+ self.dots.set_color_by_gradient(GREEN, RED)
self.connecting_lines.set_color(YELLOW)
for x, pair in zip(range(20), it.cycle(alpha_pairs)):
self.move_dots_to_alphas(pair, run_time = 0.3)
@@ -1389,7 +1389,7 @@ class TrivialPairCollision(ClosedLoopScene):
def construct(self):
self.loop.to_edge(RIGHT)
self.add_dots_at_alphas(0.35, 0.55)
- self.dots.gradient_highlight(BLUE, YELLOW)
+ self.dots.set_color_by_gradient(BLUE, YELLOW)
a, b = self.dots
a_label = TexMobject("a").next_to(a, RIGHT)
a_label.set_color(a.get_color())
@@ -2127,7 +2127,7 @@ class ThumbnailImage(ClosedLoopScene):
title = TextMobject("Unsolved")
title.scale(2.5)
title.to_edge(UP)
- title.gradient_highlight(YELLOW, MAROON_B)
+ title.set_color_by_gradient(YELLOW, MAROON_B)
self.add(title)
self.loop.next_to(title, DOWN, buff = MED_SMALL_BUFF)
self.loop.shift(2*LEFT)
diff --git a/old_projects/zeta.py b/old_projects/zeta.py
index b3d0d6af8..a67d64910 100644
--- a/old_projects/zeta.py
+++ b/old_projects/zeta.py
@@ -108,7 +108,7 @@ class ZetaTransformationScene(ComplexTransformationScene):
for x in x_range
if abs(x-1) > epsilon
])
- vert_lines.gradient_highlight(
+ vert_lines.set_color_by_gradient(
self.vert_start_color, self.vert_end_color
)
horiz_lines = VGroup(*[
@@ -119,7 +119,7 @@ class ZetaTransformationScene(ComplexTransformationScene):
for y in y_range
if abs(y) > epsilon
])
- horiz_lines.gradient_highlight(
+ horiz_lines.set_color_by_gradient(
self.horiz_start_color, self.horiz_end_color
)
dense_grid = VGroup(horiz_lines, vert_lines)
@@ -238,7 +238,7 @@ class WhyPeopleMayKnowIt(TeacherStudentsScene):
self.add(title, func_mob)
mercenary_thought = VGroup(
- TexMobject("\\$1{,}000{,}000").gradient_highlight(GREEN_B, GREEN_D),
+ TexMobject("\\$1{,}000{,}000").set_color_by_gradient(GREEN_B, GREEN_D),
TexMobject("\\zeta(s) = 0")
)
mercenary_thought.arrange_submobjects(DOWN)
@@ -247,7 +247,7 @@ class WhyPeopleMayKnowIt(TeacherStudentsScene):
TexMobject("\\zeta(-1) = -\\frac{1}{12}")
)
divergent_sum.arrange_submobjects(DOWN)
- divergent_sum[0].gradient_highlight(YELLOW, MAROON_B)
+ divergent_sum[0].set_color_by_gradient(YELLOW, MAROON_B)
divergent_sum[1].set_color(BLACK)
#Thoughts
@@ -656,8 +656,8 @@ class DefineForRealS(PiCreatureScene):
for s1, s2 in zip(power_sums, power_sums[1:])
])
lines.set_stroke(width = line_thickness)
- # VGroup(*lines[:4]).gradient_highlight(RED, GREEN_B)
- # VGroup(*lines[4:]).gradient_highlight(GREEN_B, MAROON_B)
+ # VGroup(*lines[:4]).set_color_by_gradient(RED, GREEN_B)
+ # VGroup(*lines[4:]).set_color_by_gradient(GREEN_B, MAROON_B)
VGroup(*lines[::2]).set_color(MAROON_B)
VGroup(*lines[1::2]).set_color(RED)
@@ -2975,7 +2975,7 @@ class DiscussZeros(ZetaTransformationScene):
ParametricFunction(func, t_min = t0, t_max = t0+1)
for t0 in range(100)
])
- full_line.gradient_highlight(
+ full_line.set_color_by_gradient(
YELLOW, BLUE, GREEN, RED, YELLOW, BLUE, GREEN, RED,
)
self.play(ShowCreation(full_line, run_time = 20, rate_func = None))
diff --git a/topics/complex_numbers.py b/topics/complex_numbers.py
index 7158b2889..b9a5e2015 100644
--- a/topics/complex_numbers.py
+++ b/topics/complex_numbers.py
@@ -99,13 +99,13 @@ class ComplexTransformationScene(Scene):
def paint_plane(self, plane):
for lines in plane.main_lines, plane.secondary_lines:
- lines.gradient_highlight(
+ lines.set_color_by_gradient(
self.vert_start_color,
self.vert_end_color,
self.horiz_start_color,
self.horiz_end_color,
)
- # plane.axes.gradient_highlight(
+ # plane.axes.set_color_by_gradient(
# self.horiz_start_color,
# self.vert_start_color
# )
diff --git a/topics/fractals.py b/topics/fractals.py
index c191ce812..2fce61c39 100644
--- a/topics/fractals.py
+++ b/topics/fractals.py
@@ -69,7 +69,7 @@ class SelfSimilarFractal(VMobject):
}
def init_colors(self):
VMobject.init_colors(self)
- self.gradient_highlight(*self.colors)
+ self.set_color_by_gradient(*self.colors)
def generate_points(self):
order_n_self = self.get_order_n_self(self.order)
@@ -224,7 +224,7 @@ class PiCreatureFractal(VMobject):
# def init_colors(self):
# VMobject.init_colors(self)
- # self.gradient_highlight(*self.colors)
+ # self.set_color_by_gradient(*self.colors)
class WonkyHexagonFractal(SelfSimilarFractal):
@@ -311,7 +311,7 @@ class FractalCurve(VMobject):
def init_colors(self):
VMobject.init_colors(self)
- self.gradient_highlight(*self.colors)
+ self.set_color_by_gradient(*self.colors)
for order in sorted(self.order_to_stroke_width_map.keys()):
if self.order >= order:
self.set_stroke(width = self.order_to_stroke_width_map[order])
diff --git a/topics/objects.py b/topics/objects.py
index 8ef74865a..bb0bb00e1 100644
--- a/topics/objects.py
+++ b/topics/objects.py
@@ -172,9 +172,9 @@ class PartyHat(SVGMobject):
self.cone = self[self.NUM_FRILLS]
self.dots = VGroup(*self[self.NUM_FRILLS+1:])
- self.frills.gradient_highlight(*self.frills_colors)
+ self.frills.set_color_by_gradient(*self.frills_colors)
self.cone.set_color(self.cone_color)
- self.dots.gradient_highlight(*self.dots_colors)
+ self.dots.set_color_by_gradient(*self.dots_colors)
class Laptop(VGroup):
CONFIG = {
@@ -287,7 +287,7 @@ class VideoSeries(VGroup):
VGroup.__init__(self, *videos, **kwargs)
self.arrange_submobjects()
self.scale_to_fit_width(FRAME_WIDTH-MED_LARGE_BUFF)
- self.gradient_highlight(*self.gradient_colors)
+ self.set_color_by_gradient(*self.gradient_colors)
class Headphones(SVGMobject):
CONFIG = {
diff --git a/topics/probability.py b/topics/probability.py
index d4179f3df..92da235da 100644
--- a/topics/probability.py
+++ b/topics/probability.py
@@ -342,7 +342,7 @@ class BarChart(VGroup):
)
bar.move_to((2*i+1)*buff*RIGHT, DOWN+LEFT)
bars.add(bar)
- bars.gradient_highlight(*self.bar_colors)
+ bars.set_color_by_gradient(*self.bar_colors)
bar_labels = VGroup()
for bar, name in zip(bars, self.bar_names):