Turning Circles(Test)
ひとまず一番最初に作ってみたサンプル的な物
HSVよりsin使ったほうが色綺麗だよね
/**
* Copyright phi16 ( http://wonderfl.net/user/phi16 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/huIf
*/
package {
import flash.display.Sprite;
import flash.events.Event;
public class FlashTest extends Sprite {
public var spr:Sprite=new Sprite();
private var rad:Number=0;
private var num:int=12;
public function FlashTest() {
spr.x=spr.y=235;
this.addChild(spr);
this.addEventListener(Event.ENTER_FRAME,this.Draw);
}
private function Draw(e:Event):void{
spr.graphics.clear();
for(var i:int=0;i<num;i++){
var colr:int,colg:int,colb:int;
colr=(Math.sin((i*360/num+rad)*Math.PI/180)+1)*255/2;
colg=(Math.sin((i*360/num+120+rad)*Math.PI/180)+1)*255/2;
colb=(Math.sin((i*360/num-120+rad)*Math.PI/180)+1)*255/2;
spr.graphics.beginFill(colr*256*256+colg*256+colb);
spr.graphics.drawCircle(Math.cos((i*360/num+rad)*Math.PI/180)*160,Math.sin((i*360/num+rad)*Math.PI/180)*160,20);
spr.graphics.endFill();
}
rad+=2;
}
}
}