円をランダムに描画
♥0 |
Line 48 |
Modified 2010-05-24 13:26:13 |
MIT License
archived:2017-03-20 04:08:11
ActionScript3 source code
/**
* Copyright seino ( http://wonderfl.net/user/seino )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/mron
*/
package {
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.events.Event;
[SWF(width="400", height="400", backgroundColor="#FFFFFF", frameRate="50")]
public class ClickDraw extends Sprite{
public function ClickDraw():void {
stage.addEventListener(Event.ENTER_FRAME,onEnterFrame);
}
private function onEnterFrame(e:Event):void {
var rX:int = Math.random() * stage.stageWidth;
var rY:int = Math.random() * stage.stageHeight;
var nR:int = Math.ceil(Math.random() * 10) * (Math.random() * 10);
var color:int = Math.floor(Math.random() * 0xffffff);
var oneCircle:MovieClip = new DrawCircle(rX
,rY
,nR
,color);
oneCircle.x = rX;
oneCircle.y = rY;
stage.addChild(oneCircle);
}
}
}
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.events.Event;
import flash.display.MovieClip;
class DrawCircle extends MovieClip{
private var defPoint:int;
public function DrawCircle(centerX:int
,centerY:int
,r:int
,color:int){
graphics.beginFill(color);
graphics.drawCircle(x,y,r);
graphics.endFill();
addEventListener(Event.ENTER_FRAME,fadeOut);
}
private function fadeOut(e:Event):void{
scaleX *= 1.05;
scaleY *= 1.05;
this.alpha -= 0.05;
if(alpha <= 0){
stage.removeChild(this);
}
}
}