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

PointLight3Dの練習

未完成
Get Adobe Flash player
by Nowloading_ 25 Sep 2011
    Embed
/**
 * Copyright Nowloading_ ( http://wonderfl.net/user/Nowloading_ )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/bFNj
 */

package {
    import org.papervision3d.materials.*;
    import org.papervision3d.materials.shadematerials.*;
    import org.papervision3d.materials.utils.*;
    import org.papervision3d.objects.primitives.*;
    import org.papervision3d.view.*;
    import org.papervision3d.lights.*;
    import flash.events.Event;
    [SWF(backgroundColor=0x000000)]
    public class lightobject extends BasicView {
        private var rad:int = 0;
        private var rad2:int = 0;
        private var i:int = rad*Math.PI/180;
        public function lightobject() {
            init();
        }
        private function init():void{
            var light:PointLight3D = new PointLight3D(true,false);
            scene.addChild(light);
            
            var material:FlatShadeMaterial = new  FlatShadeMaterial(light,0xffffff,0x111111,50);
            
            var sphere:Sphere = new Sphere(material,350,20,20);
            var cube:Cube = new Cube(new MaterialsList({all:material}),450,450,450,5,5,5);
            
            sphere.x = -350;
            cube.x = 350;
            //cube.rotationX = -45;
            camera.y = 400;
            
            scene.addChild(sphere);
            scene.addChild(cube);
            
            startRendering();
            
            addEventListener(Event.ENTER_FRAME, function(e:Event):void{
                light.z = 500*Math.cos(rad*Math.PI/180);
                light.y = 500*Math.sin(rad*Math.PI/180);
                rad += 2;
                camera.z = -1200*Math.cos(rad2*Math.PI/180);
                camera.x = 1200*Math.sin(rad2*Math.PI/180);
                rad2 += 3;
            });
        }
    }
}