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

フィボナッチ

//////////////////////////////////
//
フィボナッチ配列          //
//
//////////////////////////////////
Get Adobe Flash player
by gen_suke 07 May 2009
    Embed
////////////////////////////////////
//                                //
//         フィボナッチ配列          //
//                                //
////////////////////////////////////

package {
    import flash.display.Sprite;
	
    [SWF(width = 465, height = 465, backgroundColor = 0x000000, frameRate = 30)]
    public class Fibonacci extends Sprite{
	//ステージの中心
	private var centerX:int;
        private var centerY:int;
        //円の半径
        private var radius:uint = 10; 
	    
        public function Fibonacci(){
	    init();
	}
	public function init():void{
	    centerX = this.stage.stageWidth / 2;
	    centerY = this.stage.stageHeight / 2;
		
	    for(var num:uint = 0 ;num < 220 ;num++){
                //角度(360度)を黄金比で増加させる
            	var radian:Number = num * 2 * Math.PI * ( ( 1 + Math.sqrt(5) )/2 );   
            	//半径は角度増加分に比例させてプラスする
                var radius:Number = num + 5;
                //座標計算
                var fiboX:Number = centerX + radius * Math.cos(radian);
                var fiboY:Number = centerY + radius * Math.sin(radian);

	        //円を作成 
	        createBall(fiboX,fiboY,num/20+3);  
	    }
	}
        private function createBall(fiboX:Number,fiboY:Number,radius:Number):void{

            var myBall:Ball = new Ball(fiboX,fiboY,radius);
	    myBall.createCircle();
	    addChild(myBall);
        }
    }
}
    import flash.display.Sprite;
    import flash.filters.BlurFilter;
    import flash.utils.ByteArray;
    import flash.display.BlendMode;
	
    class Ball extends Sprite{

        private var fiboX:Number;
        private var fiboY:Number;
        private var radius:Number;
    
        public function Ball(fiboX:Number,fiboY:Number,radius:Number){
	    this.fiboX = fiboX;
	    this.fiboY = fiboY;
            this.radius = radius;
        }
        public function createCircle():void{
	    if (radius < 3){
                circle(fiboX,fiboY,radius ,Math.random() * 0xFFFFFF,0.2,4);
	        circle(fiboX,fiboY,radius,Math.random() * 0xFFFFFF,1,2);
	    }else if (radius < 6){
	        circle(fiboX,fiboY,radius*1.2 ,Math.random() * 0xFFFFFF,0.2,6);
	        circle(fiboX,fiboY,radius*1.1,Math.random() * 0xFFFFFF,0.4,3);
	        circle(fiboX,fiboY,radius,Math.random() * 0xFFFFFF,1,2);
	    }else{
	        circle(fiboX,fiboY,radius*1.3 ,Math.random() * 0xFFFFFF,0.2,8);
	        circle(fiboX,fiboY,radius*1.2,Math.random() * 0xFFFFFF,0.4,5);
	        circle(fiboX,fiboY,radius,Math.random() * 0xFFFFFF,1,3);				
	    }
        }
        public function  circle(x:Number,y:Number,r:Number,c:Number,a:Number,bf:Number):void{
            var cir:Sprite = new Sprite();
            cir.graphics.beginFill(c);
            cir.graphics.drawCircle(0, 0, r);
            cir.graphics.endFill();
                
            cir.blendMode=BlendMode.ADD;
            addChild(cir);
                
            cir.filters= [new BlurFilter(bf, bf, 1)];
            cir.x = x;
            cir.y = y;
            cir.alpha = a;	
        }
    }