green2
ポインタ位置についてくる
/**
* Copyright Scmiz ( http://wonderfl.net/user/Scmiz )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/nPdV
*/
package {
import adobe.utils.ProductManager;
import flash.display.Graphics;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
public class FlashTest extends Sprite {
private var _rotate:Number;
private var _isFast:Boolean;
public function FlashTest() {
_rotate = 0;
_isFast = false;
this.addEventListener(Event.ENTER_FRAME, proc);
stage.addEventListener(MouseEvent.MOUSE_DOWN, onDown);
stage.addEventListener(MouseEvent.MOUSE_UP, onUp);
}
private function onDown(e:MouseEvent):void {
_isFast = true;
}
private function onUp(e:MouseEvent):void {
_isFast = false;
}
private function proc(e:Event):void {
_rotate += Math.PI * 2 * ((_isFast) ? 0.005 : 0.001);
var g:Graphics = this.graphics;
g.clear();
g.beginFill(0x000000);
g.drawRect(0, 0, 465, 465);
g.endFill();
g.lineStyle(3, 0x80ff80);
var calcX:Function = function(ratio:Number):Number {
return mouseX + (600 * Math.cos(_rotate + (Math.PI * 2.0 * ratio)));
};
var calcY:Function = function(ratio:Number):Number {
return mouseY + (600 * Math.sin(_rotate + (Math.PI * 2.0 * ratio)));
};
g.moveTo(calcX(0.00), calcY(0.00));
g.lineTo(calcX(0.50), calcY(0.50));
g.moveTo(calcX(0.25), calcY(0.25));
g.lineTo(calcX(0.75), calcY(0.75));
g.beginFill(0x000000);
g.drawCircle(mouseX, mouseY, 50);
g.endFill();
for (var index:uint = 0; index < 4; ++index) {
var rad:Number = _rotate + (Math.PI * 0.5 * index);
for (var count:uint = 0; count < 10; ++count) {
var length:Number = 50 + (Math.random() * 600);
var dot:Dot = new Dot();
dot.x = mouseX + (length * Math.cos(rad));
dot.y = mouseY + (length * Math.sin(rad));
this.addChild(dot);
}
}
}
}
}
import flash.display.Sprite;
import caurina.transitions.Tweener;
class Dot extends Sprite {
public function Dot():void {
this.graphics.beginFill(0x80ff80);
this.graphics.drawCircle(0, 0, 2);
this.graphics.endFill();
Tweener.addTween(this,
{
alpha:0,
time:60,
useFrames:true,
onComplete:onEnd
}
);
}
private function onEnd():void {
parent.removeChild(this);
}
}