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

flash on 2009-6-24

pv3d勉強するぞ記念 6/24
Get Adobe Flash player
by yamat 23 Jun 2009
    Embed
package {
	/*pv3d勉強するぞ記念 6/24*/
	import caurina.transitions.Tweener;
	
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	import org.papervision3d.cameras.Camera3D;
	import org.papervision3d.core.proto.MaterialObject3D;
	import org.papervision3d.materials.ColorMaterial;
	import org.papervision3d.materials.special.Letter3DMaterial;
	import org.papervision3d.materials.utils.MaterialsList;
	import org.papervision3d.objects.primitives.Cube;
	import org.papervision3d.render.BasicRenderEngine;
	import org.papervision3d.scenes.Scene3D;
	import org.papervision3d.typography.Font3D;
	import org.papervision3d.typography.Text3D;
	import org.papervision3d.typography.fonts.HelveticaBold;
	import org.papervision3d.view.Viewport3D;
	
	[SWF(width=465,height=465,frameRate=30,background=0x0)]

	public class Test3d extends Sprite
	{
		private var scene:Scene3D;
		private var camera:Camera3D;
		private var vp:Viewport3D;
		private var renderer:BasicRenderEngine;
		private var myCube:Cube;
		private var words:Array=new Array();
		private var str:String="ZIGXZAG.NET";
		
		public function Test3d()
		{
			scene=new Scene3D();
			
			camera=new Camera3D();
			camera.zoom=1.5;
			camera.fov=45;
			
			vp=new Viewport3D(0,0,true,true);
			vp.opaqueBackground=0x000000;
			this.addChild(vp);
			
			renderer=new BasicRenderEngine();
			
			//text
			for(var i:uint=0;i<str.length;i++){
			var mat:Letter3DMaterial=new Letter3DMaterial(0xffffff,1);
			var font:Font3D=new HelveticaBold();
			words.push(new Text3D(str.charAt(i),font,mat));
			words[i].z=Math.random()*200+200;
			words[i].y=Math.random()*1000-500;
			words[i].x=Math.random()*1000-500;
			words[i].rotationY=Math.random()*360;
			scene.addChild(words[i]);
			}

			
			this.addEventListener(Event.ENTER_FRAME,rendering);
			stage.addEventListener(MouseEvent.CLICK,stageClick);
		}
		public function rendering(e:Event):void
		{
			renderer.renderScene(scene,camera,vp);
			
			for(var i:uint=0;i<str.length;i++){
				words[i].rotationY+=5;
		}
	}
	public function stageClick(e:MouseEvent):void
	{
		stage.removeEventListener(MouseEvent.CLICK,stageClick);
		for(var i:uint=0;i<words.length;i++){
			Tweener.addTween(words[i],{
							x:60*i-200,
							y:70,
							z:100,
							rotationY:0,
							time:2.0,
							transition:"easeOutElastic"});
		}
	}
	}
}