PV3Dれんしゅー

by nbhd
♥0 | Line 27 | Modified 2009-03-03 18:43:25 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.events.Event;
    
    import org.papervision3d.view.*;
    import org.papervision3d.objects.primitives.*;
    
    [SWF(width="465", height="465", backgroundColor="#ffffff", frameRate="60")]
    public class SphereRot extends Sprite {
        private var world:BasicView = new BasicView();
        private var sphere:Sphere;

        public function SphereRot() {
            addEventListener(Event.ADDED_TO_STAGE, init);
        }
        
        private function init(e:Event):void{
            removeEventListener(Event.ADDED_TO_STAGE, init);
            addChild(world);
            
            sphere = new Sphere(null, 200, 30, 30);
            
            world.camera.z = -300;
            world.camera.focus = 5;
            
            world.scene.addChild(sphere);
            world.startRendering();
            
            addEventListener(Event.ENTER_FRAME, entFnc);
        }
        
        private function entFnc(e:Event):void {
            sphere.rotationY += 0.2;
        }
    }
}

Forked