{"id":369,"date":"2009-08-06T09:52:55","date_gmt":"2009-08-06T16:52:55","guid":{"rendered":"https:\/\/actionsnippet.com\/?p=1931"},"modified":"2009-08-06T09:52:55","modified_gmt":"2009-08-06T16:52:55","slug":"convert-timeline-code-to-document-class","status":"publish","type":"post","link":"https:\/\/actionsnippet.com\/?p=369","title":{"rendered":"Convert Timeline Code to Document Class"},"content":{"rendered":"<p>For a few different reasons I decided to write some php code to convert timeline code to a document class. The script is done and it seems to work pretty nicely. I&#8217;m sure there are a few bugs, but I&#8217;ve tested around 30 snippets from this site and they all worked.<\/p>\n<p>To test it out: <\/p>\n<p>1) just take the below code (or any other timeline code), copy it to your clipboard<br \/>\n<em>(The code doesn&#8217;t have to be small, I did a test with 300 lines of timeline code and it worked just fine)<\/em><\/p>\n<pre>\r\nx = stage.stageWidth \/ 2;\r\ny = stage.stageHeight \/ 2;\r\nvar xp:Number = 0, yp:Number = 0;\r\nvar r:Number = 0, t:Number = 0;\r\nvar speed:Number = .07;\r\nvar scale:Number = 20;\r\nvar plot0:Shape = Shape(addChild(new Shape()));\r\nvar plot1:Shape = Shape(addChild(new Shape()));\r\nplot0.graphics.lineStyle(0,0x000000);\r\nplot1.graphics.lineStyle(0,0x000000);\r\naddEventListener(Event.ENTER_FRAME, onLoop);\r\nfunction onLoop(evt:Event):void {\r\n\t r =  scale * Math.sqrt(t);\r\n\t xp =  r * Math.cos(t);\r\n\t yp =  r * Math.sin(t);\r\n\t t += speed;\r\n\tplot0.graphics.lineTo(xp, yp);\r\n\tplot1.graphics.lineTo(-xp, -yp);\r\n}\r\n<\/pre>\n<p>2) go to this page and follow the instructions:<br \/>\n<a href=\"https:\/\/actionsnippet.com\/timeline_to_doc.php\" target=\"blank\">https:\/\/actionsnippet.com\/timeline_to_doc.php<\/a><\/p>\n<p>I used this script to convert a few snippets from this site to work on <a href=\"http:\/\/www.wonderfl.net\" target=\"blank\">wonderfl.net<\/a>&#8230;<\/p>\n<p> <a href=\"http:\/\/wonderfl.net\/user\/shapevent\/codes\">Have a look at them here.<\/a><\/p>\n<p>In the next few days I may add a button to all code snippets that allows you to convert the code to a doc class&#8230;<\/p>\n<p>The script adds import statements automatically, I may however have missed a few packages, so if the generated code is missing an import statement, let me know and I&#8217;ll fix it&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For a few different reasons I decided to write some php code to convert timeline code to a document class. The script is done and it seems to work pretty nicely. I&#8217;m sure there are a few bugs, but I&#8217;ve tested around 30 snippets from this site and they all worked. To test it out: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[94],"tags":[3,14,4],"class_list":["post-369","post","type-post","status-publish","format-standard","hentry","category-misc","tag-actionscript","tag-as3","tag-flash"],"_links":{"self":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/369","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=369"}],"version-history":[{"count":0,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/369\/revisions"}],"wp:attachment":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=369"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}