Forked from: makc3d's Random Green Tree diff(2) share Random Green Tree (smaller flowers) makc3d forked:4favorite:13lines : 27license : see code comments modified : 2009-02-28 01:38:53 // forked from makc3d's Random Green Tree package { import flash.display.Sprite; public class FlashTest extends Sprite { private var level:int = 0; // just some random tree :) private function drawTree (x:Number, y:Number, length:Number, angle:Number, cf:int):void { level += 1; var destx:Number = x + length * Math.cos(angle * (Math.PI/180)); var desty:Number = y + length * Math.sin(angle * (Math.PI/180)); // for the most of time, we use green, // but sometimes pink to make flowers if ((level == 10) && (Math.random () < 0.5)) cf = 0xF0007; graphics.lineStyle(1 + 5 / level, cf * level); graphics.moveTo (x, y); graphics.lineTo (destx, desty); if (level < 10) { drawTree (destx, desty, length * (1 + 3 * Math.random()) * 0.25, angle + 60 * (Math.random() - Math.random()), cf); drawTree (destx, desty, length * (1 + 3 * Math.random()) * 0.25, angle + 60 * (Math.random() - Math.random()), cf); drawTree (destx, desty, length * (1 + 3 * Math.random()) * 0.25, angle + 60 * (Math.random() - Math.random()), cf); } level -= 1; } public function FlashTest() { drawTree (stage.stageWidth/2, stage.stageHeight, 90, -90, 0xF00); } } } Code Fullscreen Preview Fullscreen じぶんのサイトで使いたいなあ by whaison at 2009/10/23 18:33:34 sorry, my japanese skills are 0. my only guess from what online translators spew out is that you want to use this in your site? well, the license for my stuff on wonderfl is sam.zoy.org/wtfpl unless otherwise stated. by makc3d at 2009/10/24 18:47:20 (smaller Green Random Tree beautifl flowers) NaokiHada korooooon enok ep91ckok berian dizgid nki2 uwi teageek eternity_hir.. kamip: 木! a440hlz: beautifl hacker_wfcn4..: (smallerflowers)GreenRandomTree length Math.PI Math.cos Math.random Math.sin Sprite int Number sort new page view favorite forked pv86 forked from: Random Green Tree (smaller flowers) Izotopus forked:0 fav:0 lines:27 tag: pv181 forked from: Random Green Tree (smaller flowers) yabuchany forked:0 fav:0 lines:29 tag: pv1552 再帰関数 clockmaker forked:4 fav:19 lines:26 tag: graphics tree あーぎゅめんとかーりー リテラル記法 再帰関数 匿名関数 pv411 forked from: Random Green Tree (smaller flowers) qwed_qwed forked:0 fav:2 lines:27 tag: tree