Manim's method part 23

Overview

I checked manim's method. I tried using VectorScene.

Sample code

from manimlib.imports import *

class test(VectorScene):
	def construct(self):
		two_dot = TexMobject("2\\cdot")
		equals = TexMobject("=")
		self.add_axes()
		v = self.add_vector([3, 1])
		v_coords, vx_line, vy_line = self.vector_to_coords(v, clean_up = False)
		self.play(ApplyMethod(v_coords.to_edge, UP))
		two_dot.next_to(v_coords, LEFT)
		equals.next_to(v_coords, RIGHT)
		two_v = self.add_vector([6, 2], animate = False)
		self.remove(two_v)
		self.play(Transform(v.copy(), two_v), Write(two_dot, run_time = 1))
		two_v_coords, two_v_x_line, two_v_y_line = self.vector_to_coords(two_v, clean_up = False)
		self.play(ApplyMethod(two_v_coords.next_to, equals, RIGHT),Write(equals, run_time = 1))
		self.wait(2)
		x, y = v_coords.get_mob_matrix().flatten()
		two_v_elems = two_v_coords.get_mob_matrix().flatten()
		x_sym, y_sym = list(map(TexMobject, ["x", "y"]))
		two_x_sym, two_y_sym = list(map(TexMobject, ["2x", "2y"]))
		#VMobject(x_sym, two_x_sym).set_color(X_COLOR)
		#VMobject(y_sym, two_y_sym).set_color(Y_COLOR)
		syms = [x_sym, y_sym, two_x_sym, two_y_sym]
		#VMobject(*syms).scale(VECTOR_LABEL_SCALE_FACTOR)
		for sym, num in zip(syms, [x, y] + list(two_v_elems)):
			sym.move_to(num)
		#self.play(Transform(x, x_sym), Transform(y, y_sym), FadeOut(VMobject(*two_v_elems)))
		self.wait()
		#self.play(Transform(VMobject(two_dot.copy(), x.copy()), two_x_sym), Transform(VMobject(two_dot.copy(), y.copy() ), two_y_sym))
		#self.wait(2)





Generated video

https://www.youtube.com/watch?v=Kq7Ptpt6YZQ

that's all.

Recommended Posts

Manim's method part 23
Manim's method 7
Manim's method 13
Manim's method 2
Manim's method 18
Manim's method 17
Manim's method 5
Manim's method 3
Manim's method 15
Manim's method 11
Manim's method 16
Manim's method 20
Manim's method 10
Manim's method 9
Manim's method 6
Manim's method 21
Manim's method 4
Manim's method 8
Manim's method 14
Manim's method 22
Manim's method 19
Manim's method 12
datetime part 1
manim's manners
numpy part 1
argparse part 1
Binary method
numpy part 2
Special method
Special method