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

Sierpinski gasket

某所で見つけたものがおもしろそうだったので組んでみた
Get Adobe Flash player
by Susisu 29 Mar 2010
    Embed
/*
 * 某所で見つけたものがおもしろそうだったので組んでみた
 */
package {
	import flash.display.Sprite;
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.PixelSnapping;
	import flash.events.Event;
	[SWF(width="512", height="512", backgroundColor="0x000000", frameRate="60")]
	public class gasket extends Sprite {
		private var _canvas:BitmapData=new BitmapData(512,512,false,0x000000);
		private var bmp:Bitmap=new Bitmap(_canvas,PixelSnapping.AUTO,true);
		private var point:Array;
		private var px:Number,py:Number,r:int;
		private var n:int=3;
		public function gasket() {
			point=new Array(n);
			for(var i:uint=0;i<n;i++){point[i]=new Array(2);point[i]=[Math.cos(i*360/n/180*Math.PI)*240+256,Math.sin(i*360/n/180*Math.PI)*240+256];}
			px=Math.random()*512;
			py=Math.random()*512;
			addChild(bmp);
			Wonderfl.capture_delay(200);
			addEventListener("enterFrame", loop);
		}
		private function loop(e:Event):void{
			_canvas.setPixel(px,py,0xffffff);
			r=Math.floor(Math.random()*n);
			px+=(point[r][0]-px)/2;
			py+=(point[r][1]-py)/2;
		}
	}
}