-
Notifications
You must be signed in to change notification settings - Fork 33
/
merch.py
117 lines (95 loc) · 2.97 KB
/
merch.py
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
from manimlib import *
h1 = "#ff5757"
h1_d = "#890000"
h2 = '#5ce1e6'
h2_d = "#116c70"
A_AQUA = "#8dd3c7"
A_YELLOW = "#ffffb3"
A_LAVENDER = "#bebada"
A_RED = "#fb8072"
A_BLUE = "#80b1d3"
A_ORANGE = "#fdb462"
A_GREEN = "#b3de69"
A_PINK = "#fccde5"
A_GREY = "#d9d9d9"
A_VIOLET = "#bc80bd"
A_UNKA = "#ccebc5"
A_UNKB = "#ffed6f"
class Hoodie2(Scene):
def construct(self):
text = Tex(r"\textbf{\text{v}} ^3 \textbf{\text{(}}\textbf{\text{x}}\textbf{\text{)}}}", tex_to_color_map={
r'\textbf{\text{v}} ^3': h1,
r'\textbf{\text{x}}': h2
}, color=BLACK)
text.scale(4)
def func(z):
return (1+np.sqrt(3)*1j)*z
complex_kwargs = {
"background_line_style": {
"stroke_opacity": 0.85,
"stroke_width": 6
}
}
c = ComplexPlane(**complex_kwargs)
c.prepare_for_nonlinear_transform()
c.apply_complex_function(lambda z: (1+np.sqrt(3)*1j)*z)
self.add(c)
# text.apply_complex_function(func)
# text.scale(0.8)
self.add(text)
self.embed()
class LogoTransparent(Scene):
def construct(self):
text = Tex(r"\textbf{\text{v}} ^3 \textbf{\text{(}}\textbf{\text{x}}\textbf{\text{)}}}", tex_to_color_map={
r'\textbf{\text{v}} ^3': h1,
r'\textbf{\text{x}}': h2
}, color=WHITE)
text.scale(4)
def func(z):
return (1+np.sqrt(3)*1j)*z
text.apply_complex_function(func)
text.scale(0.5)
self.add(text)
class Hoodie3(Scene):
CONFIG = {
"plane_opacity": 0.85,
"x": 0.5,
"y": 0.5,
"vec_opacity": 1
}
def construct(self):
complex_kwargs = {
"background_line_style": {
"stroke_opacity": self.plane_opacity,
"stroke_color": BLUE_E,
"stroke_width": 6
}
}
text = Tex(r"\textbf{\text{v}} ^3 \textbf{\text{(}}\textbf{\text{x}}\textbf{\text{)}}}", tex_to_color_map={
r'\textbf{\text{v}} ^3': h1,
r'\textbf{\text{x}}': h2
}, color=WHITE)
text.scale(4)
c2 = ComplexPlane(x_range=(-3, 3), y_range=(-3, 3), **complex_kwargs)
c2.shift(FRAME_WIDTH/4 * RIGHT)
c2.prepare_for_nonlinear_transform()
c2.apply_complex_function(self.func)
def func(z):
return (1+np.sqrt(3)*1j)*z
text.apply_complex_function(func)
text.scale(0.5)
self.add(c2)
self.embed()
def get_vec(self, plane, coors, **kwargs):
x, y = coors[0], coors[1]
z = plane.c2p(x, y)
return Arrow(plane.c2p(0, 0), z, buff=0, **kwargs)
def f_deriv(self, z, dz=1e-6+1e-6*1j):
return (self.func(z+dz)-self.func(z))/dz
def func(self, z):
return (1*z + np.sin(z)) * 0.3 - 1
class HText(Scene):
def construct(self):
t = Tex(r"f'(z) = 1 + \sqrt{3}i", color=BLACK)
t.scale(4)
self.add(t)