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

Realistic Water: Night Edition

/**
 * Copyright bradsedito ( http://wonderfl.net/user/bradsedito )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/2rbm
 */

// forked from bradsedito's Realistic Water / Sea / Ocean


//  BradSedito


package {
    import flash.geom.*;
    import flash.display.*;
    import com.greensock.*;
    import com.greensock.easing.*;
    
    [SWF(backgroundColor="0x000000")]
    
    public class Water extends Sprite 
    {
        public  var SW:Number = new Number( stage.stageWidth  );
        public  var SH:Number = new Number( stage.stageHeight );
        private var arr:Array = [ new Point(0,0), new Point(0,0), new Point(0,0)]
        private var sea:BitmapData = new BitmapData( SW,SW/2,true );
        
        function Water() 
        {
            addChild( new Bitmap(sea) ).y = 220;
            addEventListener( "enterFrame", onFrame);
            this.rotationX = 297;
            this.y = this.y+50;
            TweenMax.to(this, 1, {tint:0x777777, ease:Quad.easeOut});
        }
        private function onFrame(e:*):void
        {
            for(var i:int=0;i<3;i++) arr[i].x += (((i*3) % 4) - 2);
            sea.perlinNoise(256,64,3,0,true,false,8,false,arr);
        }
    }
}