Posts

Showing posts with the label c graphics program for animation

How To Create Simple Mickey Mouse Animation in C Or C++ (Computer Graphics)

Image
                                                                                          PROJECT BY (SIMPLIFY LEARN PROGRAMMING)  ON MICKEY MOUSE ANIMATION SOURCE CODE: #include<graphics.h> #include<conio.h> void main() {     int gd=0,gm=0;     initgraph(&gd,&gm,"C:\\TC\\BGI");     setcolor(7);     circle(150,150,20);     circle(210,150,20);     circle(180,212,50);     ellipse(170,212,60,180,20,40);     ellipse(190,212,0,120,20,40);     ellipse(140,248,60,120,20,40);     ellipse(220,248,60,120,20,40);     ellipse(172,200,0,360,6,15);     ellipse(188,200,0,360,6,15);     ellipse(182,220,10,160,12,6);     ellipse(182,225,0,360,12,6);     ellipse(182,225,195,345,25,30);     ellipse(182,225,195,345,25,20);     ellipse(172,208,0,360,2,6);     ellipse(188,208,0,360,2,6);     getch(); }

How To Create Tan Graph Animation in C Or C++ (Computer Graphics)

Image
                                                                                         PROJECT BY (SIMPLIFY LEARN PROGRAMMING)  ON TAN GRAPH ANIMATION SOURCE CODE: #include<conio.h> #include<math.h> #include<graphics.h> #include<dos.h> void main() { int gd=DETECT,gm; int angle=0; double x,y; initgraph(&gd,&gm,"C:\\TC\\BGI"); line(0,getmaxy()/2,getmaxx(),getmaxy()/2); for(x=0;x<getmaxx();x++) { y=50*tan(angle*3.141/180); y=getmaxy()/2-y; putpixel(x,y,15); delay(50); angle+=2; } getch(); closegraph(); }

How To Create Stars In Night Sky Animation in C Or C++ (Computer Graphics)

Image
                                                                                        PROJECT BY (SIMPLIFY LEARN PROGRAMMING)  ON STARS IN NIGHT SKY ANIMATION SOURCE CODE: #include<conio.h> #include<graphics.h> #include<dos.h> #include<stdlib.h> void main() { int gd=DETECT,gm; int i,x,y; initgraph(&gd,&gm,"C:\\TC\\BGI"); while(!kbhit()) { for(i=0;i<500;i++) { x=rand()%getmaxx(); y=rand()%getmaxy(); putpixel(x,y,15); } delay(500); cleardevice(); } getch(); closegraph(); }

How To Create Smiley Face Animation in C Or C++ (Computer Graphics)

Image
                                                                                         PROJECT BY (SIMPLIFY LEARN PROGRAMMING)  ON SMILEY FACE ANIMATION SOURCE CODE: #include<graphics.h> #include<conio.h> #include<stdlib.h> void main() {    int gd = DETECT, gm, area, temp1, temp2, left = 25, top = 75;    void *p;    initgraph(&gd,&gm,"..\\bgi");    setcolor(YELLOW);    circle(50,100,25);    setfillstyle(SOLID_FILL,YELLOW);    floodfill(50,100,YELLOW);    setcolor(RED);    setfillstyle(SOLID_FILL,RED);    fillellipse(44,85,2,6);    fillellipse(56,85,2,6);    ellipse(50,100,205,335,20,9);    ellipse(50,100,205,335,20,10);    ellipse(50,100,205,335,20,11);    area = imagesize(left, top, left + 50, top + 50);    p = malloc(area);    setcolor(WHITE);    settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2);    outtextxy(155,451,"Smiling Face Animation");    setcolor(BLUE);    rectangle(0,0,639,449);    while(!kbhit())    {       temp1 = 1 + random ( 588 )

How To Create Pie Chart With Value Enter By User Animation in C Or C++ (Computer Graphics)

Image
                                                                                         PROJECT BY (SIMPLIFY LEARN PROGRAMMING)  ON PIE CHART WITH VALUE ENTER BY USER ANIMATION SOURCE CODE: #include<stdio.h> #include<graphics.h> #include<conio.h> #include<dos.h> #include<stdlib.h> void main() { int gd=DETECT,gm; float x=0,y=0,tm,m; int c=1,n=5; initgraph(&gd,&gm,"C:\\TC\\BGI"); setcolor(BLUE); pieslice(300,250,0,360,100); printf("Enter Total Marks:"); scanf("%f",&tm); while(n>0) { printf("Enter Marks:"); scanf("%f",&m); setfillstyle(1,c); c++; y=y+((m/tm)*360); pieslice(300,250,x,y,100); x=y; n--; } getch(); closegraph(); }

How To Create Pie Chart Animation in C Or C++ (Computer Graphics)

Image
                                                                                         PROJECT BY (SIMPLIFY LEARN PROGRAMMING)  ON PIE CHART ANIMATION SOURCE CODE: #include<graphics.h> #include<conio.h> void main() { int gd = DETECT, gm, midx, midy; initgraph(&gd, &gm, "C:\\TC\\BGI"); settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2); setcolor(WHITE); outtextxy(275,80,"PIE CHART"); midx = getmaxx()/2; midy = getmaxy()/2; setfillstyle(LINE_FILL,BLUE); pieslice(midx, midy, 0, 75, 100); setfillstyle(XHATCH_FILL,RED); pieslice(midx, midy, 75, 225, 100); setfillstyle(WIDE_DOT_FILL,GREEN); pieslice(midx, midy, 225, 360, 100); getch(); }

How To Create Sine Wave Animation in C Or C++ (Computer Graphics)

Image
                                                                                         PROJECT BY (SIMPLIFY LEARN PROGRAMMING)  ON SINE WAVE ANIMATION SOURCE CODE: #include<conio.h> #include<math.h> #include<graphics.h> #include<dos.h> void main() { int gd=DETECT,gm; int angle=0; double x,y; initgraph(&gd,&gm,"C:\\TC\\BGI"); line(0,getmaxy()/2,getmaxx(),getmaxy()/2); for(x=0;x<getmaxx();x+=3) { y=50*sin(angle*3.141/180); y=getmaxy()/2-y; putpixel(x,y,15); delay(100); angle+=5; } getch(); closegraph(); }

How To Create Flying Kite Animation in C Or C++ (Computer Graphics)

Image
                                                                                        PROJECT BY (SIMPLIFY LEARN PROGRAMMING)  ON FLYING KITE ANIMATION SOURCE CODE: #include<stdio.h> #include<dos.h> #include<graphics.h> void main() {     int gd=DETECT,gm;     int color;     int x=10,y=1,inc_x=10,inc_y=10;     int poly[10];     initgraph(&gd,&gm,"C:\\TC\\BGI");     while(!kbhit())     {         x += inc_x;         if(x > getmaxx()-175)             inc_x = -5; if(x < 0 )     inc_x = 10; y += inc_y; if(y > 200)     inc_y = -10; if(y < 0 )     inc_y = 10; cleardevice(); setcolor(WHITE); setbkcolor(LIGHTBLUE); poly[0]=100+x; poly[1]=50+y; poly[2]=140+x; poly[3]=100+y; poly[4]=100+x; poly[5]=155+y; poly[6]=60+x; poly[7]=100+y; poly[8]=100+x; poly[9]=50+y; drawpoly(5,poly); setfillstyle(SOLID_FILL,GREEN); fillpoly(5,poly); setcolor(BLUE); setlinestyle(SOLID_LINE,1,3); line(100+x,155+y,100+x,3

How To Create Concentric Ellipse Animation in C Or C++ (Computer Graphics)

Image
                                                                                         PROJECT BY (SIMPLIFY LEARN PROGRAMMING)  ON CONCENTRIC ELLIPSE ANIMATION SOURCE CODE: #include<stdio.h> #include<graphics.h> #include<conio.h> #include<dos.h> #include<stdlib.h> void main() { int i,r1,r2,n,j=2,xr=200,yr=100; int gd=DETECT,gm; initgraph(&gd,&gm,"C:\\TC\\BGI"); printf("Enter The No. of Ellipse:"); scanf("%d",&n); r1=xr/n; r2=yr/n; for(i=0;i<n;i++) { setfillstyle(1,j); ellipse(300,200,0,360,xr,yr); if(j==10) j=2; xr=xr-r1; yr=yr-r2; j++; } getch(); }

How To Create Circles in Circles Animation in C Or C++ (Computer Graphics)

Image
                                                                                        PROJECT BY (SIMPLIFY LEARN PROGRAMMING)  ON CIRCLES IN CIRCLE ANIMATION SOURCE CODE: #include<graphics.h> #include<conio.h> #include<dos.h>   main() {    int gd = DETECT, gm, x, y, color, angle = 0;    struct arccoordstype a, b;      initgraph(&gd, &gm, "C:\\TC\\BGI");    delay(2000);    while(angle<=360)    {       setcolor(BLACK);       arc(getmaxx()/2,getmaxy()/2,angle,angle+2,100);       setcolor(YELLOW);       getarccoords(&a);       circle(a.xstart,a.ystart,25);       setcolor(BLACK);       arc(getmaxx()/2,getmaxy()/2,angle,angle+2,150);       getarccoords(&a);       setcolor(GREEN);       circle(a.xstart,a.ystart,25);       setcolor(BLACK);       arc(getmaxx()/2,getmaxy()/2,angle,angle+2,50);       setcolor(RED);       getarccoords(&a);       circle(a.xstart,a.ystart,25);       angle = angle+5;       delay(50);    }    getch();    closegraph(

How To Create a Restrict Mouse Pointer In a Circle in C Or C++ (Computer Graphics)

Image
                                                                                       PROJECT BY (SIMPLIFY LEARN PROGRAMMING)  ON RESTRICT MOUSE POINTER IN A CIRCLE SOURCE CODE: #include<graphics.h> #include<conio.h> #include<dos.h> #include<stdlib.h> #include<math.h> union REGS i, o; int initmouse() {    i.x.ax = 0;    int86(0X33, &i, &o);    return ( o.x.ax ); } void showmouseptr() {    i.x.ax = 1;    int86(0X33, &i, &o); } void hidemopuseptr() {    i.x.ax = 2;    int86(0X33, &i, &o); } void getmousepos(int *x, int *y) {    i.x.ax = 3;    int86(0X33, &i, &o);    *x = o.x.cx;    *y = o.x.dx; } void movemouseptr(int x, int y) {    i.x.ax = 4;    i.x.cx = x;    i.x.dx = y;    int86(0X33, &i, &o); } main() {    int gd = DETECT, gm, midx, midy, radius, x, y, tempx, tempy;    radius = 100;    initgraph(&gd, &gm, "C:\\TC\\BGI");    if(!initmouse())    {       closegraph();       exit(1);    }    midx =

How To Draw Parachute Animation in C Or C++ (Computer Graphics)

Image
                                                                                     PROJECT BY (SIMPLIFY LEARN PROGRAMMING)  ON PARACHUTE ANIMATION SOURCE CODE: #include <stdio.h> #include <conio.h> #include <graphics.h> #include <dos.h>   int main() {         /* request auto detection */         int gdriver = DETECT, gmode, err;         int i, x, y;         /* initialize graphic mode */         initgraph(&gdriver, &gmode, "C:/TURBOC3/BGI");         err = graphresult();         if (err != grOk) {                 /* error occurred */                 printf("Graphics Error: %s",                                 grapherrormsg(err));                 return 0;         }         x = 50;         y = getmaxy() - 100;         for (i = 0; i < 900; i++) {                 /* drawing the balloon first */                 setcolor(LIGHTRED);                 setfillstyle(SOLID_FILL, LIGHTRED);                 arc(x, y, 0, 180, 40);                

How To Draw Cosine Wave Animation in C Or C++ (Computer Graphics)

Image
                                                                                          PROJECT BY (SIMPLIFY LEARN PROGRAMMING)  ON COSINE WAVE ANIMATION SOURCE CODE: #include <conio.h> #include <math.h> #include <graphics.h> #include <dos.h>   void main() {     int gd = DETECT, gm;     int angle = 0;     double x, y;       initgraph(&gd, &gm, "C:\\TC\\BGI");    line(0, getmaxy() / 2, getmaxx(), getmaxy() / 2);  /* generate a sine wave */  for(x = 0; x < getmaxx(); x+=3) {        /* calculate y value given x */      y = 50*sin(angle*3.141/180);      y = getmaxy()/2 - y;        /* color a pixel at the given position */   putpixel(x, y, 15);   delay(100);     /* increment angle */   angle+=5;  }    getch();    /* deallocate memory allocated for graphics screen */  closegraph();    return 0; }

How To Draw Bar Chart Animation in C Or C++ (Computer Graphics)

Image
    PROJECT BY (SIMPLIFY LEARN PROGRAMMING) ON BAR CHART ANIMATION SOURCE CODE: #include <graphics.h> #include <conio.h> int main() {    int gd = DETECT, gm;      initgraph(&gd, &gm, "C:\\TC\\BGI");      setcolor(YELLOW);    rectangle(0,30,639,450);    settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2);    setcolor(WHITE);    outtextxy(275,0,"Bar Chart");      setlinestyle(SOLID_LINE,0,2);      line(100,420,100,60);    line(100,420,600,420);    line(90,70,100,60);    line(110,70,100,60);    line(590,410,600,420);    line(590,430,600,420);      outtextxy(95,35,"Y");    outtextxy(610,405,"X");    outtextxy(85,415,"O");      setfillstyle(LINE_FILL,BLUE);    bar(150,100,200,419); outtextxy(160,419,"MI");      setfillstyle(XHATCH_FILL,YELLOW);    bar(225,150,275,419); outtextxy(235,419,"CSK");    setfillstyle(WIDE_DOT_FILL,LIGHTBLUE);    bar(

How To Draw Scenery Animation in C or C++ (Computer Graphics)

Image
    PROJECT BY (SIMPLIFY LEARN PROGRAMMING)  ON SCENERY ANIMATION SOURCE CODE: #include<iostream.h> #include<conio.h> #include<graphics.h> #include<dos.h> void main() { int gd=DETECT,gm,i; initgraph(&gd,&gm,"C:\\TC\\BGI");                         //Write the Path of BGI Folder   //a,b,c,d are used for Translation int a=200, b=-190; int c=200, d=-190;   //x,y,m,n are used for Scaling.   float x=0.5, y=0.5; float m=0.5, n=0.5; for(i=0;i<=500;i++) {   //================================= 3 CLOUDS ===============================// //================================= MIDDLE CLOUD ===========================//   ellipse(200,30,60,240,10,15); ellipse(225,20,345,165,20,15); ellipse(262,27,340,160,20,15); ellipse(268,42,230,50,20,10); ellipse(226,46,163,340,31,15); ellipse(300,21,20,182,21,19); ellipse(325,31,290,100,21,15); ellipse(299,45,228,20,33,11);   //==============================