flash on 2009-4-30 楕円形
添削ありがとうございます!できた!
/**
* 添削ありがとうございます!できた!
**/
package {
import flash.display.Sprite;
import flash.display.DisplayObjectContainer;
import flash.display.Graphics;
[SWF(width=465, height=465, frameRate=30, backgroundColor=0x000000)]
public class NestEllipse extends Sprite {
//private var container:DisplayObjectContainer;
private var cx:uint;
private var cy:uint;
public function NestEllipse() {
//cx = container.stage.stageWidth/2;
//cy = container.stage.stageHeight/2;
cx = stage.stageWidth/2;
cy = stage.stageHeight/2;
drawRing();
}
private function drawRing():void {
var thickness:uint = 1;
var color:uint;
var alpha:Number;
var ew:uint;
var eh:uint;
var i:uint;
var j:uint;
for (i=1; i<=50; i++) {
alpha = 1 - 0.02*i;
ew = 12*i;
color = Math.random()*0xff0000;
for (j=1; j<=6; j++) {
eh = ew/2;
var canvas:Sprite = new Sprite();
canvas.graphics.lineStyle(thickness, color, alpha);
canvas.graphics.drawEllipse(-ew/2, -eh/2, ew, eh);
canvas.x = cx;
canvas.y = cy;
canvas.rotation = 30*(j-1);
addChild( canvas );
}
}
}
}
}