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

forked from: forked from: フィボナッチの勉強

フィボナッチの勉強
* 
* 数値の変化でどんな感じになるのか見たかったです。
* 
* ところどころなんか可愛い動きがあってかわいいですww
* 
* 若干挙動がおこるけど、、、
* 
*
/**
 * Copyright Geo877 ( http://wonderfl.net/user/Geo877 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/93Lb
 */

// forked from _azzip's forked from: フィボナッチの勉強
// forked from _azzip's フィボナッチの勉強
/*
 * フィボナッチの勉強
 * 
 * 数値の変化でどんな感じになるのか見たかったです。
 * 
 * ところどころなんか可愛い動きがあってかわいいですww
 * 
 * 若干挙動がおこるけど、、、
 * 
 * 
 */
package
{
    import flash.display.Sprite;
	import flash.filters.GlowFilter;
	import flash.events.Event;
	import flash.text.*;
	
	[SWF(backgroundColor="#000000", width="480", height="480", frameRate="30")]
	
    public class FlashTest extends Sprite
	{
		private var spList:Array = new Array();
		private var list:Array = new Array();
		private var angle:Number;
		private var count:Number=0;
		private var totalNum:int = 220;    
		private var v:Number = 0;
		private var tf:TextField;
		
        public function FlashTest()
		{
			//ブローだったw
			var grow:GlowFilter = new GlowFilter(0xffcc00,1,10,10);
			this.filters = [grow];
	
			tf = new TextField();
			var tfmt:TextFormat = new TextFormat("ARIAL",null,0xFFFFFF);
			tf.defaultTextFormat = tfmt;
			tf.x = 0;
			tf.y = 0;
			addChild(tf);
			
			for(var k:int =0; k<totalNum ;k++)
			{
				angle = k * Math.PI * 1 * ((1 + Math.sqrt(5))/2);
				list.push(angle);
				
				
				var sp:Sprite = new Sprite();
				sp.graphics.beginFill(Math.random() * 0xFFFFFF);
				sp.graphics.drawCircle(0,0,2);	
				sp.graphics.endFill();
				addChild(sp);
				spList.push(sp);
				
				spList[k].alpha = 0.6;
				spList[k].x = stage.stageWidth/2 + (k+1) * Math.cos(list[k]); 
				spList[k].y = stage.stageHeight/2 + (k+1) * Math.sin(list[k]); 				
				spList[k].scaleX = 1 * (k+4)/50;
				spList[k].scaleY = 1 * (k+4)/50;
			}
			addEventListener(Event.ENTER_FRAME, enterHandler);			
			v = 0.00005;

        }


		private function enterHandler(e:Event):void
		{
			count += 0.000001 / 8 / v / 3;
			
			tf.text = String(count);
			for(var i:int =0; i<totalNum ;i++)
			{
				list[i] = i * Math.PI * Math.cos(count) * ((1 + Math.sqrt(5))/2);
				spList[i].x += ((stage.stageWidth/2 + (i+30) * Math.cos(list[i])) - spList[i].x)/5;
				spList[i].y += ((stage.stageHeight/2 + (i+30) * Math.sin(list[i])) - spList[i].y)/5;
			}			
		}		
    }
}