C graphics program to create a text animation


C graphics program to create a text animation


#include <graphics.h>
#include <conio.h>
#include <dos.h>

void main()
{
clrscr();

int d;
int m;
int y;


d=DETECT; // for autodetection
initgraph(&d,&m,"C:\\tc\\bgi");

for(int x=10; x<550; x++)
{
cleardevice();
setcolor(x);
outtextxy(x,100,"Ashish");
delay(5);
}


for(x=550; x>5; x--)
{
cleardevice();
setcolor(x);
outtextxy(x,100,"Shobhit");
delay(5);
}

for(x=300,y = 10; y<400; y++)
{
cleardevice();
setcolor(x);
outtextxy(x,y,"Rajinder");
delay(5);
}


for(x=300, y = 400; y>10; y--)
{
cleardevice();
setcolor(x);
outtextxy(x,y,"Rahul");
delay(5);
}

getch();
closegraph();

}

Output :

when u run this program then four animated texts will be seen moving on the screen one by one in different directions.!!!

0 comments:

Post a Comment