Skip to main content

How to create Loading Animation in C language


 Make loading animation

Using C programming language

Loading Animation img
#include<stdio.h> #include<conio.h> #include<graphics.h> // header file for graphics functions #include<dos.h> int main() {      int gd=DETECT;
      int gm,i,j,k,midx,midy;   //variable to be used
     initgraph(&gd,&gm,"C:\\Turboc3\\BGI");  //initializing and setting the path of graphics file

     midx=getmaxx()/2;     //getting center of x-axis
     midy=getmaxy()/2;     //getting center of y-axis

 for(j=1;j<10;j++)
    {
      for(i=2,k=340;i<340,k>2;i=i+10,k=k-10)
      {
       setcolor(j);
       arc(midx,midy,0+i,40+i,40);            // creating the upper arc
       setcolor(j+1);
       arc(midx,midy,50+k,80+k,40);            // creating the lower arc
       delay(30);  //providing the delay between animations
       cleardevice();   //clearing the screen
      }

    }
     setcolor(5);
     settextstyle(7,HORIZ_DIR,1);           // setting text style and direction
     //text to be displayed after full loading
    outtextxy(midx-140,midy,"PAGE LOADED SUCCESSFULLY !!!");
     getch();    // holding the screen after animation is completed
     closegraph();    //closing the graphics file


     return 0;
}




Watch Video: https://youtu.be/VUyq0I8ZMOo



Comments