{"id":165,"date":"2009-01-23T00:00:35","date_gmt":"2009-01-23T07:00:35","guid":{"rendered":"https:\/\/actionsnippet.com\/?p=576"},"modified":"2009-01-23T00:00:35","modified_gmt":"2009-01-23T07:00:35","slug":"pointpolar-stars","status":"publish","type":"post","link":"https:\/\/actionsnippet.com\/?p=165","title":{"rendered":"Point.polar() Stars"},"content":{"rendered":"<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\n&#x5B;SWF(width=700, height=400, backgroundColor=0x000000, frameRate=30)]\r\n\r\nvar points:Array = new Array();\r\nvar index:int = -1;\r\nfunction polar(thetaInc:Number, radius:Number):Point{\r\n\tindex++;\r\n\tif (!points&#x5B;index]) points&#x5B;index] = 0;\r\n\treturn Point.polar(radius, points&#x5B;index] += thetaInc)\r\n}\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n\/\/ test it out:\r\n \r\nvar canvas:BitmapData = new BitmapData(700, 400, false, 0xFFFFFF);\r\n \r\naddChild(new Bitmap(canvas, &quot;auto&quot;, true));\r\n\r\nvar p0:Point = new Point(200, 200);\r\nvar p1:Point = new Point(500, 200);\r\n\r\naddEventListener(Event.ENTER_FRAME, onLoop);\r\nfunction onLoop(evt:Event):void {\r\n\t\r\n\tvar rad:Point = polar(.05, 4);\r\n\t \r\n\tfor (var i:int= 0; i&lt;100; i++){\r\n\t\t\r\n\t\t\/\/ reset index;\r\n\t\tindex = -1;\r\n\t   \r\n\t    p0 = p0.add(polar(.025, 2).add(polar(-.05,rad.x)));\r\n\t    canvas.setPixel(p0.x, p0.y, 0x000000);\r\n\t\t\r\n\t\tp1 = p1.add(polar(.025, 2).add(polar(-.05,rad.x).add(polar(.1, rad.y))));\r\n\t    canvas.setPixel(p1.x, p1.y, 0x000000);\r\n\t}\r\n}\r\n<\/pre>\n<p>This is pretty much the same as yesterdays&#8230; I just changed the way I use the polar() function to draw two more shapes:<br \/>\n<img decoding=\"async\" src=\"https:\/\/actionsnippet.com\/imgs\/curve_stars.jpg\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#x5B;SWF(width=700, height=400, backgroundColor=0x000000, frameRate=30)] var points:Array = new Array(); var index:int = -1; function polar(thetaInc:Number, radius:Number):Point{ index++; if (!points&#x5B;index]) points&#x5B;index] = 0; return Point.polar(radius, points&#x5B;index] += thetaInc) } \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ \/\/ test it out: var canvas:BitmapData = new BitmapData(700, 400, false, 0xFFFFFF); addChild(new Bitmap(canvas, &quot;auto&quot;, true)); var p0:Point = new Point(200, 200); var p1:Point = new [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24,13,26],"tags":[3,4],"class_list":["post-165","post","type-post","status-publish","format-standard","hentry","category-bitmapdata","category-motion","category-setpixel","tag-actionscript","tag-flash"],"_links":{"self":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/165","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=165"}],"version-history":[{"count":0,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/165\/revisions"}],"wp:attachment":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}