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

...
@author sliz http://game-develop.net/
Get Adobe Flash player
by bradsedito 28 Apr 2011
/**
 * Copyright bradsedito ( http://wonderfl.net/user/bradsedito )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/jHtF
 */

// forked from sliz's water
package  
{
    import flash.filters.GlowFilter;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.geom.Point;
    import flash.geom.Rectangle;
    import sliz.miniui.Silder;
    import flash.filters.BlurFilter;
    import flash.filters.GlowFilter;
    import gs.*;
    import gs.easing.*;

    public class TestBmd extends Sprite
    {
        private var rect:Rectangle;
        private var bmd:BitmapData;
        private var view:BitmapData;
        private var length:int;
        private var bw:uint;
        private var bh:uint;
        private var min:int = 5;
        private var cx:Number;
        private var cy:Number;
        private var offsets:Array;
        private var p1:Point; 
        private var p2:Point;
        private var speed:int = 30;
        
        public function TestBmd() 
        {
            p1 = new Point();
            p2 = new Point();
            offsets = [p1,p2];
            bmd = new BitmapData(456, 456, false);
            view = new BitmapData(bmd.width, bmd.height, false);
            cx = bmd.width / 2;
            cy = bmd.height / 2;
            length = bmd.width * bmd.height;
            bw = bmd.width;
            bh = bmd.height;
            rect = bmd.rect;
            var image:Bitmap = new Bitmap(view);
            addChild(image);
            //image.scaleX = image.scaleY = 2;d
            addEventListener(Event.ENTER_FRAME, update);
            
            var minSlider:Silder = new Silder(10, 10, this, "min:num", setMin);
            minSlider.value = 0.2;
        }
        
        private function setMin(v:Number):String
        {
            var rv:Number = v * 30 + 2;
            min = rv;
            return rv + "";
        }
        
        private function update(e:Event):void 
        {
            var dColors:uint = (0xffffff  * Math.random() );
            var blurr:BlurFilter = new BlurFilter(3,3,3);
            var gloww:GlowFilter = new GlowFilter(0xff9900,1, 4,4, 1,2,false);   

            p1.x -= (mouseX - cx) / speed; 
            p2.y -= (mouseY - cy) / speed;
            bmd.perlinNoise(200, 200, 2, 1, true, true, 7,false,offsets);
            this.filters = [gloww];
            view.lock();
            for (var x:int = 0; x < bw;x++ ) {
                for (var y:int = 0; y < bh;y++ ) { 
                    view.setPixel(x, y, (bmd.getPixel(x, y) << 24 >>> 24) % min < 1?0:0xffffff);
                }
            }
            view.unlock();
        }
        
    }

}