forked from: forked from: forked from: blazingFire
参考: 「けむり」
http://wonderfl.net/code/c896da1db99f89a8958b286f4775cdeb4aa32690
/**
* Copyright 0xABCDEF ( http://wonderfl.net/user/0xABCDEF )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/gbzn
*/
// forked from Nicolas's forked from: forked from: blazingFire
// forked from undo's forked from: blazingFire
// forked from HNAR's blazingFire
//参考: 「けむり」
//http://wonderfl.net/code/c896da1db99f89a8958b286f4775cdeb4aa32690
package {
import flash.filters.BlurFilter;
import flash.display.Shape;
import flash.display.Sprite;
import flash.events.Event;
[SWF(width=465,height=465,backgroundColor=0x000000,frameRate=60)]
public class Fire extends Sprite {
public function Fire() {
var a:Array = new Array();
var i:int;
var base:Sprite = new Sprite();
base.filters = [new BlurFilter(8, 16, 1)];
addChild(base);
function ef(e:Event):void {
for(i=0;i<2;i++)
{
var s:Sprite = new Sprite();
s.alpha = Math.random()*0.5+0.5;
s.graphics.beginFill((Math.random()*0xffffff)&0x2222ff);
var rnd:Number = Math.random()*20+10;
s.graphics.drawCircle(0,0,rnd);
s.graphics.endFill();
s.blendMode = "add";
base.addChild(s);
s.x = stage.mouseX + Math.random()*20-10;
s.y = stage.mouseY + Math.random()*20-10;
a.push(s);
}
for(i=0;i<a.length;i++){
a[i].x += Math.random()*2-1;
a[i].y -= 3;
a[i].alpha -= 0.02;
a[i].scaleX -= 0.02;
a[i].scaleY -= 0.02;
if(a[i].alpha<=0){
base.removeChild(a[i]);
a.splice(i,1);
}
}
}
stage.addEventListener(Event.ENTER_FRAME, ef);
}
}
}