summaryrefslogtreecommitdiff
path: root/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file6_macro-micro-curl.py
blob: 02c75a3aa09781b295234083b111fb8756d252db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from manimlib.imports import *
import numpy as np

def curl(coordinate):
	x,y = coordinate[:2]
	return np.array([
			-y,
			x,
			0
	])


class Subtle(Scene):
	def construct(self):
		vf1 = VectorField(curl)
		pinwheel = SVGMobject("geo").move_to(np.array([2, 0, 0])).scale(0.3).set_stroke(width = 0.3).set_color_by_gradient(["#adf802",  YELLOW_C]).move_to(np.array([2.3, 0, 0]))
		self.add(pinwheel)

		label1 = TexMobject(r"\textit{Microscopic curl}").shift(3*DOWN).add_background_rectangle()
		label2 = TexMobject(r"\textit{Macroscopic curl}").shift(3*DOWN)

		ball1 = Dot(checkerboard_colors = [BLUE_E, PURPLE_E], resolution = [2,2], radius = 0.4).move_to(np.array([-1, -1, 0]))
		ball2 = Sphere(checkerboard_colors = [BLUE_E, TEAL], resolution = [16, 16], radius = 0.3).move_to(np.array([2, 0, 0]))
		circ = Circle(radius = 2)


		self.add(vf1)
		self.wait()
		self.play(ShowCreation(pinwheel))
		self.bring_to_front(pinwheel)
		self.play(Rotating(pinwheel), ShowCreation(label1))
		self.wait(2)
		#self.add(ball1)
		move_submobjects_along_vector_field(pinwheel, curl)
		self.play(FadeOut(label1), ShowCreation(label2))
		self.play(Indicate(label2))

		self.wait(5)