Text in console Flickers

Question:
Is there any way to fix the flickering of the “Loading Complete!” text?

Repl link:
https://replit.com/@JosephBlachly1/PristineShyProblem#src/main/java/Main.java

        System.out.print("\033[H\033[2J");
         System.out.println("\n        \\" + "\nLoading Complete!");
      try {
          Thread.sleep(100); 
      } catch (InterruptedException e) {
          e.printStackTrace();
      }
      System.out.print("\033[H\033[2J");
      System.out.println("\n        |" + "\nLoading Complete!");
      try {
          Thread.sleep(100); 
      } catch (InterruptedException e) {
          e.printStackTrace();
      }
      System.out.print("\033[H\033[2J");
      System.out.println("         /" + "\n\nLoading Complete!");
      try {
          Thread.sleep(100); 
      } catch (InterruptedException e) {
          e.printStackTrace();
      }
      System.out.print("\033[H\033[2J");
      System.out.println("         -" + "\n\nLoading Complete!");
      try {
          Thread.sleep(100); 
      } catch (InterruptedException e) {
          e.printStackTrace();
      }
1 Like

it’s flickering because you are constantly clearing the console and replit’s api is too slow to actually send you back your data in a timely manner as to not lag
edit: I know this because I’ve tested stress tests of clearing the screen as many times as possible to see how long it takes to lag and replit exponentially slower than smaller services with much smaller servers so I assume it’s from the API but I don’t know why exactly

4 Likes

Oh, okay. Thanks for the help!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.