In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

flash on 2010-3-16

Get Adobe Flash player
by aass 16 Mar 2010
    Embed
/**
 * Copyright aass ( http://wonderfl.net/user/aass )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/5XDJ
 */

package {
    import frocessing.display.F5MovieClip2D;
    
    [SWF(width=465,height=465,backgroundColor=0xFFFFFF)]
    public class FractalSample extends F5MovieClip2D
    {
    		private var shape_size:Number;
    		private var r1:Number;
    		private var r2:Number;
    		private var r3:Number;
    		
        public function FractalSample()
        {
            //線と塗りの色指定
            stroke(0, 0.5);
            noFill();
            
            //キャンバスを移動
            translate(465/2, 465/2 +30);
            
            //シェイプの大きさ
            shape_size = 200;
            
            //三角形の座標パラメータ
            r1 = shape_size;
            r2 = r1/2;
            r3 = r2*Math.sqrt(3);
            
            //フラクタルの描画(再帰回数を指定)
            draw_shapes(6);
        }
        private function draw_shapes(n:int):void{
        		if(n-- <= 0) return;
        		
        		var rn:int = 3;
        		
        		//キャンバスのサイズを半分に
        		scale(0.5);
        		for (var i:int = 0; i < rn; i++){
        			pushMatrix();
        			//Y方向に-r移動
        			translate(0,-shape_size);
        			triangle(0,-r1,r3,r2,-r3,r2);
        			
        			//再帰的に描画
        			draw_shapes(n);
        			popMatrix();
        			
        			//360/rn度回転
        			rotate(2*Math.PI/rn);
        		}
        }
   }
}