{"id":311,"date":"2009-06-09T09:26:39","date_gmt":"2009-06-09T16:26:39","guid":{"rendered":"https:\/\/actionsnippet.com\/?p=1515"},"modified":"2009-06-09T09:26:39","modified_gmt":"2009-06-09T16:26:39","slug":"drawing-a-half-circle","status":"publish","type":"post","link":"https:\/\/actionsnippet.com\/?p=311","title":{"rendered":"Drawing a Half-Circle"},"content":{"rendered":"<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\ngraphics.beginFill(0xFF0000);\r\nhalfCircle(graphics, 200,200, 100);\r\n\/\/ original circle function by senocular (www.senocular.com) from here http:\/\/www.actionscript.org\/forums\/showthread.php3?s=&amp;threadid=30328\r\nfunction halfCircle(g:Graphics, x:Number,y:Number,r:Number):void {\r\n\tvar c1:Number=r * (Math.SQRT2 - 1);\r\n\tvar c2:Number=r * Math.SQRT2 \/ 2;\r\n\tg.moveTo(x+r,y);\r\n\tg.curveTo(x+r,y+c1,x+c2,y+c2);\r\n\tg.curveTo(x+c1,y+r,x,y+r);\r\n\tg.curveTo(x-c1,y+r,x-c2,y+c2);\r\n\tg.curveTo(x-r,y+c1,x-r,y);\r\n\t\/\/ comment in for full circle\r\n\t\/*g.curveTo(x-r,y-c1,x-c2,y-c2);\r\n\tg.curveTo(x-c1,y-r,x,y-r);\r\n\tg.curveTo(x+c1,y-r,x+c2,y-c2);\r\n\tg.curveTo(x+r,y-c1,x+r,y);*\/\r\n};\r\n<\/pre>\n<p>A quick way to draw a half-circle&#8230; I used to use this to draw circles in flash before the Graphics.drawCircle() method. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>graphics.beginFill(0xFF0000); halfCircle(graphics, 200,200, 100); \/\/ original circle function by senocular (www.senocular.com) from here http:\/\/www.actionscript.org\/forums\/showthread.php3?s=&amp;threadid=30328 function halfCircle(g:Graphics, x:Number,y:Number,r:Number):void { var c1:Number=r * (Math.SQRT2 &#8211; 1); var c2:Number=r * Math.SQRT2 \/ 2; g.moveTo(x+r,y); g.curveTo(x+r,y+c1,x+c2,y+c2); g.curveTo(x+c1,y+r,x,y+r); g.curveTo(x-c1,y+r,x-c2,y+c2); g.curveTo(x-r,y+c1,x-r,y); \/\/ comment in for full circle \/*g.curveTo(x-r,y-c1,x-c2,y-c2); g.curveTo(x-c1,y-r,x,y-r); g.curveTo(x+c1,y-r,x+c2,y-c2); g.curveTo(x+r,y-c1,x+r,y);*\/ }; A quick way to draw a half-circle&#8230; I used [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[3,14,4],"class_list":["post-311","post","type-post","status-publish","format-standard","hentry","category-graphics","tag-actionscript","tag-as3","tag-flash"],"_links":{"self":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=311"}],"version-history":[{"count":0,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/311\/revisions"}],"wp:attachment":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}