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

bitmap.perlinNoise

Get Adobe Flash player
by _ryotaros 27 Dec 2009
    Embed
/**
 * Copyright _ryotaros ( http://wonderfl.net/user/_ryotaros )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/80bb
 */

package {
	import flash.geom.Point;
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.BitmapDataChannel;
    import flash.display.Sprite;
    import flash.events.Event;
    
    public class FlashTest extends Sprite {
    	
    		private var bmpdata:BitmapData;
    	
        public function FlashTest() {
     		
     		bmpdata = new BitmapData( 120, 120, false, 0);
     		var bmp:Bitmap =new Bitmap(bmpdata);
  	  		bmp.scaleX = bmp.scaleY = 4;
  	  		addChild( bmp );
  	  		
  	  		addEventListener( Event.ENTER_FRAME, enterframe );
  	    }
  	    
  	    private var baseX:Number = 60;
  	    private var baseY:Number = 60;
  	    private var octvas:uint = 4;
  	    private var randomSeed:int = Math.random()*0xffffffff;
  	    private var stitch:Boolean = false;
  	    private var fractalNoise:Boolean = true;
  	    private var channelOptions:int = BitmapDataChannel.GREEN | BitmapDataChannel.BLUE;
  	    private var grayScale:Boolean = false;
  	    private var offset:Array = [new Point(), new Point() , new Point(), new Point()]
  	    
  	    private function enterframe (e:Event):void {
  	    		bmpdata.perlinNoise(baseX, baseY, octvas, randomSeed, stitch, fractalNoise, channelOptions, grayScale,offset );
  	    		offset[0].y += 1;
  	    		offset[1].y += 1;
  	    		offset[2].y += 0.5;	
  	    		offset[3].y += 0.25;
  	    }
    }
}