flash on 2010-2-5
/**
* Copyright upstanding ( http://wonderfl.net/user/upstanding )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/1GFe
*/
package {
import flash.geom.Point;
import flash.events.*;
import flash.display.*;
[SWF(width=465,height=465,backgroundColor="#FFFFFF", frameRate=60)]
public class OffsetCircle extends Sprite {
private var obj:Array = new Array();
private var spNum:uint = 10; //Spriteの数
private var center:Point = new Point(stage.stageWidth/2,stage.stageHeight/2);
private var len:Number = 80;
private var rad:Number = 2*Math.PI/spNum; //360度をspNum個に等分割した角度ラジアン
public function OffsetCircle() {
//ball i個の配列を用意
for(var i:uint=1; i <= spNum; i++) {
obj[i] = new ball();
stage.addChild(obj[i]);
//配置する位置
var pt:Point = Point.polar(len,rad*(i-1));
//ベクトルの原点をcenterの位置に合わせる
pt.offset(center.x,center.y);
//ball[i]の位置
obj[i].x = pt.x;
obj[i].y = pt.y;
}
}
}
}
//-------------------------------------------------------------------------/
//
//
import flash.display.*;
import flash.filters.*;
class ball extends Shape { //ball(基本)インスタンスの作成
/**
*/
private var r:uint = 15; //ボールの半径
function ball(){
graphics.beginFill(Math.round(Math.random() * 255 * 255 * 255), 1);
graphics.drawCircle(0, 0, r);
graphics.endFill();
this.filters = [new DropShadowFilter(4, 45, 0, 0.5)];
}
}