TEXT ANIMATION

CODING:

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
//void move(int,int,int,int,char);
main()
{
int gd=DETECT,gm;
int sx,sy,tx,ty;
char t[20];
initgraph(&gd,&gm,"");
printf("\nEnter the Text");
scanf("%s",&t);
printf("\nEnter the Initiation Points");
scanf("%d%d",&sx,&sy);
printf("\nEnter the Largest Points");
scanf("%d%d",&tx,&ty);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,5);
outtextxy(sx,sy,t);
cleardevice();
move(sx,sy,tx,ty,t);
getch();
}
move(int sx,int sy,int tx,int ty,char t[50])
{
 int dx=tx-sx,dy=ty-sy,step,k;
 float xin,yin,x=sx,y=sy;
 getch();
 if(abs(dx)>abs(dy))
 step=abs(dx);
 else
 step=abs(dy);
 xin=dx/(float)step;
 yin=dy/(float)step;
 for(k=0;k<step;k++)
 {
  cleardevice();
  x+=xin;
  y+=yin;
  setcolor(15);
  outtextxy(x,y,t);
 }
 delay(1);
}


OUTPUT:



Comments

POPULAR POSTS

POPULAR POSTS