-
Notifications
You must be signed in to change notification settings - Fork 0
/
PlayButton.pde
53 lines (48 loc) · 892 Bytes
/
PlayButton.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
46
47
48
49
50
51
52
class PlayButton {
float x;
float y;
float d;
PlayButton (float x_, float y_, float d_) {
x = x_;
y = y_;
d = d_;
}
boolean contains(float mx, float my) {
if (dist(mx, my, x, y) < d/1.25) {
return true;
}
else {
return false;
}
}
void displayStopped(float mx, float my) {
noFill();
stroke(0);
strokeWeight(1);
ellipseMode(CENTER);
ellipse(x, y, d, d);
if (contains(mx, my)) {
fill(42, 211, 28);
}
else {
noFill();
}
triangle(x-17, y-22, x-17, y+22, x+25, y);
}
void displayPlaying(float mx, float my) {
noFill();
stroke(0);
strokeWeight(1);
ellipseMode(CENTER);
ellipse(x, y, d, d);
if (contains(mx, my)) {
fill(240, 22, 22);
}
else {
noFill();
}
rectMode(CENTER);
rect(x, y, d/2, d/2);
stroke(240, 22, 22);
}
}