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

Pv3d練習2。

Get Adobe Flash player
by paq 12 May 2009
// forked from paq's Pv3d練習。
package
{
	import flash.display.*;
	import flash.events.*;
	import flash.text.*;

	import flash.display.*;
	import flash.events.*;
	import flash.geom.*;
	import flash.text.*;
	import flash.filters.*;
	import flash.utils.getTimer;
	import org.papervision3d.core.clipping.FrustumClipping;
	import org.papervision3d.core.proto.MaterialObject3D;
	import org.papervision3d.lights.PointLight3D;
	import org.papervision3d.materials.ColorMaterial;
	import org.papervision3d.materials.MovieMaterial;
	import org.papervision3d.materials.shadematerials.FlatShadeMaterial;
	import org.papervision3d.materials.special.CompositeMaterial;
	import org.papervision3d.materials.utils.MaterialsList;
	import org.papervision3d.materials.WireframeMaterial;
	import org.papervision3d.objects.*;
	import org.papervision3d.objects.primitives.*;
	import org.papervision3d.view.BasicView;
	import org.papervision3d.cameras.*;
	import org.papervision3d.materials.special.Letter3DMaterial;
	import org.papervision3d.typography.fonts.HelveticaBold;
	import org.papervision3d.typography.Text3D;
	import org.papervision3d.core.effects.view.ReflectionView;
	import caurina.transitions.properties.CurveModifiers;
	import caurina.transitions.Tweener;

        [SWF(frameRate = "60", backgroundColor = "0x001122")]
	
	public class Main extends ReflectionView {		
		private var wrap:DisplayObject3D;

		public function Main()
		{
			super(0, 0, true , false, CameraType.TARGET);
			
			camera.zoom = 1.5;
			camera.focus = 200;
			wrap = new DisplayObject3D();
			
			// refrection
			surfaceHeight = 0;
			viewportReflection.alpha = .25;

			renderer.clipping = new FrustumClipping(FrustumClipping.NEAR);

			var compMat:CompositeMaterial = new CompositeMaterial();
			compMat.addMaterial(new WireframeMaterial(0xEEEEEE));
			compMat.addMaterial(new ColorMaterial(0xEEEEEE, 0.1));

			var planeB:Plane = new Plane(compMat, 4000, 4000, 6, 6);
			planeB.pitch(90)
			scene.addChild(planeB);

			var lettermat:Letter3DMaterial = new Letter3DMaterial();
			lettermat.fillColor = 0x4444ff;
                        var word:Text3D = new Text3D("Papervision3D" , new HelveticaBold() , lettermat);
			    	
			word.x = 0;
			word.y = 200;
			word.z = 0;
                        word.scale = 0;

			wrap.addChild(word);
			scene.addChild(wrap);

                        Tweener.addTween(word,{scale : 3, time:2, transition:"easeInBounce"});
			this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
Wonderfl.capture(stage);
		}
		
		private function enterFrameHandler(event:Event):void
		{
			camera.x += (2000 * Math.sin(mouseX / stage.stageWidth * 360 * Math.PI / 180) - camera.x) * .1;
			camera.z += (2000 * Math.cos(mouseX / stage.stageWidth * 360 * Math.PI / 180) - camera.z) * .1;
			camera.y += (2000 * mouseY / stage.stageHeight - camera.y) * .1;

			singleRender();
		}
	}
}