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

飛行機っていうか、戦闘機。

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

//参考書を読みながら、ソニ○クをイメージして作りました。
//戦闘機みたいな感じになったかも。
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 = 5500;
    		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 cube:Cube = new Cube(new MaterialsList({all:material}),100,250,10,1,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;   
        }
    }
}