Emoji animation in C programming graphics
Hello friend in this video i will make 4 emoji animation through c programming with help of graphics so watch till end.
click here to see this video on youtube
/*Source Code*/
#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<graphics.h>
void face1(int);
void face2();
void face3();
void face4();
int main()
{
int gd=DETECT,gm,i;
initgraph(&gd,&gm,"c:\\turboc3\\bgi");
for(int j=1;j<=1;j++)
{
face1(i);
delay(2000);
cleardevice();
face2();
delay(2000);
cleardevice();
face3();
delay(2000);
cleardevice();
face4();
}
//face3();
/*circle(200,200,100);
bar(120,160,170,170);
bar(230,160,280,170);
bar(150,240,250,250);*/
getch();
closegraph();
}
void face1(int i)
{
//main part
setcolor(YELLOW);
circle(200,200,100);
setfillstyle(1,YELLOW);
floodfill(200,200,YELLOW);
//right eye
setcolor(WHITE);
circle(150,170,25);
setfillstyle(1,WHITE);
floodfill(150,170,WHITE);
//left eye
circle(250,170,25);
setfillstyle(1,WHITE);
floodfill(250,170,WHITE);
//mouth
setcolor(BLACK);
for(i=1;i<=3;i++)
{
line(170,250+i,230,250+i);
}
//right eye ball
setcolor(BLACK);
circle(150,155,10);
setfillstyle(1,BLACK);
floodfill(150,155,BLACK);
//left eye ball
setcolor(BLACK);
circle(250,155,10);
setfillstyle(1,BLACK);
floodfill(250,155,BLACK);
}
void face2()
{
//main
setcolor(YELLOW);
circle(200,200,100);
setfillstyle(1,YELLOW);
floodfill(200,200,YELLOW);
//left eye
setcolor(WHITE);
circle(150,170,25);
setfillstyle(1,WHITE);
floodfill(150,170,WHITE);
//left eye ball
setcolor(BLACK);
circle(150,180,15);
setfillstyle(1,BLACK);
floodfill(150,180,BLACK);
//right eye
setcolor(WHITE);
circle(250,170,25);
setfillstyle(1,WHITE);
floodfill(250,170,WHITE);
//right eye ball
setcolor(BLACK);
circle(250,180,15);
setfillstyle(1,BLACK);
floodfill(250,180,BLACK);
//mouth
setcolor(WHITE);
circle(200,250,25);
setfillstyle(1,WHITE);
floodfill(200,250,WHITE);
}
void face3()
{
//main part
setcolor(YELLOW);
circle(200,200,100);
setfillstyle(1,YELLOW);
floodfill(200,200,YELLOW);
//right eye
setcolor(WHITE);
circle(150,170,25);
setfillstyle(1,WHITE);
floodfill(150,170,WHITE);
//left eye
circle(250,170,25);
setfillstyle(1,WHITE);
floodfill(250,170,WHITE);
//mouth
setcolor(BLACK);
for(int i=1;i<=33;i++)
{
ellipse(200,230,180,0,40,20+i);
}
setcolor(WHITE) ;
line(200,250,200,285);
line(180,249,180,276);
line(220,249,220,276);
//right eye ball
setcolor(BLACK);
circle(150,155,10);
setfillstyle(1,BLACK);
floodfill(150,155,BLACK);
//left eye ball
setcolor(BLACK);
circle(250,155,10);
setfillstyle(1,BLACK);
floodfill(250,155,BLACK);
}
void face4()
{
//main part
setcolor(YELLOW);
circle(200,200,100);
setfillstyle(1,YELLOW);
floodfill(200,200,YELLOW);
//eye brose
setcolor(BLACK);
for(int i=1;i<3;i++)
{
line(125,140+i,170,140+i);
line(225,140+i,270,140+i);
}
//right eye
setcolor(WHITE);
circle(150,170,25);
setfillstyle(1,WHITE);
floodfill(150,170,WHITE);
//left eye
circle(250,170,25);
setfillstyle(1,WHITE);
floodfill(250,170,WHITE);
//mouth
setcolor(BLACK);
ellipse(200,250,0,180,30,20);
//right eye ball
setcolor(BLACK);
circle(160,170,15);
setfillstyle(1,BLACK);
floodfill(165,170,BLACK);
//left eye ball
setcolor(BLACK);
circle(260,170,15);
setfillstyle(1,BLACK);
floodfill(260,170,BLACK);
}
Comments
Post a Comment