frocessingRabbit
//frocessingの勉強
package {
import flash.display.Sprite;
import flash.events.*;
import frocessing.color.ColorHSV;//
import flash.geom.ColorTransform;//
[SWF(width = "465", height = "465", backgroundColor = 0x000000, frameRate = "60")]
public class frocessingRabbit extends Sprite{
private var rabiList:Array=new Array();
const R:uint=180;
const addnum:uint=36;
public function frocessingRabbit(){
if (stage) init();else addEventListener(Event.ADDED_TO_STAGE,init );
var bg:back_ground=new back_ground();
addChildAt(bg,0);
}
public function init(ev:Event = null){
removeEventListener( Event.ADDED_TO_STAGE, init ) ;
var chsv:ColorHSV = new ColorHSV(0,1,1);//
for(var q:int = 1; q < addnum+1; q++){
var num0:Number=0;
var _rabbit:drawRabi=new drawRabi(addnum,q);
var rad:Number=360/addnum*q;
_rabbit.name="item"+q;
_rabbit.x=R*Math.cos(rad*Math.PI/180)+465/2;
_rabbit.y=R*Math.sin(rad*Math.PI/180)+465/2;
_rabbit.rotation=rad+90;
addChild(_rabbit);
rabiList.push(_rabbit);
_rabbit.addEventListener(Event.ENTER_FRAME, function(ev){
/*var erad:Number = ev.target.angel* Math.PI / 180;
ev.target.x=R*Math.cos(erad)+465/2;
ev.target.y=R*Math.sin(erad)+465/2;
ev.target.rotation=ev.target.angel+90;*/
ev.target.angel+=1;
chsv.h = ev.target.angel;
var ct:ColorTransform=new ColorTransform();
ct.color=chsv.value;
ev.target.transform.colorTransform=ct;
});
}
}
}
}
import frocessing.display.F5MovieClip2D;
//import flash.filters.GlowFilter;
class drawRabi extends F5MovieClip2D{
public var angel:uint;
public function drawRabi(arg1,arg2){
angel=360/arg1*arg2;
colorMode( HSV, arg1, 1, 1 );
rectMode( CENTER );
noStroke();
fill(arg2, 1, 1);
circle(0, 0, 10);
circle(0, 20, 12);
ellipse(-5,-15,7,15);
ellipse(5,-15,7,15);
/*fill(0x000000);
circle(-5, -2, 2);
circle(5, -2, 2);
circle(0, 4, 3);
filters = [ new GlowFilter( arg2, 1, 40, 40, 1 ) ] ;*/
}
}
import flash.display.Sprite;
class back_ground extends Sprite{
public function back_ground(){
var bg:Sprite=new Sprite();
bg.graphics.beginFill(0x000000);
bg.graphics.drawRect(0,0,465,465);
bg.graphics.endFill();
addChild(bg);
}
}