summaryrefslogtreecommitdiff
path: root/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file1_paths-3d.py
blob: 28b2bd4c1de4ad53a2724eed48cad59244792d13 (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
from manimlib.imports import *
import numpy as np

class routes(ThreeDScene):
	def construct(self):

		axes = ThreeDAxes()
		self.begin_ambient_camera_rotation(rate=0.08)
		self.set_camera_orientation(phi=45 * DEGREES,theta=-65*DEGREES, distance = 45)
		function = ParametricFunction(
            lambda t: np.array([
            1.5*np.cos(t),
            1.5*np.sin(t),
            t/4
            ]), t_min = 0, t_max =3*PI).set_color("#0EB1D2")
	

		line = Line(np.array([1.5, 0, 0]), np.array([-1.5, 0, 2.35619])).set_color("#F8F32B")

		dot1 = Sphere(radius = 0.1).move_to(np.array([1.5,0,0])).set_color("#74226C")
		dot2 = Sphere(radius = 0.1).move_to(np.array([1.5,0,0])).set_color("#74226C")

		label1 = TexMobject(r"A").move_to(np.array([1.5,0,0])).set_color("#FCF7F8")
		label2 = TexMobject(r"B").move_to(np.array([-1.5,0,2.42])).set_color("#FCF7F8")

		title = TexMobject(r"\textit{Work done}",r"\textit{ against gravity is the}", r"\textit{ same for both paths}").set_color("#F1E3F3").move_to(np.array([0,-3,0]))
		title[1].set_color("#F8F32B")

		self.add(axes)
		self.wait()
		self.play(ShowCreation(function), ShowCreation(line), run_time = 2)
		self.wait()
		self.play(MoveAlongPath(dot1, function), run_time = 2)
		self.wait()
		self.play(MoveAlongPath(dot2, line), run_time = 1.2)
		self.wait()
		self.add_fixed_in_frame_mobjects(title)
		self.play(Write(title))
		self.wait()