SHARE
TWEET

Untitled

a guest Oct 9th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 ={Amarillo","Az
  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"
  16. PFont font;
  17. PFont font2;
  18. int margin = 100;
  19. float perc = 0;
  20. void setup(){
  21.   font = loadFont("Verdana-48.vlw");
  22.   font2 = loadFont("Verdana-BoldItalic-48.vlw");
  23.   size(1280,720);
  24.   for(int i = 0; i < 30; i++){
  25.     int record = 0;
  26.     int recordHolder = 0;
  27.     for(int j = 29; j >= 0; j--){
  28.       if(start[j] >= record && !taken[j]){
  29.         record = start[j];
  30.         recordHolder = j;
  31.       }
  32.     }
  33.     taken[recordHolder] = true;
  34.     waias[recordHolder] = i;
  35.   }
  36.   for(int i = 0; i < 30; i++){
  37.     taken[i] = false;
  38.   }
  39.   for(int i = 0; i < 30; i++){
  40.     int record = 0;
  41.     int recordHolder = 0;
  42.     for(int j = 29; j >= 0; j--){
  43.       if(start[j]+toadd[j] >= record && !taken[j]){
  44.         record = start[j]+toadd[j];
  45.         recordHolder = j;
  46.       }
  47.     }
  48.     taken[recordHolder] = true;
  49.     waiae[recordHolder] = i;
  50.     if(i == 0) maxScore = record;
  51.   }
  52.   textFont(font,20);
  53.   noStroke();
  54.   frameRate(60);
  55. }
  56. void draw(){
  57.   background(0);
  58.   if(timer < 1200){
  59.     fill(80);
  60.     rect(0,0,margin,height);
  61.     timer++;
  62.     textAlign(LEFT);
  63.     fill(255);
  64.     for(int i = 0; i < 30; i++){
  65.       text((i+1)+after[i],margin-93,35+23*i);
  66.     }
  67.     if(timer < 480){
  68.       perc = max((float(timer)-180)/300,0);
  69.     }else{
  70.       perc = min(max((float(timer)-480)/300,0),1);
  71.       perc = -cos(perc*PI)/2+0.5;
  72.     }
  73.     for(int j = 0; j < 30; j++){
  74.       fill(colors[j][0],colors[j][1],colors[j][2]);
  75.       if(timer < 480){
  76.         x = int(1020*(start[j]+float(toadd[j])*perc)/maxScore);
  77.         y = 23*waias[j];
  78.       }else{
  79.         x = int(1020*(start[j]+toadd[j])/maxScore);
  80.         y = int((waias[j]+(float(waiae[j])-float(waias[j]))*perc)*23);
  81.       }
  82.       rect(margin,16+y,x,20);
  83.       textAlign(LEFT);
  84.       text(names[j],margin+x+5,35+y);
  85.       fill(0);
  86.       textAlign(RIGHT);
  87.       if(timer < 480){
  88.   text(addCommas(round((start[j]+toadd[j]*perc))),margin+x,35+y);
  89.       }else{
  90.         text(addCommas(start[j]+toadd[j]),margin+x,35+y);
  91.       }
  92.       if(waiae[j] >= 30){
  93.         fill(255,25,0);
  94.         textFont(font2,20);
  95.         textAlign(LEFT);
  96.         text("ELIMINATED",names[j].length()*10+130+x,37+y);
  97.         textFont(font,20);
  98.       }
  99.     }
  100.     //saveFrame("images\\####.png");
  101.   }
  102. }
  103. String addCommas(int n){
  104.   String s = n+"";
  105.   String output = "";
  106.   for(int i = 0; i < s.length(); i++){
  107.     if(i >= 1 && (s.length()-i)%3 == 0){
  108.       output = output+",";
  109.     }
  110.     output = output+s.charAt(i);
  111.   }
  112.   return output;
  113. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top