forked from: flash on 2011-3-21

by Diablo404 forked from flash on 2011-3-21 (diff: 4)
♥0 | Line 34 | Modified 2011-04-03 04:46:34 | MIT License
play

ActionScript3 source code

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

// forked from Yuta.Okuyama's flash on 2011-3-21
package {
  import frocessing.display.*;
  [SWF(width="1280", height="720", frameRate="60")]
  public class FrocessingSample extends F5MovieClip2DBmp{
    private var stage_width:Number  = 1280;
    private var stage_height:Number = 720;
    private var n:int = 5;
    private var t:Number = 0;
    
    public function FrocessingSample() {
      super();
    }
    
    public function setup():void {
      size( stage_width, stage_height );
      background( 0 );
      noFill();
      stroke( 255, 0.1 );
    }
    
    public function draw():void {
      if ( isMousePressed )
        background( 0, 1 );
      
      translate( 0, stage_height / 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+1, 0 );
      endShape();
      t+=0.01;
    }
  }
}