flash on 2011-2-6
まともなフラクタルをつくろうとしてたら計算を間違えたのだが、どうしてこうなった
package {
import flash.display.Sprite;
public class FlashTest extends Sprite {
public function FlashTest() {
addChild(new Test(465/2,465,0,1.75,360000));
}
}
}
import flash.display.Sprite;
import flash.events.Event;
class Test extends Sprite{
private var i:int=0;
private var r:Number=-Math.PI/1.5;
private var px:Number=0;
private var py:Number=0;
private var param:uint;
public function Test(x:Number,y:Number,rotation:Number,scale:Number,param:uint){
this.x=x;
this.y=y;
this.rotation=rotation;
this.scaleX=this.scaleY=scale;
this.param=param;
this.graphics.lineStyle(0);
this.graphics.moveTo(px,py);
this.addEventListener(Event.ENTER_FRAME,enterFrame);
}
private function enterFrame(e:Event):void{
if(i<20000){
for(var j:int=0;j<20;j++){
px+=Math.cos(r);
py+=Math.sin(r);
r+=((i*(i+1))/2)*Math.PI/param;
this.graphics.lineTo(px,py);
i++;
}
}
else this.removeEventListener(Event.ENTER_FRAME,enterFrame);
}
}