-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConsoleAnimator.java
66 lines (57 loc) · 1.5 KB
/
ConsoleAnimator.java
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
public class ConsoleAnimator{
public static void displayVacio(int n,int m){
for (int i=0;i<n;i++)
{
for (int j=0;j<m;j++)
{
System.out.print(" ");
}
System.out.println();
}
}
public static void imprimirDisplay(int n,int m){
String simbolo = Math.random()>5?"*":" ";
for (int i=0;i<n;i++)
{
if(i+1==n)
{
simbolo = "#";
}
for (int j=0;j<m;j++)
{
System.out.print(i+simbolo);
}
System.out.println();
}
}
public static void borrarDisplay(int n){
//Se le suma 1 si se ejecuta con el bat, ya que la ultima linea es el pause
//for (int i=0;i<=n;i++){
//System.out.println(ansi().cursorUpLine(i));
//}
System.out.println(ansi().cursor(2,1));
displayVacio(5,6);
System.out.println(ansi().cursor(1,1));
System.out.println(ansi().reset());
}
public static void animar() throws InterruptedException{
Thread.sleep(1000);
/*
for(int i=0;i<10;i++){
System.out.print("\r");
//System.out.print("\r");
texto = texto+nuevo.charAt(i);
System.out.print(texto);
Thread.sleep(1000);
}*/
}
//Consolas con vt100 http://braun-home.net/michael/info/misc/VT100_commands.htm
//System.out.println("Hallo \033[32mgreen\033[0m-text.");
//System.out.println(ansi().eraseScreen().render("@|red Hello|@ @|green World|@"));
//System.out.println( ansi().fg(RED).a("Hello").newline().fg(GREEN).a(" World").reset() );
//System.out.println("\007");
/*imprimirDisplay(4,16);
Thread.sleep(1000);
borrarDisplay(4);
imprimirDisplay(4,16);*/
}