Posts

Showing posts from January, 2021

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 =