降雪っぽく。
/**
* Copyright seino ( http://wonderfl.net/user/seino )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/aL7V
*/
package {
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.geom.Vector3D;
import flash.geom.Point;
import flash.events.Event;
[SWF(width="400", height="400", backgroundColor="#000000", frameRate="50")]
public class ClickDraw extends Sprite{
public function ClickDraw():void {
//消失点の設定
transform.perspectiveProjection.projectionCenter = new Point(stage.width/2, stage.height/2);
addEventListener(Event.ENTER_FRAME,onMouseMove);
}
private function onMouseMove(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() * 5);
var color:int = 0x99ffff;
var oneCircle:MovieClip = new DrawCircle(rX
,rY
,nR
,color);
oneCircle.x = rX;
oneCircle.y = rY;
oneCircle.z = 0; //z座標を設定しておかないと回転が上手くいかない。
stage.addChild(oneCircle);
}
}
}
import flash.display.MovieClip;
import flash.events.Event;
import flash.geom.Vector3D;
import flash.filters.BlurFilter;
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{
var myFilters:Array = new Array();
var blurNm:int = z * 0.1;
var filter:BlurFilter = new BlurFilter(blurNm,blurNm,1);
myFilters.push(filter);
filters = myFilters;
z += 3;
alpha -= 0.01;
//ただの遊びの痕跡。
// transform.matrix3D.prependRotation(5*(1*Math.random()),Vector3D.X_AXIS);
// transform.matrix3D.prependRotation(5*(1*Math.random()),Vector3D.Y_AXIS);
// transform.matrix3D.prependRotation(5*(1*Math.random()),Vector3D.Z_AXIS);
if(alpha <= 0){
stage.removeChild(this);
}
}
}