フィボナッチの勉強
フィボナッチの勉強
*
* 数値の変化でどんな感じになるのか見たかったです。
*
* ところどころなんか可愛い動きがあってかわいいですww
*
/**
* Copyright _azzip ( http://wonderfl.net/user/_azzip )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/bYhR
*/
/*
* フィボナッチの勉強
*
* 数値の変化でどんな感じになるのか見たかったです。
*
* ところどころなんか可愛い動きがあってかわいいです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=1;
private var totalNum:int = 200;
private var tf:TextField;
public function FlashTest()
{
//ブラー
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+2)/50;
spList[k].scaleY = 1 * (k+2)/50;
}
addEventListener(Event.ENTER_FRAME,enterHandler);
}
private function enterHandler(e:Event):void
{
count +=0.04;
tf.text = String(count);
for(var i:int =0; i<totalNum ;i++)
{
list[i] = i * Math.PI * Math.floor(count) * ((1 + Math.sqrt(5))/2);
spList[i].x += ((stage.stageWidth/2 + (i+1) * Math.cos(list[i])) - spList[i].x)/5;
spList[i].y += ((stage.stageHeight/2 + (i+1) * Math.sin(list[i])) - spList[i].y)/5;
}
}
}
}