Monday 31 March 2014

How To Create A Stylish Animated Loading Effect In Turbo C++ .


Hi guys this is my first tutorial on graphics animation in c++ .In this C++ video tutorial, we demonstrate how to create a Loading animation in C++ with some blinking effect . You can download the project using the link below the tutorial.

The output of the program looks like this:








So here is the code 

#include<graphics.h>
#include<conio.h>
#include<dos.h>
#include<iostream.h>
#include<stdlib.h>
void main()
{
 int x,y,i;
 int g=DETECT, d;
 initgraph(&g, &d,"C:\\TC\\BGI");
 cleardevice();
 x=getmaxx()/2;
 y=getmaxy()/2;
 settextstyle(TRIPLEX_FONT,HORIZ_DIR,3);
 setbkcolor(rand());
 setcolor(4);
 int c=150;
for(int e=0;e<15;e++) //Change 15 to your desired value  
 {
  for(int i=50;i<100;i++)
  {
    setcolor(3);
    settextstyle(SMALL_FONT, HORIZ_DIR, 10);
    outtextxy(x,y,"Loading...");
    settextstyle(SMALL_FONT, HORIZ_DIR, 5);
    outtextxy(x+5,y+5,"Please Wait... ");
    circle(x,y,i);
    circle(x,y,c);
    c--;
    cleardevice();
  }
  }
  setcolor(6);
  settextstyle(SMALL_FONT, HORIZ_DIR, 10);
  settextjustify(x,y);
  outtextxy(x-70,y-60,"WELCOME");
  delay(150);
  outtextxy(x-70,y-20,"TO");
  delay(150);
  outtextxy(x-10,y-20,"THE");
  delay(150);
  outtextxy(x-70,y+15,"FUTURE");
  getch();
 closegraph();

 }

Some Important Things To Note:

  setcolor(6);
  settextstyle(SMALL_FONT, HORIZ_DIR, 10);
  settextjustify(x,y);
  outtextxy(x-70,y-60,"WELCOME");
  delay(150);
  outtextxy(x-70,y-20,"TO");
  delay(150);
  outtextxy(x-10,y-20,"THE");
  delay(150);
  outtextxy(x-70,y+15,"FUTURE");


  •  The above code is a sample created.You could change this to your desired program code.



setcolor(3); 


  •  Here the color is fixed to a particular color. If you want to have different colors just change the above code to 
  Setcolor(rand());

  • Or if you want to change the color just change 3 to your desired color code 


for(int e=0;e<15;e++)
  • If you want to change the length of loading animation just change the value 15 to your desired value.


Download The CPP:

Sunny George

Author & Editor

Hi I am a freelance web designer and developer with a passion for interaction design. Iam studying in RSET and has a weakness for Photography.

8 comments:

  1. Nice post bro!! it look so cool. Keep on posting :)

    ReplyDelete
  2. Amazing as always…

    ReplyDelete
  3. high level of imagination, great ide…xixixi

    ReplyDelete
  4. It shows a error,,,like
    Undefined symbol _closegraph
    Undefined symbol _ setcolor
    And etc....
    Plzz help me

    ReplyDelete
    Replies
    1. If u get errors try installing turboc3
      link : https://turboc.codeplex.com/
      Hope it helps.
      Thanks ,

      Delete

Popular Posts