flash_wave_001

by akirasada1972 forked from flash on 2011-7-21 (diff: 40)
♥0 | Line 73 | Modified 2017-01-11 21:44:34 | MIT License
play

ActionScript3 source code

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

// forked from snaf's flash on 2011-7-21
package  {
    import frocessing.display.*;
    import flash.geom.ColorTransform;;
    import flash.text.TextFormat;
    import flash.text.TextField;  
    import flash.media.Sound;
    import flash.media.SoundChannel; 
    import flash.media.SoundTransform;
    import flash.net.URLRequest;

    [SWF(width="550",height="550",frameRate="30")]
    
    public class Wave extends F5MovieClip2DBmp{
    
      private var cr:int=12;
      private var ty:Number=0;
      private var ii:Number=0; 
      private var ct:ColorTransform=new ColorTransform(0.98,0.98,0.98);
    
        public function Wave() {
          super();
        }
        
        public function setup():void {
          background(0);
          noFill();
        }
        
        public function draw():void {
          stroke( random(100,200),random(100,200),random(100,200), 0.5);
          strokeWeight(random(3));
          translate( 0, 500);
          beginShape();
          curveVertex( -100, 0 );
          
          for ( var i:int=0; i <= cr; i++ ){
            var numX:Number = i * 50;
            var numY:Number = noise( i * 0.5, ty,i*0.5 ) * 300 -300;
            curveVertex( numX, numY );
          }
        
          curveVertex(700, 0 );
          endShape();
          bitmapData.colorTransform(bitmapData.rect,ct)
          if(ii<5){
           ty+=0.01;
           i--;
          }else{
           ty-=0.01;
           i++;
          }
          }

          var text:TextField;
          var format:TextFormat;
        public function showText():void{
                format=new TextFormat();
                format.font="arial";
                format.size=50;
                format.color=0xffffff;
                text=new TextField();
                text.defaultTextFormat=format;
                text.x=100;
                text.y=200;
                text.width=450;
                text.height=100;
//                text.alpha=0.3;
                text.thickness=0.5;
                text.sharpness=3;
                text.text="DJ AKIRA SADA";
                stage.addChild(text);
        }

        public function sound():void{         
          var a_snd:Sound=new Sound();
          var snd_URL:URLRequest=new URLRequest("http://www.sexydesign.club/akira.mp3");
          a_snd.load(snd_URL);
          var a_sndCh:SoundChannel=a_snd.play();
          var a_sndTr:SoundTransform=new SoundTransform();
          a_sndTr.volume=0.5;
          a_sndCh.soundTransform=a_sndTr;
//          a_snd.play(0,1,a_sndTr);
        }                                      
   }
}