-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathperformanceCode.py
More file actions
158 lines (117 loc) · 2.96 KB
/
Copy pathperformanceCode.py
File metadata and controls
158 lines (117 loc) · 2.96 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#name: Qixuan Hou
#section: A04
#GTID: 903000267
#GTemail: qhou6@gatech.edu
#collaboration statement: I worked on the homework with my partner.
from Myro import*
#for the beginning part
def beginningPart():
p=makePicture("pic1.jpg")
p1=makePicture("pic1.jpg")
p2=makePicture("pic2.jpg")
p3=makePicture("pic3.jpg")
for pix in getPixels(p3):
setRed(pix,255)
for pix in getPixels(p2):
setRed(pix,140)
setGreen(pix,140)
for pix in getPixels(p1):
setGreen(pix,255)
show(p)
wait(0.5)
show(p3)
wait(0.5)
show(p2)
wait(0.5)
show(p1)
wait(0.5)
show(p)
#for the racing part
#14/15
def crossFade():
pic=makePicture("pic14.jpg")
pic2=makePicture("pic15.jpg")
for y in range(getHeight(pic)):
for x in range(getWidth(pic)):
pix=getPixel(pic,x,y)
pix2=getPixel(pic2,x,y)
setRed(pix,getRed(pix2))
setGreen(pix,getGreen(pix2))
setBlue(pix,getBlue(pix2))
wait(0.02)
show(pic)
#29-33
def wetFloor():
for i in range(29,34):
p=makePicture("pic"+str(i)+".jpg")
blackAndWhite(p)
show(p)
def blackAndWhite(pic):
for pix in getPixels(pic):
r=getRed(pix)
b=getBlue(pix)
g=getGreen(pix)
l=(r+b+g)/3
if l<64:
setRed(pix,64)
setBlue(pix,64)
setGreen(pix,64)
elif l>=64 and l<128:
setRed(pix,128)
setBlue(pix,128)
setGreen(pix,128)
elif l>=128 and l<192:
setRed(pix,192)
setBlue(pix,192)
setGreen(pix,192)
else:
setRed(pix,255)
setBlue(pix,255)
setGreen(pix,255)
savePicture(pic,"blackAndWhite.jpg")
show(pic)
def fade(pic):
show(pic)
for pix in getPixels(pic):
r=getRed(pix)
g=getGreen(pix)
b=getBlue(pix)
setRed(pix,r/2)
setBlue(pix,b/2)
setGreen(pix,g/2)
show(pic)
def overlay():
pic=makePicture("pic63.jpg")
pic1=makePicture("1.png")
h=getHeight(pic1)
w=getWidth(pic1)
for x in range(w):
for y in range(h):
pix1=getPixel(pic1,x,y)
pix=getPixel(pic,x+250,y+80)
setRed(pix,getRed(pix1))
setGreen(pix,getGreen(pix1))
setBlue(pix,getBlue(pix1))
show(pic)
#performance code
def performanceCode():
beginningPart()
for i in range(4,14):
p=makePicture("pic"+str(i)+".jpg")
show(p)
wait(0.5)
crossFade()
for i in range(16,29):
p=makePicture("pic"+str(i)+".jpg")
show(p)
wait(0.5)
wetFloor()
for i in range(34,55):
p=makePicture("pic"+str(i)+".jpg")
show(p)
wait(0.5)
for i in range(55,64):
p=makePicture("pic"+str(i)+".jpg")
fade(p)
wait(0.1)
overlay()