Logo 
Search:

C++ Programming Articles

Submit Article
Home » Articles » C++ Programming » Computer GraphicsRSS Feeds

Text Animation in Graphics Screen

Posted By: Easy Tutor     Category: C++ Programming     Views: 19917

Program of text Animation in Graphics Screen

Code for Text Animation in Graphics Screen in C++ Programming

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

class Banner
{
   char *str,ch;
   public:

   //Constructor is here of no use...
   Banner(){
       str="Program of text animation...";
   }
   void scroll();
   void alternate();
   void anim1();
};

void  Banner :: scroll(){
      int i,j,location,n,c=10;
      strcpy(str,"           Vivek Patel          ");
      for(i=0;!kbhit();i++){
      //   cleardevice();/********For Clearing Part of Screen by Drawing Lines*/
         setfillstyle(SOLID_FILL,BLACK);
         bar(50,50,600,90);
       /////multicolor bannerif(c==14)
         c=10;
       else
         c++;
       setcolor(c);
       //////
       settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);
       outtextxy(50,50,str);
       delay(350);
       ch = str[0];
       //////substring logic
       n=strlen(str);
       location=0;
       for(j=location;j<n;j++){
         str[j] = str[j+1];
       }
       ///appending char at end
       str[n-1]=ch;
       str[n]=NULL;
      }
}


void  Banner :: alternate(){
      int i,j,c=10,flag=0;
      strcpy(str,"Website : www.syntax-example.com");
      for(i=0;!kbhit();){
       /********For Clearing Part of Screen by Drawing Lines*/
         setfillstyle(SOLID_FILL,BLACK);
         bar(50,200,600,240);
       /////multicolor bannerif(c==14)
         c=10;
       else
         c++;
       setcolor(c);
       //////
       settextstyle(SMALL_FONT,HORIZ_DIR,6);
       if(flag==0){
           i++;
           if(i==200)  flag=1;  //Extreme Right
       }
       else{
          i--;
          if(i==0) flag=0;   //Extreme Left
        }
       outtextxy(50+i,200,str);
       delay(5);
      }
}

void main(){
   int gd=DETECT,gm;
   Banner obj;

   initgraph(&gd,&gm,"");

   obj.scroll();
   getch();


   obj.alternate();
   getch();

   closegraph();
}
  
Share: 


Didn't find what you were looking for? Find more on Text Animation in Graphics Screen Or get search suggestion and latest updates.

Easy Tutor
Easy Tutor author of Text Animation in Graphics Screen is from United States. Easy Tutor says

Hello Friends,

I am Free Lance Tutor, who helped student in completing their homework.

I have 4 Years of hands on experience on helping student in completing their homework. I also guide them in doing their final year projects.

I have share many programs on this website for everyone to use freely, if you need further assistance, than please contact me on easytutor.2ya [at the rate] gmail [dot] com

I have special discount scheme for providing tutor services. I am providing tutor service to students from various contries, currently most of my students are from United States, India, Australia, Pakistan, Germany, UK and Canada.

I am also here to expand my technical network to receive more opportunity in my career, make friends to help them in resolving their technical problem, learn and share my knowledge, If you like to be my friend, Please send me friend request.

Thanks,
Happy Programming :)

 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!