forked from: forked from: forked from: blazingFire
参考: 「けむり」
http://wonderfl.net/code/c896da1db99f89a8958b286f4775cdeb4aa32690
/**
* Copyright Louis ( http://wonderfl.net/user/Louis )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/2Oor
*/
// 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(124, 16, 1)];
addChild(base);
function ef(e:Event):void {
for(i=0;i<22;i++)
{
var s:Sprite = new Sprite();
s.alpha = Math.random()*0.5+0.5;
s.graphics.beginFill((Math.random()*0xffffff)&0xff2222);
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);
}
}
}