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

Lines

@author kris@neuroproductions.be
// forked from neuro's flash on 2009-4-30
package  
{

		
	import flash.display.Bitmap;	
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.geom.Point;		

	/**
	 * @author kris@neuroproductions.be
	 */
	public class Main extends Sprite 
	{
		private var h:int =1000
		private var w:int =1000
		private var bmp : BitmapData = new BitmapData(100, 100, false, 0);
		private var resultbmd : BitmapData = new BitmapData(1000, 1000, true, 0);
		private var arr : Array = new Array();
		private var px1 : Number = 0;
private var holder:Sprite =new Sprite()


	
private var rseed:int 
		public function Main()
		{
			stage.align = StageAlign.TOP_LEFT;
			//stage.scaleMode = StageScaleMode.NO_SCALE;
var bg : Sprite = new Sprite()
			bg.graphics.beginFill(0x0)
			bg.graphics.drawRect(0, 0, w, h)
			addChild(bg)
			
			var bm:Bitmap = new Bitmap(bmp)
			bm.width = w
			bm.height =h

		//	addChild(bm)
			rseed =Math.random()*1000
			addChild(holder)
			var resultBm:Bitmap =new Bitmap(resultbmd)
			resultBm.smoothing =true
			addChild(resultBm)
			
			
			
			for (var i : Number = 0; i < 50	; i++)
			{
			var l:int=arr.length
			var dp : DrawPoint = new DrawPoint(Math.random() * 200, Math.random() * 200)
			if (l<12)
			{
				dp.color = 0x888888 +(l*0x090909)
			}
			else 
			{
				dp.color = 0x770000+ (l*0x020000)
			}
			
			arr.push(dp)
			holder.addChild(dp.holder)
			
			
			}
			
			
			this.addEventListener(Event.ENTER_FRAME, loop)
			
		}


	
		
		public function  loop(e:Event) :void
		{
		
			
			bmp.perlinNoise(40, 40, 3,rseed, true, true, 2 | 1, false, [new Point(px1 += 1, 0),new Point(-px1 / 2, 0),new Point(0, 0)]);	
			for each(var c:DrawPoint in arr) 
			{
				c.holder.graphics.clear()
				
				c.xOld = c.x
				c.yOld = c.y
				var rgb24 : uint = bmp.getPixel(c.x * .1, c.y * .1);
				if(rgb24 > 0) 
				{
					c.x += (128 - (rgb24 >> 16)) / 2;
					c.y += (128 - ((rgb24 ^ (rgb24 >> 16 << 16)) >> 8)) / 2;	
				}
				c.x += (400 - c.x) /200;
				c.y += (400- c.y) /200;
				for each(var b:DrawPoint in arr) if(b != c && Point.distance(c.point, b.point) < 30) 
				{
					var ang : Number = Math.atan2(c.y - b.y, c.x - b.x);
					c.x += ((b.x + Math.cos(ang) * 100) - c.x) / 20;
					c.y += ((b.y + Math.sin(ang) * 100) - c.y) / 20;	
				}
				var dist:Number = Point.distance(c.point, new Point(c.xOld,c.yOld))
				 dist =((50 -dist) / c.size)
				var hoekRad : Number = Math.atan2(c.y - c.yOld, c.x - c.xOld) 
				var newHoek : Number = hoekRad - ( Math.PI / 2)
					
				c.point1 = Point.polar(dist, newHoek) ;
				c.point1.x += c.xOld
				c.point1.y += c.yOld
				c.point2 = Point.polar(-dist, newHoek) ;
				c.point2.x += c.xOld
				c.point2.y += c.yOld
				c.hoek = newHoek
				var fillcolor:uint =c.color-(0x010000*Math.round(c.y/15))//0xFF0000//fotobmd.getPixel(c.x,c.y)
				c.holder.graphics.lineStyle(1,fillcolor, 10);
				c.holder.graphics.beginFill(fillcolor, 1);
				c.holder.graphics.moveTo(c.point1.x,c.point1.y);	
				c.holder.graphics.lineTo(c.point2.x,c.point2.y);	
				if (c.point3 != null)
				{
					c.holder.graphics.lineStyle(1,0x000000, 1);
				c.holder.graphics.lineTo(c.point4.x,c.point4.y);	
				c.holder.graphics.lineStyle(1,0x000000,0);
				c.holder.graphics.lineTo(c.point3.x,c.point3.y);	
				c.holder.graphics.lineStyle(1,0x000000, 1);
				c.holder.graphics.lineTo(c.point1.x,c.point1.y);	
				}
				
				c.point3 = c.point1
					c.point4 = c.point2
					resultbmd.draw(c.holder)
			}	
			if(Math.random()<0.1){
				
			
			}
			
		}
	}
}
import flash.geom.Point;		
import flash.display.Sprite
class DrawPoint 
	{
		public var x : Number
		public var y : Number
		public var xOld : Number
		public var yOld : Number
		public var point1:Point
		public var point2:Point
		public var point3:Point
		public var point4:Point
		public var hoek:Number
		public var size:Number
		public var holder : Sprite = new Sprite()
		public var color:uint =0xFF0000
		
		public function DrawPoint(x : Number,y : Number)
		{
			this.x = x
			this.y = y
			size =(Math.random()*6)+1
			
		}

		public function get point() : Point
		{
		
			return new Point(x, y)
		}
	}