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

DSみたいに息吹きかけたら転がっていくやーつ

マイクに向かって息を吹きかけると、玉が奥に転がっていきます。
マイクのボリュームに動作が左右されるのでご了承を。。。
My Note PCだと結構うまく動いてくれました。
Get Adobe Flash player
by fakestar0826 26 Jan 2010

    Talk

    tests2090 at 13 Sep 2012 21:06
    echo poblem is problem do for high, lower and higher sound it is good for autism children . if make god pray for you
    tests2090 at 13 Sep 2012 21:06
    echo poblem is problem do for high, lower and higher sound it is good for autism children . if make god pray for you

    Tags

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

package {
	/*
	 * マイクに向かって息を吹きかけると、玉が奥に転がっていきます。
	 * マイクのボリュームに動作が左右されるのでご了承を。。。
	 * My Note PCだと結構うまく動いてくれました。
	 */
     import flash.events.*;
     import org.papervision3d.lights.PointLight3D;
     import org.papervision3d.materials.*;
     import org.papervision3d.materials.special.*;
     import org.papervision3d.objects.primitives.*;
     import org.papervision3d.cameras.*;
     import org.papervision3d.objects.*;
     import org.papervision3d.view.*;
     import org.papervision3d.view.stats.*;
     import org.papervision3d.core.render.filter.*;
     import flash.events.MouseEvent;
     import flash.media.*;
     import flash.system.Security;
     import flash.system.SecurityPanel;
     
     [SWF(width = 465, height = 465, backgroundColor = 0x000000, frameRate = 60)]
     public class Main extends BasicView {
     	
     	private var wrap:DisplayObject3D;
     	private var X:int = 0;
     	private var sphere:Sphere;
     	private var plane:Plane;
     	private var mic:Microphone = Microphone.getMicrophone();
     	private var firstV:int = 0;
     	
        public function Main():void {
        		var fg:FogMaterial = new FogMaterial(0xFFFFFF);
        		renderer.filter = new FogFilter(fg, 40, 1000,10000);
        		
        		//Security.showSettings(SecurityPanel.MICROPHONE);
            mic.setLoopBack(true);
                    
            if (mic != null) {
                mic.setUseEchoSuppression(true);
                mic.addEventListener(ActivityEvent.ACTIVITY, activityHandler);
                mic.addEventListener(StatusEvent.STATUS, statusHandler);
            }
           
        		camera.y = 100;
            wrap = new DisplayObject3D();
            scene.addChild(wrap);
            
            var material:WireframeMaterial = new WireframeMaterial(0xFF0000);
            		
            sphere = new Sphere(material, 200, 20, 20);
            plane = new Plane(new ColorMaterial(0x000000), 1000, 10000, 20, 20);
            plane.rotationX = 90;
            plane.y = - 200;
            plane.z = 4500;
            wrap.addChild(plane);
            wrap.addChild(sphere);
            
            startRendering();
            
            addEventListener(Event.ENTER_FRAME,loop);
        }
        
        public function loop(e:Event):void
        {
        		if(mic.activityLevel > 10)
        		{
        			firstV = mic.activityLevel;
        		}
        		//ここに入る前に音量で一定以上のときじゃないと動作しないようにして、
        		//吹き始めの初速度を保存して、それのみで動作中の速度を計算。
        		
        		//挙動調整中・・・
        		sphere.z += firstV * 0.9;//摩擦抵抗のつもり
	        	sphere.rotationX += firstV * 0.9;
        		
        }
        
        private function activityHandler(event:ActivityEvent):void {
            trace("activityHandler: " + event);
        }

        private function statusHandler(event:StatusEvent):void {
            trace("statusHandler: " + event);
        }
    }
}