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

flash on 2012-1-7

参考書を読みながら、ソニ○クをイメージして作りました。
戦闘機みたいな感じになったかも。
Get Adobe Flash player
by hacker_n3ahm412 07 Jan 2012
    Embed
/**
 * Copyright hacker_n3ahm412 ( http://wonderfl.net/user/hacker_n3ahm412 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/kZ7i
 */

//参考書を読みながら、ソニ○クをイメージして作りました。
//戦闘機みたいな感じになったかも。
package {
    import flash.display.Sprite;
    import flash.events.*;
    import org.papervision3d.materials.*;
    import org.papervision3d.cameras.*;
    import org.papervision3d.core.math.*;
    import org.papervision3d.lights.*;
    import org.papervision3d.materials.shadematerials.*;
    import org.papervision3d.materials.utils.*;
    import org.papervision3d.objects.primitives.*;
    import org.papervision3d.view.*;
    public class FlashTest extends BasicView {
            private const guruguru:int = 1200;
            private var cnt:Number = 0;
            private var paperPlane:PaperPlane;
        public function FlashTest() {
            // write as3 code here..
            super(0,0,true,false,CameraType.SPRING);
                        
            var material:ColorMaterial = new ColorMaterial(0x3366FF);
            
            for (var i:int = 0; i < 200; i++){
                    var material1:ColorMaterial = new ColorMaterial(0x000400);
                    var cube:Cube = new Cube(new MaterialsList({all:material1}),50,50,10,10,1,1);
                    scene.addChild(cube);
                    
                    var angle:Number = (i / 200) * 360 * Math.PI / 180;
                    cube.x = Math.cos(angle) * guruguru;
                    cube.z = Math.tan(angle*2) * guruguru;
                    cube.y = 0.3 * Math.cos(angle) * guruguru;
            }
            
            paperPlane = new PaperPlane(material);
            scene.addChild(paperPlane);
            
            
            camera.addChild(paperPlane);
            
            camera.target = paperPlane;
            SpringCamera3D(camera).mass = 30;
            SpringCamera3D(camera).damping = 30;
            SpringCamera3D(camera).stiffness = 1;
            SpringCamera3D(camera).positionOffset = new Number3D(0,100,0);
            SpringCamera3D(camera).lookOffset = new Number3D(0,100,0);
            
            addEventListener(Event.ENTER_FRAME,loop);
            startRendering();
        }
        
        private function loop(e:Event):void{
                
                cnt += 0.2;
                
                var angle:Number = (cnt / 100) * 360 * Math.PI / 180;
                paperPlane.x = Math.cos(angle) * guruguru;
                paperPlane.z = Math.tan(angle*2) * guruguru;
                paperPlane.y = 0.3 * Math.cos(angle) * guruguru + 100;   
        }
    }
}