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

PerlinTexture

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

package {
    
    import flash.display.*;
    import flash.geom.*;
    import flash.filters.BlurFilter;
    
    public class FlashTest extends Sprite {
        
        public function FlashTest() {
            
           var canvas:BitmapData = new BitmapData(1000,1000,false, 0x000000);
            addChild(new Bitmap(canvas));
             
            scaleX = scaleY = 0.5;
            var w:int = canvas.width
            var hw:int = w / 2;
            var hhw:int = hw / 2;
            var size:int = canvas.width * canvas.width;
             
            canvas.perlinNoise( hhw,hhw, 1, Math.random()*100, false,  false,  1,  true );
             
            var i:int = 0;
            var xp:int, yp:int, col:uint;
            for ( i; i < size; ++i ) {
                xp = i % w;
                yp = int(i / w);
                col =  canvas.getPixel(xp, yp) / (-20 | i +xp) >> 8 & 0xFF;
                canvas.setPixel( xp,  yp,  col <<16 | col <<8 | col);
            }
             
            canvas.applyFilter(canvas, canvas.rect, new Point(0,0), new BlurFilter(4,4,1));
            var blur:BitmapData = canvas.clone();
            blur.applyFilter(blur, blur.rect, new Point(0,0), new BlurFilter(10,10,1));
             
            canvas.draw(blur, null, null, BlendMode.DARKEN);
            
        }

     }

}