forked from: わっさー2
よく見かける表現だけど今更ながらやってみた
lineじゃなくcircleでやってみた
/**
* Copyright kmdsbng ( http://wonderfl.net/user/kmdsbng )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/3PFF
*/
// forked from 178ep3's わっさー2
// forked from 178ep3's わっさー
//よく見かける表現だけど今更ながらやってみた
//lineじゃなくcircleでやってみた
package
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Point;
[SWF(backgroundColor=0xffffff, frameRate=30)]
public class Burn extends Sprite
{
private var _list:Vector.<Eda> = new Vector.<Eda>();
private var bmp:Bitmap;
public function Burn()
{
bmp = addChild(new Bitmap(new BitmapData(465,465,true,0x00)))as Bitmap;
for(var i:uint=0; i<50; i++)
{
var p:Point = new Point(232, 232);
var n:Point = new Point(0,0);
var length:Number = Math.random()*3+2;
var angle:Number = i;
var line:Number = Math.random()*5+2;
var alpha:Number = Math.random()*0.5+0.5;
var s:Eda = new Eda(p,n,length,angle,line,alpha);
_list.push(s);
}
addEventListener(Event.ENTER_FRAME,loop);
}
private function loop(e:Event):void
{
var len:uint = _list.length-1;
var i:int=0;
for(i=len; i>=0; i--)
{
if(_list[i].Loop())_list.splice(i,1);
else bmp.bitmapData.draw(_list[i]);
}
if(_list.length==0) removeEventListener(Event.ENTER_FRAME,loop);
}
}
}
import flash.display.Shape;
import flash.geom.Point;
import flash.events.Event;
class Eda extends Shape
{
private var p:Point;
private var n:Point;
private var length:Number;
private var angle:Number;
private var line:Number;
private var alphas:Number;
public function Eda(_p:Point,_n:Point,_length:Number,_angle:Number,_line:Number,_alpha:Number)
{
p = _p;
n = _n;
length = _length;
angle = _angle;
line = _line;
alphas = _alpha;
}
public function Loop():Boolean
{
n = Point.polar(length,angle*Math.PI/180);
n.x += p.x;
n.y += p.y;
with(this.graphics)
{
clear();
lineStyle(0.5,0xaaaaaa,alphas);
beginFill(0x00,alphas);
drawCircle(n.x,n.y,line);
endFill();
}
length *= 0.99;
line *= 0.96;
alphas *=0.97;
var j:Number = Math.random()-0.5;
if(j<0)angle -= 6;
else angle += 6;
p.x = n.x;
p.y = n.y;
return alphas < 0.01
}
}