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: PerlinNoise.as

Get Adobe Flash player
by kasoizz 31 Jul 2010
    Embed
// forked from takashi's PerlinNoise.as
package {
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.BitmapDataChannel;
    import flash.geom.Point;
    import flash.geom.Rectangle;
    import flash.display.Sprite;
    
    public class PerlinNoise extends Sprite {
        
        public function PerlinNoise () {
    
            var bmd1:BitmapData = new BitmapData(200, 200, true, 0xFFCCCCCC);
            
            var seed:int = int(Math.random() * int.MAX_VALUE);
            var channels:uint = BitmapDataChannel.RED | BitmapDataChannel.BLUE;
            bmd1.perlinNoise(100, 80, 12, seed, false, true, channels, false, null);
            
            var bitmap1:Bitmap = new Bitmap(bmd1);
            addChild(bitmap1);
            
            
            var bmd2:BitmapData = new BitmapData(200, 200, true, 0xFFCCCCCC);
            var pt:Point = new Point(0, 0);
            var rect:Rectangle = new Rectangle(0, 0, 200, 200);
            var threshold:uint =  0x00800000; 
            var color:uint = 0x00FF0000;
            var maskColor:uint = 0x00FF0000;
            bmd2.threshold(bmd1, rect, pt, ">", threshold, color, maskColor, true);
            
            var bitmap2:Bitmap = new Bitmap(bmd2);
            bitmap2.x = bitmap1.x + bitmap1.width + 10;
            addChild(bitmap2);
            
            
            
        }
    }
}