-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditingCode.py
More file actions
134 lines (108 loc) · 2.84 KB
/
Copy patheditingCode.py
File metadata and controls
134 lines (108 loc) · 2.84 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
#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
#seeing yellow, red, green
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
#cross fade pic14 and pic15
def crossFade(pic14,pic15):
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
#black and white pic from 29 to 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)
#fade for the celebration
def fade(pic):
alist=[pic]
for i in range(10):
for pix in getPixels(pic):
r=getRed(pix)
g=getGreen(pix)
b=getBlue(pix)
setRed(pix,r/1.2)
setBlue(pix,b/1.2)
setGreen(pix,g/1.2)
name=str(i)
a = savePicture(pic,"fade"+name+".jpg")
show(pic)
alist.append(copyPicture(pic))
print("once")
for pix in getPixels(pic):
setRed(pix,0)
setGreen(pix,0)
setBlue(pix,0)
alist.append(copyPicture(pic))
savePicture(alist,"fade.gif")
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)
savePicture(pic,"winner.jpg")