SHOW:
|
|
- or go back to the newest paste.
1 | int[] start = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; | |
2 | int[] toadd = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; | |
3 | - | String[] names ={"White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White"}; |
3 | + | String[] names ={Amarillo","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White","White"}; |
4 | int[] waias = {0,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}; | |
5 | int[] waiae = {0,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}; | |
6 | boolean[] taken = {false,false,false,false, | |
7 | false,false,false,false,false,false,false,false, | |
8 | false,false,false,false,false,false,false,false, | |
9 | false,false,false,false,false,false,false,false, | |
10 | false,false,false,false,false,false}; | |
11 | int timer, maxScore, x, y; | |
12 | int[][] colors = {{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255}}; | |
13 | String[] after = {"st","nd","rd","th","th","th", | |
14 | "th","th","th","th","th","th","th","th","th", | |
15 | "th","th","th","th","th","st","nd","rd","th", | |
16 | "th","th","th","th","th","th"}; | |
17 | PFont font; | |
18 | PFont font2; | |
19 | int margin = 100; | |
20 | float perc = 0; | |
21 | void setup(){ | |
22 | font = loadFont("Verdana-48.vlw"); | |
23 | font2 = loadFont("Verdana-BoldItalic-48.vlw"); | |
24 | size(1280,720); | |
25 | for(int i = 0; i < 30; i++){ | |
26 | int record = 0; | |
27 | int recordHolder = 0; | |
28 | for(int j = 29; j >= 0; j--){ | |
29 | if(start[j] >= record && !taken[j]){ | |
30 | record = start[j]; | |
31 | recordHolder = j; | |
32 | } | |
33 | } | |
34 | taken[recordHolder] = true; | |
35 | waias[recordHolder] = i; | |
36 | } | |
37 | for(int i = 0; i < 30; i++){ | |
38 | taken[i] = false; | |
39 | } | |
40 | for(int i = 0; i < 30; i++){ | |
41 | int record = 0; | |
42 | int recordHolder = 0; | |
43 | for(int j = 29; j >= 0; j--){ | |
44 | if(start[j]+toadd[j] >= record && !taken[j]){ | |
45 | record = start[j]+toadd[j]; | |
46 | recordHolder = j; | |
47 | } | |
48 | } | |
49 | taken[recordHolder] = true; | |
50 | waiae[recordHolder] = i; | |
51 | if(i == 0) maxScore = record; | |
52 | } | |
53 | textFont(font,20); | |
54 | noStroke(); | |
55 | frameRate(60); | |
56 | } | |
57 | void draw(){ | |
58 | background(0); | |
59 | if(timer < 1200){ | |
60 | fill(80); | |
61 | rect(0,0,margin,height); | |
62 | timer++; | |
63 | textAlign(LEFT); | |
64 | fill(255); | |
65 | for(int i = 0; i < 30; i++){ | |
66 | text((i+1)+after[i],margin-93,35+23*i); | |
67 | } | |
68 | if(timer < 480){ | |
69 | perc = max((float(timer)-180)/300,0); | |
70 | }else{ | |
71 | perc = min(max((float(timer)-480)/300,0),1); | |
72 | perc = -cos(perc*PI)/2+0.5; | |
73 | } | |
74 | for(int j = 0; j < 30; j++){ | |
75 | fill(colors[j][0],colors[j][1],colors[j][2]); | |
76 | if(timer < 480){ | |
77 | x = int(1020*(start[j]+float(toadd[j])*perc)/maxScore); | |
78 | y = 23*waias[j]; | |
79 | }else{ | |
80 | x = int(1020*(start[j]+toadd[j])/maxScore); | |
81 | y = int((waias[j]+(float(waiae[j])-float(waias[j]))*perc)*23); | |
82 | } | |
83 | rect(margin,16+y,x,20); | |
84 | textAlign(LEFT); | |
85 | text(names[j],margin+x+5,35+y); | |
86 | fill(0); | |
87 | textAlign(RIGHT); | |
88 | if(timer < 480){ | |
89 | text(addCommas(round((start[j]+toadd[j]*perc))),margin+x,35+y); | |
90 | }else{ | |
91 | text(addCommas(start[j]+toadd[j]),margin+x,35+y); | |
92 | } | |
93 | if(waiae[j] >= 30){ | |
94 | fill(255,25,0); | |
95 | textFont(font2,20); | |
96 | textAlign(LEFT); | |
97 | text("ELIMINATED",names[j].length()*10+130+x,37+y); | |
98 | textFont(font,20); | |
99 | } | |
100 | } | |
101 | //saveFrame("images\\####.png"); | |
102 | } | |
103 | } | |
104 | String addCommas(int n){ | |
105 | String s = n+""; | |
106 | String output = ""; | |
107 | for(int i = 0; i < s.length(); i++){ | |
108 | if(i >= 1 && (s.length()-i)%3 == 0){ | |
109 | output = output+","; | |
110 | } | |
111 | output = output+s.charAt(i); | |
112 | } | |
113 | return output; | |
114 | } |