-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMoon.pde
45 lines (37 loc) · 957 Bytes
/
Moon.pde
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
class Moon {
int posX = width - 200;
int posY = 400;
PImage moon;
int moonSize;
Moon(int inpMoonSize) {
moon = loadImage("moon.png");
moonSize = inpMoonSize;
moon.resize(moonSize, moonSize);
}
void drawMoon(int currentHour, int currentMin) {
setMoonPos(currentHour, currentMin);
pushMatrix();
imageMode(CENTER);
tint(245, 243, 206, 255);
image(moon, posX, posY);
popMatrix();
}
void setMoonPos(int currentHour, int currentMin) {
if (currentHour >= 0 && currentHour <= 5) {
int minAmount = 0;
minAmount += currentHour*60;
minAmount += currentMin;
posY = 110 + minAmount;
}
else if (currentHour >= 19 && currentHour <= 23 ) {
int minAmount = 0;
minAmount += (currentHour - 19) * 60;
minAmount += currentMin;
println(minAmount);
posY = 50 + (359 - minAmount );
}
else{
posY = height;
}
}
}