Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Whoops, some files were missing from last commit

Grant Sanderson413403c904b6
diff --git a/mobject/point_cloud_mobject.py b/mobject/point_cloud_mobject.py
index 0d4aa06bf..e1d482780 100644
--- a/mobject/point_cloud_mobject.py
+++ b/mobject/point_cloud_mobject.py
@@ -55,7 +55,7 @@ class PMobject(Mobject):
])
return self
- def radial_gradient_highlight(self, center = None, radius = 1, inner_color = WHITE, outer_color = BLACK):
+ def set_colors_by_radial_gradient(self, center = None, radius = 1, inner_color = WHITE, outer_color = BLACK):
start_rgba, end_rgba = map(color_to_rgba, [start_color, end_color])
if center == None:
center = self.get_center()
diff --git a/old_projects/eola/chapter3.py b/old_projects/eola/chapter3.py
index 9afc60328..d0ecd4b8a 100644
--- a/old_projects/eola/chapter3.py
+++ b/old_projects/eola/chapter3.py
@@ -270,7 +270,7 @@ class TransformManyVectors(LinearTransformationScene):
for x in np.arange(-int(FRAME_X_RADIUS)+0.5, int(FRAME_X_RADIUS)+0.5)
for y in np.arange(-int(FRAME_Y_RADIUS)+0.5, int(FRAME_Y_RADIUS)+0.5)
])
- vectors.submobject_gradient_highlight(PINK, YELLOW)
+ vectors.set_submobject_colors_by_gradient(PINK, YELLOW)
t_matrix = self.transposed_matrix
transformed_vectors = VMobject(*[
Vector(
@@ -791,7 +791,7 @@ class WatchManyVectorsMove(TransformManyVectors):
for x in np.arange(-int(FRAME_X_RADIUS)+0.5, int(FRAME_X_RADIUS)+0.5)
for y in np.arange(-int(FRAME_Y_RADIUS)+0.5, int(FRAME_Y_RADIUS)+0.5)
])
- vectors.submobject_gradient_highlight(PINK, YELLOW)
+ vectors.set_submobject_colors_by_gradient(PINK, YELLOW)
dots = self.vectors_to_dots(vectors)
self.play(ShowCreation(dots, submobject_mode = "lagged_start"))
self.play(Transform(
@@ -1651,7 +1651,7 @@ class MoveAroundAllVectors(LinearTransformationScene):
for x in np.arange(-int(FRAME_X_RADIUS)+0.5, int(FRAME_X_RADIUS)+0.5)
for y in np.arange(-int(FRAME_Y_RADIUS)+0.5, int(FRAME_Y_RADIUS)+0.5)
])
- vectors.submobject_gradient_highlight(PINK, YELLOW)
+ vectors.set_submobject_colors_by_gradient(PINK, YELLOW)
dots = self.get_dots(vectors)
self.wait()
diff --git a/old_projects/eola/chapter4.py b/old_projects/eola/chapter4.py
index 996454757..99e24c718 100644
--- a/old_projects/eola/chapter4.py
+++ b/old_projects/eola/chapter4.py
@@ -288,7 +288,7 @@ class IntroduceIdeaOfComposition(RotationThenShear):
"and a",
"shear"
])
- words.split()[0].submobject_gradient_highlight(YELLOW, PINK, use_color_range_to = False)
+ words.split()[0].set_submobject_colors_by_gradient(YELLOW, PINK, use_color_range_to = False)
words.split()[2].set_color(YELLOW)
words.split()[4].set_color(PINK)
words.add_background_rectangle()
@@ -432,7 +432,7 @@ class ExplainWhyItsMatrixMultiplication(Scene):
brace.set_color(matrix.get_color())
text.set_color(matrix.get_color())
matrix.add(brace, text)
- comp_matrix.split()[-1].submobject_gradient_highlight(TEAL, PINK)
+ comp_matrix.split()[-1].set_submobject_colors_by_gradient(TEAL, PINK)
self.add(vect)
groups = [
@@ -524,7 +524,7 @@ class MoreComplicatedExampleVisually(LinearTransformationScene):
comp_matrix = Matrix([["?", "?"], ["?", "?"]])
m1_mob.set_color(YELLOW)
m2_mob.set_color(PINK)
- comp_matrix.get_entries().submobject_gradient_highlight(YELLOW, PINK)
+ comp_matrix.get_entries().set_submobject_colors_by_gradient(YELLOW, PINK)
equals = TexMobject("=")
equals.next_to(comp_matrix, LEFT)
@@ -892,7 +892,7 @@ class AskAssociativityQuestion(Scene):
rhs = VMobject(lp, a, b, rp, c)##Align order to lhs
eq = TexMobject("=")
q_marks = TextMobject("???")
- q_marks.submobject_gradient_highlight(TEAL_B, TEAL_D)
+ q_marks.set_submobject_colors_by_gradient(TEAL_B, TEAL_D)
q_marks.next_to(eq, UP)
lhs.next_to(eq, LEFT)
rhs.next_to(eq, RIGHT)
diff --git a/old_projects/eola/chapter5.py b/old_projects/eola/chapter5.py
index 872a0d0ca..dd8142470 100644
--- a/old_projects/eola/chapter5.py
+++ b/old_projects/eola/chapter5.py
@@ -455,7 +455,7 @@ class NextFewVideos(Scene):
icon.set_stroke(color = WHITE, width = 0)
icon.set_fill(WHITE, opacity = 1)
icons = VMobject(*[icon.copy() for x in range(10)])
- icons.submobject_gradient_highlight(BLUE_A, BLUE_D)
+ icons.set_submobject_colors_by_gradient(BLUE_A, BLUE_D)
icons.arrange_submobjects(RIGHT)
icons.to_edge(LEFT)
@@ -753,8 +753,8 @@ class NameParallelepiped(Scene):
word.scale(2)
pp_part1 = VMobject(*word.split()[:len(word.split())/2])
pp_part2 = VMobject(*word.split()[len(word.split())/2:])
- pp_part1.submobject_gradient_highlight(X_COLOR, Y_COLOR)
- pp_part2.submobject_gradient_highlight(Y_COLOR, Z_COLOR)
+ pp_part1.set_submobject_colors_by_gradient(X_COLOR, Y_COLOR)
+ pp_part2.set_submobject_colors_by_gradient(Y_COLOR, Z_COLOR)
self.play(Write(word))
self.wait(2)
@@ -773,8 +773,8 @@ class DeterminantIsVolumeOfParallelepiped(Scene):
pp = words.split()[1]
pp_part1 = VMobject(*pp.split()[:len(pp.split())/2])
pp_part2 = VMobject(*pp.split()[len(pp.split())/2:])
- pp_part1.submobject_gradient_highlight(X_COLOR, Y_COLOR)
- pp_part2.submobject_gradient_highlight(Y_COLOR, Z_COLOR)
+ pp_part1.set_submobject_colors_by_gradient(X_COLOR, Y_COLOR)
+ pp_part2.set_submobject_colors_by_gradient(Y_COLOR, Z_COLOR)
words.next_to(eq, RIGHT)
diff --git a/old_projects/eola/chapter6.py b/old_projects/eola/chapter6.py
index 4ccb75089..aa9cc510f 100644
--- a/old_projects/eola/chapter6.py
+++ b/old_projects/eola/chapter6.py
@@ -228,7 +228,7 @@ class MachineLearningNetwork(Scene):
for l_layer, r_layer in zip(layers, layers[1:]):
for l_node, r_node in it.product(l_layer.split(), r_layer.split()):
lines.add(Line(l_node, r_node))
- lines.submobject_gradient_highlight(BLUE_E, BLUE_A)
+ lines.set_submobject_colors_by_gradient(BLUE_E, BLUE_A)
for mob in VMobject(*layers), lines:
self.play(Write(mob), run_time = 2)
self.wait()
@@ -502,7 +502,7 @@ class SystemOfEquations(Scene):
mob.words.shift_onto_screen()
mob.symbol = TexMobject(mob.symbol)
mob.brace.put_at_tip(mob.symbol)
- x_array.words.submobject_gradient_highlight(
+ x_array.words.set_submobject_colors_by_gradient(
X_COLOR, Y_COLOR, Z_COLOR
)
x_array.symbol.set_color(PINK)
@@ -636,7 +636,7 @@ class SystemOfTwoEquationsTwoUnknowns(Scene):
matrix = Matrix([[2, 2], [1, 3]])
v = Matrix([-4, -1])
x = Matrix(["x", "y"])
- x.get_entries().submobject_gradient_highlight(X_COLOR, Y_COLOR)
+ x.get_entries().set_submobject_colors_by_gradient(X_COLOR, Y_COLOR)
matrix_system = VMobject(
matrix, x, TexMobject("="), v
)
@@ -676,7 +676,7 @@ class ShowBijectivity(LinearTransformationScene):
for val in FRAME_X_RADIUS, FRAME_Y_RADIUS
])
])
- vectors.submobject_gradient_highlight(BLUE_E, PINK)
+ vectors.set_submobject_colors_by_gradient(BLUE_E, PINK)
dots = VMobject(*[
Dot(v.get_end(), color = v.get_color())
for v in vectors.split()
@@ -1124,7 +1124,7 @@ class OneInputMultipleOutputs(InvertNonInvertable):
input_vectors = VMobject(*[
Vector([x+2, x]) for x in np.arange(-4, 4.5, 0.5)
])
- input_vectors.submobject_gradient_highlight(PINK, YELLOW)
+ input_vectors.set_submobject_colors_by_gradient(PINK, YELLOW)
output_vector = Vector([4, 2], color = YELLOW)
grid = VMobject(self.plane, self.i_hat, self.j_hat)
@@ -1151,7 +1151,7 @@ class OneInputMultipleOutputs(InvertNonInvertable):
"Must map to \\\\",
"multiple vectors"
)
- multiple_outputs.split()[1].submobject_gradient_highlight(YELLOW, PINK)
+ multiple_outputs.split()[1].set_submobject_colors_by_gradient(YELLOW, PINK)
multiple_outputs.next_to(ORIGIN, DOWN).to_edge(RIGHT)
multiple_outputs.add_background_rectangle()
self.play(Write(multiple_outputs, run_time = 2))
@@ -1725,7 +1725,7 @@ class NameNullSpace(LinearTransformationScene):
Vector(a*vect + offset)
for a in np.linspace(-5, 5, 18)
])
- vectors.submobject_gradient_highlight(PINK, YELLOW)
+ vectors.set_submobject_colors_by_gradient(PINK, YELLOW)
return vectors
class ThreeDNullSpaceIsLine(Scene):
diff --git a/old_projects/eola/chapter7.py b/old_projects/eola/chapter7.py
index 1b08ea1b9..7f8c18a7e 100644
--- a/old_projects/eola/chapter7.py
+++ b/old_projects/eola/chapter7.py
@@ -867,7 +867,7 @@ class FormalVsVisual(Scene):
Line of dots evenly spaced
dots remains evenly spaced
""")
- visual_statement.submobject_gradient_highlight(YELLOW, MAROON_B)
+ visual_statement.set_submobject_colors_by_gradient(YELLOW, MAROON_B)
properties = VMobject(additivity, scaling)
properties.arrange_submobjects(DOWN, buff = MED_SMALL_BUFF)
@@ -1016,7 +1016,7 @@ class NonLinearFailsDotTest(TwoDTo1DTransformWithDots):
Dot(offset + a*vect, radius = 0.075)
for a in np.linspace(-2, 3, 18)
])
- dots.submobject_gradient_highlight(YELLOW_B, YELLOW_C)
+ dots.set_submobject_colors_by_gradient(YELLOW_B, YELLOW_C)
func = lambda p : (p[0]**2 - p[1]**2)*RIGHT
new_dots = VMobject(*[
Dot(
diff --git a/old_projects/eola/footnote2.py b/old_projects/eola/footnote2.py
index 64e1afd99..1ceebc557 100644
--- a/old_projects/eola/footnote2.py
+++ b/old_projects/eola/footnote2.py
@@ -319,7 +319,7 @@ class MatrixInTheWild(Scene):
top_brace = Brace(matrix, UP)
top_words = top_brace.get_text("3 basis vectors")
- top_words.submobject_gradient_highlight(GREEN, RED, BLUE)
+ top_words.set_submobject_colors_by_gradient(GREEN, RED, BLUE)
side_brace = Brace(matrix, RIGHT)
side_words = side_brace.get_text("""
2 coordinates for
@@ -506,7 +506,7 @@ class TwoDTo1DTransformWithDots(TwoDTo1DTransform):
Dot(offset + a*vect, radius = 0.075)
for a in np.linspace(-2, 3, 18)
])
- dots.submobject_gradient_highlight(YELLOW_B, YELLOW_C)
+ dots.set_submobject_colors_by_gradient(YELLOW_B, YELLOW_C)
func = self.get_matrix_transformation(self.t_matrix)
new_dots = VMobject(*[
Dot(