forked from: flash on 2012-1-22
// forked from Susisu's flash on 2012-1-22
package{
import flash.display.Sprite;
[SWF(frameRate="60")]
public class Test extends Sprite{
public function Test(){
blendMode="layer";
for(var i:int=0;i<5;i++){
var s:Sprite=new FlashTest((Math.random()*0xff<<16)|(0x7f+Math.random()*0x80<<8));
s.x=465/2;
s.y=465/2;
s.blendMode="multiply";
s.rotation=360/5*i;
addChild(s);
}
}
}
}
import flash.events.Event;
import flash.display.Sprite;
class FlashTest extends Sprite {
private const s:Number=50;
private var a:Number;
public function FlashTest(color:int) {
a=0;
graphics.lineStyle(0,0x000000);
graphics.beginFill(color,0.75);
graphics.moveTo(0,0);
addEventListener(Event.ENTER_FRAME,onEnterFrame);
}
private function onEnterFrame(e:Event):void{
if(a>Math.PI*2){
removeEventListener(Event.ENTER_FRAME,onEnterFrame);
graphics.endFill();
}
var t:Number=r(a+Math.PI);
if(a==0){
graphics.moveTo(t*Math.cos(a+Math.PI)*s,t*Math.sin(a+Math.PI)*s);
}
else{
graphics.lineTo(t*Math.cos(a+Math.PI)*s,t*Math.sin(a+Math.PI)*s);
}
a+=Math.PI/90;
}
private function r(a:Number):Number{
var t:Number=1;
for(var i:int=1;i<33;i++){
t+=Math.cos(i*i*a)/i/i;
}
return t;
}
}