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

forked from: Splouch by Grégoire Divaret

package, import, class definition added by mash
others are from 
http://www.25lines.com/finalists/0812/073.txt
// forked from mash's Bottle Glass Mountains
// package, import, class definition added by mash
// others are from 
// http://www.25lines.com/finalists/0812/073.txt
package {
	import flash.display.*;
	import flash.events.*;
	import flash.filters.*;
	import flash.geom.*;
	import flash.text.*;
	import flash.utils.*;    
	public class Splouch extends Sprite {
		public function Splouch() {

		// 3 free lines! Alter the parameters of the following lines or remove them.
		// Do not substitute other code for the three lines in this section
		[SWF(width=1000, height=500, backgroundColor=0xCCCCCC, frameRate=24)]
		//stage.align = StageAlign.TOP_LEFT;
		stage.scaleMode = StageScaleMode.NO_SCALE;
		// 25 lines begins here!
		//use your mouse, click!
		var tentacles:Array = [];
		var ran:Function = Math.random;
		var stw:int = stage.stageWidth;
		var r:Number;
		var sth:int = stage.stageHeight;
		var sh:Shape = new Shape();
		var bd:BitmapData = (addChild(new Bitmap(new BitmapData(stw, sth, false, 0xFFDEDEDE))) as Bitmap).bitmapData;
		var gr:int = 25 + Math.random() * 180;
		var gv:int = 25 + Math.random() * 180;
		var gb:int = 25 + Math.random() * 180;
		var hop:Boolean = true;
		for(var i:int = 0; i < 15; i++){
				tentacles.push({
					x:stw/2,
				 	y:sth/2, 
				 	vx:(mouseX - stw/2) / 100, 
				 	vy:(mouseY - sth/2) / 100, 
				 	pts:[], life:35 + ran() * 15, 
				 	dir:true, 
				 	r:gr + ran() * 50,
				  	v: gv + ran() * 50, 
				  	b:gb + ran() * 50});
		}
		stage.addEventListener(MouseEvent.CLICK, function(e:Event):void{hop = !hop});
		addEventListener(Event.ENTER_FRAME, animate);
		function animate(e:Event):void
		{
		    bd.lock();
		    bd.fillRect(bd.rect, 0xFFDEDEDE);
		    for each (var t:Object in tentacles)
		    {
		        if(t.dir){
		        	t.pts.push({
		        		vx:0,
		         		vy:0,
		          		x:t.x += (t.vx = (t.vx += ran() * 4 - 2 + (mouseX - stw/2) / 2000) *  0.95),
		           		y:t.y += (t.vy = (t.vy += ran() * 4 - 2 + (mouseY - sth/2) / 2000)*  0.95)});
		        }else {
		        	t.pts.splice(t.pts.length-1, 1);
		        }
		        sh.graphics.moveTo(t.pts[t.pts.length-1].x, t.pts[t.pts.length-1].y);
		        for(var i:int = t.pts.length-1; i >= 0 ; i--)
		        {
		        	r = i;
		        	var thick:Number = Math.pow((1 - (r / t.pts.length)) * 10, 2) * (100 - Math.abs(t.life)) / 100;
		            var color:uint =  (r*r * t.r) << 16 | (r * r * t.v) << 8 | (r*r * t.b);
		            sh.graphics.lineStyle(thick, color);
		             var nextX:Number =  t.pts[i].x+= (t.pts[i].vx = (t.pts[i].vx += (hop ? r : 1-r) * (mouseX - t.pts[i].x) / 1500) *  0.95);
		             var nextY:Number =  t.pts[i].y+= (t.pts[i].vy = (t.pts[i].vy +=(hop ? r : 1-r) * (mouseY - t.pts[i].y) / 1500) *  0.95)
		            sh.graphics.lineTo(nextX,nextY);

		        }
		        bd.draw(sh);
		        sh.graphics.clear();
		        if((t.life-=0.5) <= 0 && t.dir){ t.dir = false;
		        }else if(!t.dir && t.pts.length <= 1){ 
		        tentacles[tentacles.indexOf(t)] = {x:t.pts[0].x, 
		        y:t.pts[0].y, 
		        vx:t.pts[0].vx, 
		        vy:t.pts[0].vy, 
		        pts:[], 
		        life:35 + ran() * 15, 
		        dir:true, 
		        r:gr + ran() * 50, 
		        v: gv + ran() * 50, 
		        b:gb + ran() * 50}
		        }
		    }
		    bd.unlock();
		}
		// 25 lines ends here!
		}
	}
}