forked from: flash on 2010-5-9

by selflash forked from flash on 2010-5-9 (diff: 26)
♥0 | Line 53 | Modified 2010-05-09 04:02:49 | MIT License
play

ActionScript3 source code

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

// forked from uwi's flash on 2010-5-9
package {
    import org.papervision3d.view.BasicView;
    import flash.text.TextField;
    import flash.events.Event;
    import net.hires.debug.Stats;
    import org.papervision3d.typography.*;
    import org.papervision3d.typography.fonts.*;
    import org.papervision3d.materials.special.*;
    import org.papervision3d.objects.*;
    import org.papervision3d.core.proto.*;
    
    [SWF(backgroundColor="0x000000", frameRate="60")]

    public class PV3D extends BasicView {
        private var _tf : TextField;
        
        private var container:DisplayObject3D;
        private var m : MaterialObject3D;
        private var t : Text3D;
        
        public function PV3D() {
            super(0, 0, true, false);
            
            _tf = new TextField();
            addChild(_tf);
            _tf.textColor = 0xffffff;
            _tf.width = 100;
            _tf.height = 465;
            
//            addChild(new Stats());

         container = new DisplayObject3D();
            scene.addChild( container ); 
			m = new Letter3DMaterial(0xffffff);
			m.doubleSided = true;
			t = new Text3D("nya-", new HelveticaLight(), m);
			container.addChild(t);
			
			camera.x = 100;
			camera.y = 200;
			camera.z = -300;
			//camera.lookAt(t);
			
			//t.lookAt(camera);
			//t.localRotationY = 180;

            startRendering();
        }
        
        override protected function onRenderTick(e : Event = null) : void
        {
            super.onRenderTick(e);
            
            t.lookAt(camera);
            camera.x += 10;
            camera.y ++;
            
            container.rotationX ++;
            container.rotationY ++;
            
            tr( t.rotationX );
            tr( t.rotationY );
            tr( t.rotationZ );
        }
        
        private function tr(...o : Array) : void
        {
            _tf.appendText(o + "\n");
            _tf.scrollV = _tf.maxScrollV;
        }
    }
}

Forked