{"id":24852,"date":"2017-10-15T12:05:32","date_gmt":"2017-10-15T06:35:32","guid":{"rendered":"https:\/\/www.wikitechy.com\/technology\/?p=24852"},"modified":"2018-10-24T11:29:52","modified_gmt":"2018-10-24T05:59:52","slug":"c-smiling-face-animation","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/technology\/c-smiling-face-animation\/","title":{"rendered":"C smiling face animation"},"content":{"rendered":"<h2 id=\"c-smiling-face-animation\"><span style=\"color: #ff6600;\">C Smiling Face Animation :<\/span><\/h2>\n<p>This animation using c draws a smiling face which appears at random position on screen. See output below the code, it will help you in understanding the code easily.<\/p>\n<ul>\n<li>The <a href=\"https:\/\/www.wikitechy.com\/technology\/functions-graphics-h-in-c\/\">graphics.h<\/a>\u00a0library is used to create <a href=\"https:\/\/www.wikitechy.com\/technology\/draw-shapes-using-c-graphics\/\" target=\"_blank\" rel=\"noopener\">graphics<\/a> in <a href=\"https:\/\/www.wikitechy.com\/technology\/c-program-to-sort-a-string-in-alphabetic-order\/\" target=\"_blank\" rel=\"noopener\">C program<\/a>. Let us create the smiling face.<\/li>\n<li>Now set the color as YELLOW\u00a0for smiling face. And create circle using <span style=\"color: #800000;\">circle( ) <\/span>function by giving radius parameter.<\/li>\n<li>Using <span style=\"color: #800000;\">setfillstyle( )<\/span> and <span style=\"color: #800000;\">floodfill( )<\/span>\u00a0 fill the yellow color in the circle.<\/li>\n<li>Create 4 ellipse using <span style=\"color: #800000;\">ellipse( )<\/span> <a href=\"https:\/\/www.wikitechy.com\/technology\/fillellipse-function-c\/\" target=\"_blank\" rel=\"noopener\">function <\/a>and fill color BLACK using <span style=\"color: #800000;\">setfillstyle( )<\/span> and <span style=\"color: #800000;\">fillellipse( )<\/span>.<\/li>\n<\/ul>\n<h2 id=\"c-programming-code\"><span style=\"color: #000080;\">C programming code<\/span><\/h2>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-c code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-c code-embed-code\">#include&lt;graphics.h&gt;<br\/>#include&lt;conio.h&gt;<br\/>#include&lt;stdlib.h&gt;<br\/> <br\/>main()<br\/>{<br\/>   int gd = DETECT, gm, area, temp1, temp2, left = 25, top = 75;<br\/>   void *p;<br\/> <br\/>   initgraph(&amp;gd,&amp;gm,&quot;C:\\\\TC\\\\BGI&quot;);<br\/> <br\/>   setcolor(YELLOW);<br\/>   circle(50,100,25);<br\/>   setfillstyle(SOLID_FILL,YELLOW);<br\/>   floodfill(50,100,YELLOW);<br\/> <br\/>   setcolor(BLACK);<br\/>   setfillstyle(SOLID_FILL,BLACK);<br\/>   fillellipse(44,85,2,6);<br\/>   fillellipse(56,85,2,6);<br\/> <br\/>   ellipse(50,100,205,335,20,9);<br\/>   ellipse(50,100,205,335,20,10);<br\/>   ellipse(50,100,205,335,20,11);<br\/> <br\/>   area = imagesize(left, top, left + 50, top + 50);<br\/>   p = malloc(area);<br\/> <br\/>   setcolor(WHITE);<br\/>   settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2);<br\/>   outtextxy(155,451,&quot;Smiling Face Animation&quot;);<br\/> <br\/>   setcolor(BLUE);<br\/>   rectangle(0,0,639,449);<br\/> <br\/>   while(!kbhit())<br\/>   {<br\/>      temp1 = 1 + random ( 588 );<br\/>      temp2 = 1 + random ( 380 );<br\/> <br\/>      getimage(left, top, left + 50, top + 50, p);<br\/>      putimage(left, top, p, XOR_PUT);<br\/>      putimage(temp1 , temp2, p, XOR_PUT);<br\/>      delay(100);<br\/>      left = temp1;<br\/>      top = temp2;<br\/>   }<br\/> <br\/>   getch();<br\/>   closegraph();<br\/>   return 0;<br\/>}<\/code><\/pre> <\/div>\n[ad type=&#8221;banner&#8221;]\n<h2 id=\"output\"><span style=\"color: #000080;\">Output :<\/span><\/h2>\n<figure id=\"attachment_31344\" aria-describedby=\"caption-attachment-31344\" style=\"width: 398px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\"wp-image-31344 \" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/10\/smiling-face-animation-1.png\" alt=\"smiling-face-animation\" width=\"398\" height=\"299\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/10\/smiling-face-animation-1.png 640w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/10\/smiling-face-animation-1-300x225.png 300w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/10\/smiling-face-animation-1-74x55.png 74w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/10\/smiling-face-animation-1-111x83.png 111w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/10\/smiling-face-animation-1-215x161.png 215w\" sizes=\"(max-width: 398px) 100vw, 398px\" \/><figcaption id=\"caption-attachment-31344\" class=\"wp-caption-text\">smiling-face-animation<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>C smiling face animation &#8211;  c programming &#8211; This animation using c draws a smiling face which appears at random position on screen. <\/p>\n","protected":false},"author":2,"featured_media":31338,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[82927,1],"tags":[83215,83213,83214,85573,83211,83212,83216,79961,83217,83221,83104,83219,83220,83218,83222,83224,83223],"class_list":["post-24852","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-c-programming-2","category-coding","tag-animated-cartoon-using-computer-graphics-in-c","tag-animation-program-in-c-with-source-code","tag-c-graphics-program-examples","tag-c-graphics-program-for-smiley-face","tag-c-program-to-print-smiley-face","tag-c-code-for-smiley-face","tag-c-output-smiley-face","tag-computer-graphics-animation-programs-in-c-language-with-output","tag-free-smiling-face","tag-happy-smiling-faces","tag-program-to-draw-a-human-face-in-c-graphics","tag-smiling-face-baby","tag-smiling-face-girl","tag-smiling-face-images","tag-smiling-faces-clip-art","tag-smiling-faces-kevin-gates","tag-smiling-faces-sometimes-youtube"],"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/24852","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/comments?post=24852"}],"version-history":[{"count":0,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/24852\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/media\/31338"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/media?parent=24852"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/categories?post=24852"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/tags?post=24852"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}