summaryrefslogtreecommitdiff
path: root/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Gradient/Gradient_file8_fluid-flow.py
blob: 02a348dde0000c68cbd9eebfd179cf5bab27f68f (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
from manimlib.imports import *


def funk(x,y):
	x,y = coordinate[:2]
	return np.array([
			np.sin(x)**np.cos(y),
			np.sin(y)**np.cos(x),
			0
	])

class Fluid(Scene):
    def construct(self):
        vf = VectorField(funk).fade(0.5)
        self.add(vf)
        self.wait()
        lines = StreamLines(
            funk,
            virtual_time=3,
            min_magnitude=0,
            max_magnitude=2,
        )
        self.add(AnimatedStreamLines(
            lines,
            line_anim_class=ShowPassingFlashWithThinningStrokeWidth
        ))
        self.wait(3)