forked from: forked from: forked from: forked from: blazingFire
参考: 「けむり」
http://wonderfl.net/code/c896da1db99f89a8958b286f4775cdeb4aa32690
/**
* Copyright chiro ( http://wonderfl.net/user/chiro )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/cZzt
*/
// forked from tnker's forked from: forked from: forked from: blazingFire
// 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)&0x00FF00);
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 -= 5;
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);
}
}
}