Archive

Posts Tagged ‘vector’

Exploring a Papervision3D class – Text3D

December 13th, 2008

Hi:

As some of you may know VectorVision (vector fonts in flash) was added into Papervision3D last week so I decided to check out the new typography package. To my surprise, it was fairly simple to set up. This is a small example.

package
{
    import flash.events.Event;
   
    import org.papervision3d.materials.special.Letter3DMaterial;
    import org.papervision3d.typography.Font3D;
    import org.papervision3d.typography.Text3D;
    import org.papervision3d.typography.fonts.HelveticaRoman;
    import org.papervision3d.view.BasicView;

    public class SampleText3D extends BasicView
    {
       
        private var text3D:Text3D;
        private var textMaterial:Letter3DMaterial;
        private var font3D:Font3D;
               
        public function SampleText3D()
        {
            initialize();
            startRendering();
        }
       
        private function initialize():void
        {
            textMaterial = new Letter3DMaterial(0x00FFFF);
            font3D = new HelveticaRoman();
            text3D = new Text3D("Hello there.", font3D, textMaterial);
            text3D.scale = 2;
            scene.addChild(text3D);
        }
       
        override protected function onRenderTick(event:Event = null):void
        {
            super.onRenderTick(event);
            text3D.yaw(0.5);
            text3D.roll(0.5);
        }
    }
}

Experiment, Lab ,