VectorAdditionNumerically
Browse files- manim.py +6 -2
- manimlib/scene/vector_space_scene.py +1 -1
- old_projects/eola/chapter1.py +6 -6
manim.py
CHANGED
|
@@ -37,8 +37,12 @@ if __name__ == "__main__":
|
|
| 37 |
# sys.argv.extend(['old_projects/eola/chapter1.py', 'HelpsToHaveOneThought', '-pl'])
|
| 38 |
# sys.argv.extend(['old_projects/eola/chapter1.py', 'HowIWantYouToThinkAboutVectors', '-pl'])
|
| 39 |
# sys.argv.extend(['old_projects/eola/chapter1.py', 'ListsOfNumbersAddOn', '-pl'])
|
| 40 |
-
sys.argv.extend(['old_projects/eola/chapter1.py', 'CoordinateSystemWalkthrough', '-pl'])
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
manimlib.main()
|
| 44 |
else:
|
|
|
|
| 37 |
# sys.argv.extend(['old_projects/eola/chapter1.py', 'HelpsToHaveOneThought', '-pl'])
|
| 38 |
# sys.argv.extend(['old_projects/eola/chapter1.py', 'HowIWantYouToThinkAboutVectors', '-pl'])
|
| 39 |
# sys.argv.extend(['old_projects/eola/chapter1.py', 'ListsOfNumbersAddOn', '-pl'])
|
| 40 |
+
# sys.argv.extend(['old_projects/eola/chapter1.py', 'CoordinateSystemWalkthrough', '-pl'])
|
| 41 |
+
# sys.argv.extend(['old_projects/eola/chapter1.py', 'WriteZ', '-pl'])
|
| 42 |
+
# sys.argv.extend(['old_projects/eola/chapter1.py', 'Write3DVector', '-pl']) # 2 1 3 从上到下分步显示
|
| 43 |
+
# sys.argv.extend(['old_projects/eola/chapter1.py', 'VectorAddition', '-pl'])
|
| 44 |
+
# sys.argv.extend(['old_projects/eola/chapter1.py', 'AddingNumbersOnNumberLine', '-pl'])
|
| 45 |
+
sys.argv.extend(['old_projects/eola/chapter1.py', 'VectorAdditionNumerically', '-pl'])
|
| 46 |
|
| 47 |
manimlib.main()
|
| 48 |
else:
|
manimlib/scene/vector_space_scene.py
CHANGED
|
@@ -256,7 +256,7 @@ class VectorScene(Scene):
|
|
| 256 |
vector = np.append(np.array(vector), 0.0)
|
| 257 |
x_max = int(FRAME_X_RADIUS + abs(vector[0]))
|
| 258 |
y_max = int(FRAME_Y_RADIUS + abs(vector[1]))
|
| 259 |
-
dots =
|
| 260 |
Dot(x * RIGHT + y * UP)
|
| 261 |
for x in range(-x_max, x_max)
|
| 262 |
for y in range(-y_max, y_max)
|
|
|
|
| 256 |
vector = np.append(np.array(vector), 0.0)
|
| 257 |
x_max = int(FRAME_X_RADIUS + abs(vector[0]))
|
| 258 |
y_max = int(FRAME_Y_RADIUS + abs(vector[1]))
|
| 259 |
+
dots = VGroup(*[
|
| 260 |
Dot(x * RIGHT + y * UP)
|
| 261 |
for x in range(-x_max, x_max)
|
| 262 |
for y in range(-y_max, y_max)
|
old_projects/eola/chapter1.py
CHANGED
|
@@ -871,8 +871,8 @@ class VectorAdditionNumerically(VectorScene):
|
|
| 871 |
x1, y1 = coords1.get_mob_matrix().flatten()
|
| 872 |
x2, y2 = coords2.get_mob_matrix().flatten()
|
| 873 |
sum_x, sum_y = sum_coords.get_mob_matrix().flatten()
|
| 874 |
-
sum_x_start =
|
| 875 |
-
sum_y_start =
|
| 876 |
self.play(
|
| 877 |
Write(brackets),
|
| 878 |
Write(equals),
|
|
@@ -895,8 +895,8 @@ class VectorAdditionNumerically(VectorScene):
|
|
| 895 |
var.move_to(starter)
|
| 896 |
self.play(
|
| 897 |
Transform(
|
| 898 |
-
|
| 899 |
-
|
| 900 |
),
|
| 901 |
FadeOut(sum_x_start),
|
| 902 |
FadeOut(sum_y_start)
|
|
@@ -904,10 +904,10 @@ class VectorAdditionNumerically(VectorScene):
|
|
| 904 |
sum_x_end, sum_y_end = variables[-2:]
|
| 905 |
self.wait(2)
|
| 906 |
self.play(
|
| 907 |
-
Transform(
|
| 908 |
)
|
| 909 |
self.play(
|
| 910 |
-
Transform(
|
| 911 |
)
|
| 912 |
self.wait(3)
|
| 913 |
|
|
|
|
| 871 |
x1, y1 = coords1.get_mob_matrix().flatten()
|
| 872 |
x2, y2 = coords2.get_mob_matrix().flatten()
|
| 873 |
sum_x, sum_y = sum_coords.get_mob_matrix().flatten()
|
| 874 |
+
sum_x_start = VGroup(x1, x2).copy()
|
| 875 |
+
sum_y_start = VGroup(y1, y2).copy()
|
| 876 |
self.play(
|
| 877 |
Write(brackets),
|
| 878 |
Write(equals),
|
|
|
|
| 895 |
var.move_to(starter)
|
| 896 |
self.play(
|
| 897 |
Transform(
|
| 898 |
+
VGroup(*starters[:4]),
|
| 899 |
+
VGroup(*variables[:4])
|
| 900 |
),
|
| 901 |
FadeOut(sum_x_start),
|
| 902 |
FadeOut(sum_y_start)
|
|
|
|
| 904 |
sum_x_end, sum_y_end = variables[-2:]
|
| 905 |
self.wait(2)
|
| 906 |
self.play(
|
| 907 |
+
Transform(VGroup(x1, x2).copy(), sum_x_end)
|
| 908 |
)
|
| 909 |
self.play(
|
| 910 |
+
Transform(VGroup(y1, y2).copy(), sum_y_end)
|
| 911 |
)
|
| 912 |
self.wait(3)
|
| 913 |
|