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

TailSoundVisualizer

音にあわせて左右に揺れながら伸びるSoundvsualizer

音素材は「"taitai studio"テーマ別Midi素材ダウンロード」http://www.taitaistudio.com/theme.shtml のクリスマス→#06 ジングル・ベルを使用させていただいています。
/**
 * Copyright yabuchany ( http://wonderfl.net/user/yabuchany )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/mY48
 */

package {
	import com.bit101.components.*;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.media.Sound;
	import flash.media.SoundChannel;
	import flash.media.SoundLoaderContext;
	import flash.media.SoundMixer;
	import flash.net.URLRequest;
	import flash.utils.ByteArray;
	import frocessing.display.*;
	
	
    
    [SWF(width="465", height="465", frameRate="60")]
    public class TailSounds extends F5MovieClip2DBmp {
        private var inc:Number = 0;
		private var s:Sound = new Sound();
		private var sc:SoundChannel;
		private var ba:ByteArray = new ByteArray();
		private var array:Array;
		private var a:Number = 0;		
        
        public function TailSounds() {
            super();
        }
        public function setup():void {
            colorMode(HSB, 100);
            smooth();
            background(0);
			var context:SoundLoaderContext = new SoundLoaderContext(10, true);
			var req:URLRequest = new URLRequest("http://www.yabuchany.com/blog/wp-content/uploads/2010/12/src/jingle.mp3");
			//var req:URLRequest = new URLRequest("http://www.takasumi-nagai.com/soundfiles/sound001.mp3");
			//var req:URLRequest = new URLRequest("http://level0.kayac.com/images/murai/Digi_GAlessio_-_08_-_ekiti_son_feat_valeska_-_april_deegee_rmx.mp3");
			s.load(req,context);
			s.addEventListener(Event.COMPLETE, loadCompleteHandler);
			
        }
		public function loadCompleteHandler(e:Event):void {
			new PushButton(this, stage.stageWidth/2-50, 445, "Play", playmusic);
		}
		
		public function playmusic(e:MouseEvent):void{
			sc = s.play(0, 9999);
			
			new PushButton(this, stage.stageWidth/2-50, 445, "Stop", playstop);
		}
		public function playstop(e:MouseEvent):void {
			new PushButton(this, stage.stageWidth/2-50, 445, "Play", playmusic);
			sc.stop();
		}		
        public function draw():void {
			SoundMixer.computeSpectrum(ba, true, 0);
			a = 0;
            background(0);
			for (var i:int = 0; i < 512; i = i + 8) {
				
				var c:int;
				for (c = 0; c < 100; c++) {
					stroke(random(100),60,100,100);
				}
				inc +=0.0001+i/500000;
				var angle:Number = sin(inc) / 40.0 + sin(inc * 1.2) / 20.0;	
				if (a > 0) {
					a = ba.readFloat();
				}
				for (var j:int = 0; j < 1; j++) {
					a = ba.readFloat();
				}
				
				var num:int =100;
				tail(i+80,stage.stageHeight/20*19, a*num, angle+0.00001);
				tail(i+40, stage.stageHeight / 20 * 10, a * num, -(angle + 0.00001));
				translate(+2,-1.5);
			}
        }	
        public function tail(x:int,y:int,units:int,angle:Number):void {
            pushMatrix();
            translate(x,y);
            for(var i:int=units;i>0;i--){
                strokeWeight(8);
                line(0, 0, 0, -8);
                translate(0,-8);
                rotate(angle);
            }
            popMatrix();
        }
    }
}