Hello friend, JAVA is simple language to develop application in this program which is animated the text with 6 different mode show in below
-
Flow of river
-
/\/\/\/\/\/
-
Flying character
-
Marquee Left to Right
-
Marquee Up to Down
-
Simple
#Program 1
class Ex extends Thread
{
String s;
int mode;
Ex(String s,int mode)
{
this.s=s;
this.mode=mode;
start();
}
public void run()
{
try{ switch(mode)
{
case 1:
river();
break;
case 2:
adu();
break;
case 3:
flay();
break;
case 4:
marqueeLF();
break;
case 5:
marqueeUP();
break;
case 6:
simple();
break;
}
}catch(Exception e){System.out.print("By AP(arpit & pradip)");}
}
public void river() throws Exception
{
int i=0,c=1;
System.out.print(s.substring(i,1)+" ");
i++;
while(i<s.length())
{
i++;
c++;
if(c==8) c=0;
if(i%2==0)
{
System.out.print(s.substring(i,i+1)+" ");
Thread.sleep(150);
}
new ProcessBuilder("cmd","/c","color "+c).inheritIO().start().waitFor();
}
System.out.println();
i=0;
while(i<s.length())
{
c++;
if(c==8) c=0;
if(!(i%2==0))
{
System.out.print(" "+s.substring(i,i+1));
Thread.sleep(150);
}
new ProcessBuilder("cmd","/c","color "+c).inheritIO().start().waitFor();
i++;
}
}
public void adu()throws Exception
{
int i=0,sp=0,c=0;
if(s.length()<5) System.out.print("give 10 or more lenght for propitery output"); int len=s.length(); while(len>0)
{
i=0;
while(i<5)
{
spaces(sp);
System.out.println(s.substring(i,i+1));
i++;
c++;
if(c==8) c=0;
sp+=2;
color(c);
Thread.sleep(150);
if(i==5) len=len-5;
}
while(i<10)
{
spaces(sp);
c++;
if(c==8) c=0;
System.out.println(s.substring(i,i+1));
i++;
sp-=2;
color(c);
Thread.sleep(150);
if(i==10) len=len-5;
}
}
}
public void flay() throws Exception
{
int i=0,sp=0,c=0;
if(s.length()<5) System.out.print("give 10 or more lenght for propitery output"); int len=s.length(); while(len>0)
{
i=0;
while(i<5)
{
spaces(sp);
System.out.println(s.substring(i,i+1));
i++;
c++;
if(c==8) c=0;
sp+=2;
color(c);
Thread.sleep(150);
if(i==5) len=len-5;
new ProcessBuilder("cmd","/c","cls").inheritIO().start().waitFor();
slaceN(c);
}
while(i<10)
{
spaces(sp);
c++;
if(c==8) c=0;
System.out.println(s.substring(i,i+1));
i++;
sp-=2;
color(c);
Thread.sleep(150);
if(i==10) len=len-5;
new ProcessBuilder("cmd","/c","cls").inheritIO().start().waitFor();
slaceN(c);
}
}
}
public void marqueeLF()throws Exception
{
int i=0;
int sp=1;
while(i<20)
{
System.out.print(s);
new ProcessBuilder("cmd","/c","cls").inheritIO().start().waitFor();
spaces(sp);
sp++;
}
}
public void marqueeUP()throws Exception
{
int i=0;
int sp=1;
while(i<20) { System.out.print(s); new ProcessBuilder("cmd","/c","cls").inheritIO().start().waitFor(); if(sp>20)
{
sp=1;
}
slaceN(sp);
sp++;
i++;
Thread.sleep(100);
}
}
public void simple()throws Exception
{
int i=0;
int c=0;
while(i<s.length())
{
System.out.print(s.substring(i,i+1));
i++;
color(c);
c++;
Thread.sleep(250);
}
}
public void slaceN(int n)
{
for(int i=0;i<n;i++)
{
System.out.println();
}
}
public void spaces(int n)
{
for(int i=0;i<n;i++) System.out.print(" "); } public void color(int c) throws Exception { new ProcessBuilder("cmd","/c","color "+c).inheritIO().start().waitFor(); } public static void main(String args[]) { Ex e1=new Ex(args[0],Integer.parseInt(args[1])); //1->flow of river
//2->/\/\/\/\/\
//3->flay
//4->marque left to right
//5->marque up to down
}
}
Output: video At top of website
Comments
Post a Comment