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

Roku Shooting Version

画面クリックで輪郭線表示+ズーム+スロー再生
* 再度クリックで元に戻ります
*
* ロク(猫)の写真はこちら
* http://www.flickr.com/photos/40441900@N08/
* Blenderでモデリング
/**
 * Copyright heart_thai ( http://wonderfl.net/user/heart_thai )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/q55h
 */

// forked from buccchi's オッス、おらロク!(墨エフェクト)
// forked from buccchi's オッス、おらロク!
/**
 * 画面クリックで輪郭線表示+ズーム+スロー再生
 * 再度クリックで元に戻ります
 *
 * ロク(猫)の写真はこちら
 * http://www.flickr.com/photos/40441900@N08/
 * Blenderでモデリング
 */

package {
	import flash.display.Sprite;
    import flash.events.Event;
	import flash.utils.Timer;
	import org.papervision3d.cameras.Camera3D;
	import org.papervision3d.materials.ColorMaterial;
	import org.papervision3d.scenes.Scene3D;
	import org.papervision3d.view.Viewport3D;
	import flash.events.TimerEvent;
	import org.papervision3d.objects.primitives.Sphere;
 	import net.hires.debug.Stats;
    import org.papervision3d.render.BasicRenderEngine;
	
	
    import org.papervision3d.objects.parsers.DAE;
    
    import flash.events.MouseEvent;

    
    public class FlashTest extends Sprite {
    	
		private var mountens:Vector.<DAE>;
		private var powers:Vector.<Sphere>
		private var roku:DAE;
		
		private var scene:Scene3D;
		private var camera:Camera3D;
		private var vp:Viewport3D;
		private var rd:BasicRenderEngine;
		
		private var tm:Timer;
		
        public function FlashTest():void {
        	 addChild( new Stats() );
			scene = new Scene3D();
			camera = new Camera3D();
			rd = new BasicRenderEngine();
			vp = new Viewport3D(stage.stageWidth , stage.stageHeight );
			addChild(vp);
			camera.zoom = 50;
			
			createMouten();
			createRoku();
			
			camera.y = 100; 
			
			powers = new Vector.<Sphere>();
			tm = new Timer(200);
			tm.addEventListener(TimerEvent.TIMER , shotting );
			//
			
			this.addEventListener(Event.ENTER_FRAME , loop);
			stage.addEventListener(MouseEvent.MOUSE_DOWN , shot );
			stage.addEventListener(MouseEvent.MOUSE_UP , stopShot );
		}
		private function shot(e:MouseEvent):void {
			tm.start();
		}
		private function stopShot(e:MouseEvent):void {
			tm.stop();
		}
		private function shotting(e:TimerEvent):void {
			var c:ColorMaterial = new ColorMaterial(0xFF0000,0.5);
			var p:Sphere = new Sphere( c , 50 );
			p.x = roku.x;
			p.y = roku.y;
			p.z = roku.z;
			scene.addChild(p);
			powers.push(p);
		}
		private function createMouten():void {
			mountens = new Vector.<DAE>();
			for(var i:int = 0 ; i<=20 ; i++){
				var mountain:DAE = new DAE();
				mountain.load("http://7980.oui-imja.com/wonderfl/201002/mountain.dae");
				scene.addChild(mountain); 
				mountain.y = -100;
				mountain.scale = 10;
				mountain.x = 1000-(Math.random()*2000);
				mountain.z = 1000 - (Math.random() * 2000);
				mountens.push(mountain);
			}
					
		}
		private function createRoku():void{
			roku = new DAE();
			roku.load("http://7980.oui-imja.com/wonderfl/201002/roku.dae");
			scene.addChild(roku);
			roku.scale = 20;
			roku.rotationY = 90;
			roku.z = -700;
		}
		private function loop(event:Event):void {
			var sx:Number = (mouseX-(stage.stageWidth/2)) - roku.x;
			roku.x += sx/10;
			for (var i:String in mountens) {
				mountens[i].z -= 50;
				if (mountens[i].z < -1000) {
					mountens[i].z = 1000;
					mountens[i].x = 1000-(Math.random()*2000);
				}
			}
			for (i in powers) {
				powers[i].z += 150;
				if (powers[i].z > 5000) {
					scene.removeChild(powers[i]);
					powers.splice(int(i), 1);
				}
			}
			rd.renderScene(scene , camera, vp);
		}
    }
}