In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

わっさー

よく見かける表現だけど今更ながらやってみた
Get Adobe Flash player
by 178ep3 26 Sep 2009
/**
 * Copyright 178ep3 ( http://wonderfl.net/user/178ep3 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/qa6i
 */

//よく見かける表現だけど今更ながらやってみた
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 Une extends Sprite
	{
		private var _list:Array = [];
		private var bmp:Bitmap;
		
		public function Une()
		{
			bmp = addChild(new Bitmap(new BitmapData(465,465,true,0x00)))as Bitmap;
			for(var i:uint=0; i<180; 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*2;
				var line:Number = Math.random()*3+5;
				var alpha:Number = Math.random()*0.5+0.5;
				var s:Eda = new Eda(p,n,length,angle,line,alpha);
				s.addEventListener("add",add);
				_list.push(s);
			}
			addEventListener(Event.ENTER_FRAME,loop);
		}
		
		private function add(e:Event):void
		{
			var o:Object = e.currentTarget.Property;
			var s:Eda = new Eda(o.p,o.n,o.l,o.a,o.li,o.al);
			_list.push(s);
		}
		
		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 get Property():Object
	{
		var sp:Point = new Point(p.x,p.y);
		var sn:Point = new Point(n.x,n.y);
		var slength:Number = length;
		var sangle:Number = angle;
		var sline:Number = line;
		var salphas:Number = alphas;
		
		return {p:sp,n:sn,l:slength,a:sangle,li:sline,al:salphas};
	}
	
	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(line,0x00,alphas);
			moveTo(p.x,p.y);
			lineTo(n.x,n.y);
			endFill();
		}
		length *= 0.99;
		line *= 0.96;
		alphas *=0.96;
		
		var j:Number = Math.random()-0.5;
		if(j<0)angle -= 6;
		else angle += 6;
		
		p.x = n.x;
		p.y = n.y;
		
		j = Math.random();
		if(j>0.92)dispatchEvent(new Event("add"));
		
		return alphas < 0.02
	}
}