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

土着神「宝永四年の赤蛙」

東方風神録のスペル、土着神「宝永四年の赤蛙」風なものを作ってみた
* マウスカーソルについてきます
* 3匹にはなりませんが
Get Adobe Flash player
by Susisu 07 Mar 2010
/* 東方風神録のスペル、土着神「宝永四年の赤蛙」風なものを作ってみた
 * マウスカーソルについてきます
 * 3匹にはなりませんが
 */
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 angle:Number,ra:Number;
		private var t:uint;
		public function Rain(){
			obj=new Array(n)
			for(var i:uint=0;i<n;i++){
				obj[i]=new Array(6);
			}
			index=[0,0];
			addChild(stg);
			stg.addChild(stgBmp);
			
			stg.addEventListener("enterFrame", loop);
			filterObj=new BlurFilter();
			with(filterObj){
				blurX=2;
				blurY=2;
				quality=2;
			}
		}
		private function loop(e:Event):void{
			bmpData.applyFilter(bmpData,bmpData.rect, new Point(0, 0),filterObj);
			if(t%2==0){
				ra=Math.random()*360;
				for(var i:uint=0;i<5;i++){
					onum=counter%n;
					obj[onum][0]=mouseX;
					obj[onum][1]=mouseY;
					angle=i*72+ra;
					obj[onum][2]=Math.cos(angle/180*Math.PI)*4;
					obj[onum][3]=Math.sin(angle/180*Math.PI)*4;
					obj[onum][4]=0;
					obj[onum][5]=0xffff0000;
					index[1]=counter;
					counter++;
				}
			}
			for(i=index[0];i<=index[1];i++){
				onum=i%n;
				if(obj[onum][4]>240){
					obj[onum][0]+=obj[onum][2];
					obj[onum][1]+=obj[onum][3];
					obj[onum][2]*=0.95;
					obj[onum][3]*=0.95;
					obj[onum][5]=0xffffffff;
				}
				if(obj[onum][4]==320)index[0]++;
				obj[onum][4]++;
				bmpData.setPixel32(obj[onum][0],obj[onum][1],obj[onum][5]);
			}
			t++;
		}
	}
}