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 Susisu 12 Mar 2010
package {
	import flash.display.Sprite;
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.PixelSnapping;
	import flash.filters.*;
	import flash.geom.Point;
	import flash.events.Event;
	
	[SWF(width="465", height="465", backgroundColor="0x000000", frameRate="60")]
	public class Rain extends Sprite{
		private var stg:Sprite=new Sprite();
		private var bmpData:BitmapData=new BitmapData(465,465,true,0x00000000);
		private var stgBmp:Bitmap=new Bitmap(bmpData,PixelSnapping.AUTO,true);
		private var obj:Array;
		private var n:uint=2047;
		private var counter:uint=0;
		private var index:Array;
		private var onum:uint=0;
		private var filterObj:BlurFilter;
		private var r:int;
		private var g:int;
		private var b:int;
		private var angle:Number;
		public function Rain(){
			obj=new Array(n)
			for(var i:uint=0;i<n;i++){
				obj[i]=new Array(5);
			}
			index=[0,0];
			addChild(stg);
			stg.addChild(stgBmp);
			
			stg.addEventListener("enterFrame", loop);
			filterObj=new BlurFilter();
			with(filterObj){
				blurX=2;
				blurY=2;
				quality=2;
			}
			r=Math.floor(Math.random()*256);
			g=Math.floor(Math.random()*256);
			b=Math.floor(Math.random()*256);
		}
		private function loop(e:Event):void{
			bmpData.applyFilter(bmpData,bmpData.rect, new Point(0, 0),filterObj);
			for(var i:uint=0;i<31;i++){
				onum=counter%n;
				obj[onum][0]=mouseX;
				obj[onum][1]=mouseY;
				angle=Math.random()*360;
				obj[onum][2]=Math.cos(angle/180*Math.PI)*Math.random()*5;
				obj[onum][3]=Math.sin(angle/180*Math.PI)*Math.random()*5;
				obj[onum][4]=(r<<16)|(g<<8)|b;
				index[1]=counter;
				counter++;
			}
			r+=Math.floor(Math.random()*9)-4;
			g+=Math.floor(Math.random()*9)-4;
			b+=Math.floor(Math.random()*9)-4;
			if(r>255){r=255;}else if(r<0){r=0;}
			if(g>255){g=255;}else if(g<0){g=0;}
			if(b>255){b=255;}else if(b<0){b=0;}
			for(i=index[0];i<=index[1];i++){
				onum=i%n;
				obj[onum][0]+=obj[onum][2];
				obj[onum][1]+=obj[onum][3];
				obj[onum][2]*=0.95;
				obj[onum][3]*=0.95;
				bmpData.setPixel32(obj[onum][0],obj[onum][1],0xff000000|obj[onum][4]);
			}
		}
	}
}