Sakura02
...
@author emnobu
/**
* Copyright emnobu ( http://wonderfl.net/user/emnobu )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/54Mi
*/
package
{
import flash.display.*;
import flash.events.*;
import flash.filters.*;
import flash.geom.Point;
import flash.utils.Timer;
/**
* ...
* @author emnobu
*/
[SWF(frameRate="60",backgroundColor="#000000")]
public class Main02 extends Sprite
{
private var bmd:BitmapData;
private var bm:Bitmap;
private var canvas:Sprite;
private var obj:Sprite;
private var angle:Number = 0;
private var angle02:Number = 0;
private var centerX:uint = stage.stageWidth/2;
private var centerY:uint = stage.stageHeight/2;
private var radius:uint = 70;
private var spd:Number= 11;
private var spd02:Number = 77;
public function Main02():void
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.quality = StageQuality.BEST;
init();
}
public function init():void
{
canvas = new Sprite();
addChild(canvas);
bmd = new BitmapData(stage.stageWidth, stage.stageHeight, true, 0x000000);
bm = new Bitmap(bmd);
addChild(bm);
var timer:Timer = new Timer(11,1500);
timer.addEventListener(TimerEvent.TIMER, timerHandler);
timer.addEventListener(TimerEvent.TIMER_COMPLETE, emComplete);
timer.start();
}
private function emComplete(evt:TimerEvent):void
{
trace("終了");
removeEventListener(Event.ENTER_FRAME, emEnterFrame);
}
private function timerHandler(evt:TimerEvent):void
{
obj = new Sprite();
var color:uint = Math.random() * 0xffffff;
obj.graphics.beginFill(color);
var radius:int = 1;
obj.graphics.drawCircle(radius/2, radius/2, radius);
obj.graphics.endFill();
obj.x = stage.stageWidth / 2;
obj.y = stage.stageHeight / 2;
canvas.addChild(obj);
obj.blendMode = BlendMode.ADD;
addEventListener(Event.ENTER_FRAME, emEnterFrame);
}
private function removeObject(target:Sprite):void
{
canvas.removeChild(target);
}
private function emEnterFrame(evt:Event):void
{
bmd.draw(canvas);
bmd.applyFilter(bmd, bmd.rect, new Point(0, 0), new BlurFilter(3, 3, 2));
var xPos:Number = centerX + Math.sin(angle) * radius;
var yPos:Number = centerY + Math.cos(angle) * radius;
obj.x = xPos + Math.sin(angle02) * radius;
obj.y = yPos + Math.cos(angle02) * radius;
angle += spd;
angle02 += spd02;
}
}
}