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

Away3D Gold Practice02 Plane 5枚表示

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

// forked from siouxcitizen's Away3D Gold Practice01 Plane 1枚表示
//Away3D 4.0 Gold で複数Planeを表示してみました
//
package {
    import away3d.containers.View3D;
    import away3d.debug.AwayStats;
    import away3d.entities.Mesh;
    import away3d.materials.ColorMaterial;
    import away3d.primitives.PlaneGeometry;
    import away3d.primitives.PrimitiveBase;

    import flash.events.Event;
    import flash.geom.Vector3D;

    import flash.display.Bitmap;
    import flash.display.BitmapData;

    [SWF(backgroundColor="#FFFFFF", frameRate="60", width="465", height="465")]
    public class PlaneSample extends View3D {

        private static const ZERO : Vector3D = new Vector3D(0, 0, 0);
        private var _planeGeo : PrimitiveBase;
        private var _plane01 : Mesh;
        private var _plane02 : Mesh;
        private var _plane03 : Mesh;
        private var _plane04 : Mesh;
        private var _plane05 : Mesh;

        private var _capture : BitmapData = new BitmapData(465, 465, false, 0x000000);

        public function PlaneSample() {

           // wonderfl capture
           Wonderfl.disable_capture();
           //addChild(new Bitmap(_capture)) ;

            antiAlias = 0;
            backgroundColor = 0x222222;

            _planeGeo = new PlaneGeometry(300, 300, 8, 8, true, true);
            _plane01 = new Mesh(_planeGeo, new ColorMaterial(0xff0000, 0.5));
            _plane01.y += 250;
            scene.addChild(_plane01);

            _planeGeo = new PlaneGeometry(300, 300, 8, 8, true, true);
            _plane02 = new Mesh(_planeGeo, new ColorMaterial(0x00ff00, 0.5));
            _plane02.x += 250;
            scene.addChild(_plane02);

            _planeGeo = new PlaneGeometry(300, 300, 8, 8, true, true);
            _plane03 = new Mesh(_planeGeo, new ColorMaterial(0x0000ff, 0.5));
            _plane03.x -= 250;
            scene.addChild(_plane03);

            _planeGeo = new PlaneGeometry(300, 300, 8, 8, true, true);
            _plane04 = new Mesh(_planeGeo, new ColorMaterial(0xffff00, 0.5));
            _plane04.y -= 250;
            scene.addChild(_plane04);

            _planeGeo = new PlaneGeometry(300, 300, 8, 8, true, true);
            _plane05 = new Mesh(_planeGeo, new ColorMaterial(0xff00ff, 0.5));
            _plane05.y = 0;
            scene.addChild(_plane05);

            camera.y = 0;
            camera.z = -700;
            addEventListener(Event.ENTER_FRAME, update);
                   
            addChild(new AwayStats());
        }

        private function update(event : Event) : void {

            _plane01.rotationX = -(stage.mouseY - (stage.stageHeight >> 1));
            _plane01.rotationY = stage.mouseX - (stage.stageWidth >> 1);

            _plane02.rotationX = -(stage.mouseY - (stage.stageHeight >> 1));
            _plane02.rotationY = stage.mouseX - (stage.stageWidth >> 1);

            _plane03.rotationX = -(stage.mouseY - (stage.stageHeight >> 1));
            _plane03.rotationY = stage.mouseX - (stage.stageWidth >> 1);

            _plane04.rotationX = -(stage.mouseY - (stage.stageHeight >> 1));
            _plane04.rotationY = stage.mouseX - (stage.stageWidth >> 1);

            _plane05.rotationX = -(stage.mouseY - (stage.stageHeight >> 1));
            _plane05.rotationY = stage.mouseX - (stage.stageWidth >> 1);

            camera.lookAt(ZERO);
            render();
            //renderer.queueSnapshot(_capture);
        }
    }
}