Friday, 27 September 2013

Animation


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

void main()
{

   int gdriver = DETECT, gmode;
   int midx, midy;
   int radius = 15;
   int i;

   initgraph(&gdriver, &gmode, "c:\\turboc3\\bgi");

   midy = getmaxy() / 2;
   setcolor(RED);

   for(i=3;i<49;i++)
   {

    delay(100);
    cleardevice();

   circle(20,midy-40,radius);
   line(2,midy-20,20,midy-10);
   line(40,midy-20,20,midy-10);
   line(20,midy-25,20,midy);
   line(20,midy,10,midy+30);

   line(20,midy,(float)(30+0.3*i),(float)((midy+30)-(0.3*i)));

   circle(i*10, midy+15, radius);

   circle(510,midy-40,radius);
   line(490,midy-20,510,midy-10);
   line(530,midy-20,510,midy-10);
   line(510,midy-25,510,midy);
   line(510,midy,500,midy+30);
   line(510,midy,520,midy+30);
   }


     for(i=49;i>3;i--)
   {

    delay(100);
     cleardevice();

   circle(20,midy-40,radius);
   line(2,midy-20,20,midy-10);
   line(40,midy-20,20,midy-10);
   line(20,midy-25,20,midy);
   line(20,midy,10,midy+30);
   line(20,midy,30,midy+30);
   circle(i*10, midy+15, radius);

   circle(510,midy-40,radius);
   line(490,midy-20,510,midy-10);
   line(530,midy-20,510,midy-10);
   line(510,midy-25,510,midy);
   line(510,midy,520,midy+30);


    line(510,midy,(float)(500-0.3*i),(float)((midy+30)-(0.3*i)));
   }






   circle(510,midy-40,radius);
   line(510,midy-25,510,midy);

   line(510,midy,520,midy+30);

   /* clean up */
   getch();
   closegraph();
}
Jerrin Andrei Web Developer

No comments:

Post a Comment

Total Pageviews

DjKiRu Initative. Powered by Blogger.