forked from AmrSaber/ComputerGraphics-OpenGL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStar.pde
46 lines (36 loc) · 837 Bytes
/
Star.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
class Star{
private int x,y;
private float s;
private color clr = color(random(50,255));
private int counterLimit = 100;
private int counter = (int) random(0, counterLimit);
public Star(int x ,int y ,float s){
this.x = x;
this.y = y;
this.s = s;
}
public void display() {
counter++;
if(counter == counterLimit){
counter = 0;
clr = color(random(100,255));
}
pushMatrix();
translate(x, y, 2);
fill(clr);
beginShape();
vertex(0, -50, 0);
vertex(14, -20, 0);
vertex(47, -15, 0);
vertex(23, 7, 0);
vertex(29, 40, 0);
vertex(0, 25, 0);
vertex(-29, 40, 0);
vertex(-23, 7, 0);
vertex(-47, -15, 0);
vertex(-14, -20, 0);
scale(s);
endShape(CLOSE);
popMatrix();
}
}