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

Noise Test

Noise test...
/**
 * Copyright Pelisalinet ( http://wonderfl.net/user/Pelisalinet )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/yPQ2
 */

package {
    
    import flash.display.*;
    import flash.geom.Point;
    import flash.events.Event;
    
    [SWF(width=465,height=465,backgroundColor=0)]
    public class Water extends Sprite {
        
        private var bmpdata:BitmapData;
        public var $:Object = new Object();
        public var offset:Array = [new Point(),new Point(),new Point()];
        
        public function Water() {
           
            bmpdata = new BitmapData( stage.stageWidth, stage.stageHeight, true, 0 );
            var bmp:Bitmap = new Bitmap(bmpdata);
            addChild( bmp );
            
            $.baseX        = 100;
            $.baseY        = 100;
            $.octaves      = 2;
            $.randomSeed   = Math.random()*10-30;
            $.stitch       = false;
            $.fractalNoise = true;
            $.channelOptions   = BitmapDataChannel.BLUE|0x0000FF;
            $.grayScale    = true;
        
            
            addEventListener( Event.ENTER_FRAME, enterframe );
        }
        
        private function enterframe(e:Event):void {

            bmpdata.perlinNoise( $.baseX, $.baseY, $.octaves, $.randomSeed, 
                                 $.stitch, $.fractalNoise, $.channelOptions, $.grayScale, offset);
            offset[0].x += 2;
            offset[1].x += 1;
            offset[2].x += 0.5;
            offset[0].y -= 2;
            offset[1].y += 1;
            offset[2].y += 0.5;
            offset[0].z += 2;
            offset[1].z += 1;
            offset[2].z -= 0.5;
        }
    }
}