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: PerlinWaves

@author: BigRobot
@date  : 13 jan 2009
Get Adobe Flash player
by hrtsgt 07 May 2009
// forked from Robot's PerlinWaves
//@author: BigRobot
//@date  : 13 jan 2009

package{
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    import flash.filters.GlowFilter;
    
    [SWF(backgroundColor="0x00")]
    public class Waves extends Sprite{

        private var __bmd  :BitmapData;
        private var __val  :Number = 0;
        private var __angle:Number = 0;
        private var __color:Number = 0xFF6600;
        public function Waves() {
            stage.quality = StageQuality.LOW;
            this.filters = [ new GlowFilter( 0xFF3300, 1, 3, 3 ) ]
            build();
        }

        private function build():void {
            __bmd = new BitmapData( 50, 50, true, 0 ); 
           this.addEventListener( Event.ENTER_FRAME, doMagic );
        }
        
        private function doMagic( evt:Event ):void {
            drawBMD();
            drawLines();
        }

       
        private function drawBMD():void {
           __bmd.perlinNoise(__bmd.width / 3,__bmd.height / 3,3,6456,true,true,2|1,false,[new Point(__val +=1,0),
            new Point(__val/10,0),new Point(0,0)]);
        }

        private function drawLines():void {
	    this.graphics.clear();

	    for (var w:uint=0; w<__bmd.width; w++){
                this.graphics.moveTo( stage.stageWidth/2, stage.stageHeight+5);
	        var thickness:Number  = __bmd.getPixel( 0, w)/100000;
	        this.graphics.lineStyle( thickness / 35, __color, .05);
	        for (var h:int=__bmd.height-1; h>=0; h--){
	            var __value:Number = __bmd.getPixel( w, h)/100000;
	            this.graphics.lineTo( (__value*2.6 - stage.stageWidth/2)/(h/2.5+1)*2.5 + stage.stageWidth/2, h*(stage.stageHeight/50) );
		}
	    }
        }
    }

}