Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int[] start = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
- int[] toadd = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
- String[] names ={"Magenta","Purple","Tan","Orange","Lime","Red","Blue","Lavender","Yellow","Brown","Gray","Navy","Olive","Pink","Cyan","Green"};
- int[] waias = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
- int[] waiae = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
- boolean[] taken = {false,false,false,false,
- false,false,false,false,false,false,false,false,
- false,false,false,false};
- int timer, maxScore, x, y;
- int[][] colors = {{255,0,255},{120,0,255},{210,180,140},{255,120,0},{0,255,0},{255,0,0},{0,120,255},{202,145,222},{255,255,0},{130,65,0},{120,120,120},{0,30,145},{120,120,0},{255,100,255},{0,255,255},{0,145,0}};
- String[] after = {"st","nd","rd","th","th","th",
- "th","th","th","th","th","th","th","th","th","th"};
- PFont font;
- PFont font2;
- int margin = 100;
- float perc = 0;
- void setup(){
- font = loadFont("Arial-BoldMT-48.vlw");
- font2 = loadFont("Impact-48.vlw");
- size(1280,720);
- for(int i = 0; i < 16; i++){
- int record = 0;
- int recordHolder = 0;
- for(int j = 15; j >= 0; j--){
- if(start[j] >= record && !taken[j]){
- record = start[j];
- recordHolder = j;
- }
- }
- taken[recordHolder] = true;
- waias[recordHolder] = i;
- }
- for(int i = 0; i < 16; i++){
- taken[i] = false;
- }
- for(int i = 0; i < 16; i++){
- int record = 0;
- int recordHolder = 0;
- for(int j = 15; j >= 0; j--){
- if(start[j]+toadd[j] >= record && !taken[j]){
- record = start[j]+toadd[j];
- recordHolder = j;
- }
- }
- taken[recordHolder] = true;
- waiae[recordHolder] = i;
- if(i == 0) maxScore = record;
- }
- textFont(font,40);
- noStroke();
- frameRate(60);
- }
- void draw(){
- background(0);
- if(timer < 1200){
- fill(80);
- rect(0,0,margin,height);
- timer++;
- textAlign(LEFT);
- fill(255);
- for(int i = 0; i < 16; i++){
- text((i+1)+after[i],margin-93,35+45*i);
- }
- if(timer < 480){
- perc = max((float(timer)-180)/300,0);
- }else{
- perc = min(max((float(timer)-480)/300,0),1);
- perc = -cos(perc*PI)/2+0.5;
- }
- for(int j = 0; j < 16; j++){
- fill(colors[j][0],colors[j][1],colors[j][2]);
- if(timer < 480){
- x = int(1020*(start[j]+float(toadd[j])*perc)/maxScore);
- y = 45*waias[j];
- }else{
- x = int(1020*(start[j]+toadd[j])/maxScore);
- y = int((waias[j]+(float(waiae[j])-float(waias[j]))*perc)*45);
- }
- rect(margin,5+y,x,35);
- textAlign(LEFT);
- text(names[j],margin+x+5,35+y);
- fill(0);
- textAlign(RIGHT);
- if(timer < 480){
- text(addCommas(round((start[j]+toadd[j]*perc))),margin+x,35+y);
- }else{
- text(addCommas(start[j]+toadd[j]),margin+x,35+y);
- }
- if(waiae[j] >= 16){
- fill(255,25,0);
- textFont(font2,44);
- textAlign(LEFT);
- text("ELIMINATED",names[j].length()*20+130+x,37+y);
- textFont(font,40);
- }
- }
- //saveFrame("images\\####.png");
- }
- }
- String addCommas(int n){
- String s = n+"";
- String output = "";
- for(int i = 0; i < s.length(); i++){
- if(i >= 1 && (s.length()-i)%3 == 0){
- output = output+",";
- }
- output = output+s.charAt(i);
- }
- return output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement