{"id":77,"date":"2008-11-01T00:01:32","date_gmt":"2008-11-01T07:01:32","guid":{"rendered":"https:\/\/actionsnippet.com\/?p=37"},"modified":"2008-11-01T00:01:32","modified_gmt":"2008-11-01T07:01:32","slug":"rect-vs-ellipse","status":"publish","type":"post","link":"https:\/\/actionsnippet.com\/?p=77","title":{"rendered":"Rect vs Ellipse"},"content":{"rendered":"<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\nfor (var i:int = 0; i&lt;100; i++){\r\n\tgraphics.lineStyle(0,0);\r\n\tgraphics&#x5B;&#x5B;&quot;drawEllipse&quot;, &quot;drawRect&quot;]&#x5B;int(Math.random()*2)]](Math.random()*400, Math.random()*300, Math.random()*100,Math.random()*100)\r\n}\r\n\r\n\/*\r\nWARNING: This code was written for fun. Use at your own risk. \r\n*\/\r\n<\/pre>\n<p>And a more readable version:<\/p>\n<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\nvar methodChoices:Array = &#x5B;&quot;drawEllipse&quot;, &quot;drawRect&quot;];\r\nvar method:String;\r\nvar xp:Number, yp:Number, w:Number, h:Number;\r\nfor (var i:int = 0; i&lt;100; i++){\r\n\tmethod = methodChoices&#x5B;int(Math.random()*methodChoices.length)];\r\n\tgraphics.lineStyle(0,0);\r\n\txp = Math.random()*400;\r\n\typ = Math.random()*300;\r\n\tw = Math.random()*100; \r\n\th = Math.random()*100;\r\n\tgraphics&#x5B;method](xp, yp, w, h)\r\n}\r\n\r\n\/*\r\nWARNING: This code was written for fun. Use at your own risk. \r\n*\/\r\n<\/pre>\n<p>Here I use yesterdays associative array function call technique to do something different. Not really all that useful, but interesting&#8230;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>for (var i:int = 0; i&lt;100; i++){ graphics.lineStyle(0,0); graphics&#x5B;&#x5B;&quot;drawEllipse&quot;, &quot;drawRect&quot;]&#x5B;int(Math.random()*2)]](Math.random()*400, Math.random()*300, Math.random()*100,Math.random()*100) } \/* WARNING: This code was written for fun. Use at your own risk. *\/ And a more readable version: var methodChoices:Array = &#x5B;&quot;drawEllipse&quot;, &quot;drawRect&quot;]; var method:String; var xp:Number, yp:Number, w:Number, h:Number; for (var i:int = 0; i&lt;100; i++){ method = methodChoices&#x5B;int(Math.random()*methodChoices.length)]; graphics.lineStyle(0,0); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32,17,33,23],"tags":[],"class_list":["post-77","post","type-post","status-publish","format-standard","hentry","category-associative-arrays","category-functions","category-graphics","category-random"],"_links":{"self":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/77","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=77"}],"version-history":[{"count":0,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/77\/revisions"}],"wp:attachment":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=77"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=77"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=77"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}