-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cube.pde
72 lines (60 loc) · 1.29 KB
/
Cube.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
class Cube{
float ellipseR = 150;
float x;
float[] colors = new float[3];
float rectHeight = 25;
float waveHeight = 15;
float sqrWidth = 12;
int Number;
boolean isBeat;
PShape rectangle;
PShape circle;
Cube(float xpos,int number){
x = xpos;
Number = number;
// Make a group PShape
if(number <36){
circle = createShape(ELLIPSE,0, 0, ellipseR, ellipseR);
circle.translate(width/2,height/2);
}
stroke(5);
colors[0] = random(1,255);
colors[1] = random(1,255);
colors[2] = random(1,255);
}
void updateCircle(boolean beat){
if(beat){
isBeat = true;
ellipseR += 15;
fill(#1C7AFA);
}
else
{
isBeat = false;
fill(#F0660A);
}
if(Number <37){
circle = createShape(ELLIPSE,0, 0, ellipseR, ellipseR);
circle.translate(width/2,height/2);
}
}
void update(int Vheight){
//fill( colors[0], colors[1], colors[2]);
waveHeight = Vheight;
if(Number <37){
rectangle = createShape(RECT,ellipseR/2, 0, Vheight,sqrWidth);
rectangle.translate(width/2,height/2);
rectangle.rotate(radians(x));
}
if(isBeat)
ellipseR -= 15;
}
void render(){
rect(x,height -50,sqrWidth,-waveHeight);
strokeWeight(2);
if(Number <37){
shape(circle);
shape(rectangle);
}
}
}