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

Silky Landscape

I like how the moiré pattern makes it look like silk.
/**
 * Copyright forresto ( http://wonderfl.net/user/forresto )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/m4pY
 */

// forked from nutsu's FrocessingSample
// I like how the moiré pattern makes it look like silk.
package {
    import frocessing.display.*;
    
    [SWF(width="465", height="465", frameRate="60")]
    public class SilkyLandscape extends F5MovieClip2DBmp
    {
        private var stage_width:Number  = 465;
        private var stage_height:Number = 465;
        private var n:int    = 5;
        private var t:Number = 0;
        
        private var scrollStart:Number = 50;
        private var scrollEnd:Number = stage_height + 20;
        private var scrollDown:Boolean = true;
        private var position:Number = scrollStart;
        
        public function SilkyLandscape ()
        {
            super();
        }
        
        public function setup():void
        {
            size( stage_width, stage_height );
            background( 0 );
        }
        
        public function draw():void
        {
            if( isMousePressed )
                scrollDown = false;
            
            translate( 0, position );
            if (position > scrollEnd) {
                scrollDown = false;
            } else if (position < scrollStart) {
                scrollDown = true;
            }
            // Scroll slow down, fast up
            position = scrollDown ? position + .1 : position - 1;
                        
            fill(0, 0, 0, 0.07);
            stroke( 255, 0.2 );
                           
            beginShape();
            curveVertex( -100, 0 );
            for( var i:int=0; i<=n; i++ ) {
                var xx:Number = i * stage_width / n;
                var yy:Number = noise( i * 0.25, t ) * 300 - 150;
                curveVertex( xx, yy );
            }
            curveVertex( stage_width+100, 0 );
            stroke( 0, 0 );
            vertex(stage_width, stage_height)
            vertex(0, stage_height)
            endShape();
            
            t+=0.01;
        }
    }
}