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 2010-2-4

Get Adobe Flash player
by hacker_qyjyddzn 04 Feb 2010
    Embed
/**
 * Copyright hacker_qyjyddzn ( http://wonderfl.net/user/hacker_qyjyddzn )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/igyD
 */

package {
    import org.papervision3d.materials.*;
    import org.papervision3d.objects.primitives.*;
    import org.papervision3d.view.*;
    import flash.events.*;
    
    public class FlashTest extends BasicView{ // Sprite + 3D機能
        private var sphere1:Sphere;
        private var sphere2:Sphere;
        
        public function FlashTest():void {
            // マテリアルを作成
            var material:WireframeMaterial = new WireframeMaterial(0xff0000);
            // 3Dオブジェクトを作成 Sphere(マテリアル, 球体の半径, ポリゴンの分割数(横, 縦))
            sphere1 = new Sphere(material, 300, 10, 10);
            sphere2 = new Sphere(material, 300, 10, 10);
            
            sphere1.x = 500;
            sphere2.x = -500;
            
            // 3Dシーンに追加して表示
            scene.addChild(sphere1);
            scene.addChild(sphere2);
            // レンダリング開始
            startRendering();
            
            // エンターフレームを設定
            addEventListener(Event.ENTER_FRAME, loop);
        }
        private function loop(e:Event):void{
        		// 球面をY軸方向に回転
        		sphere1.rotationY += 1;
        		
        		//カメラの位置を変更
        		var rateX:Number = mouseX / stage.stageWidth;
        		var targetX:Number = -5000*(rateX - 0.5);
        		camera.x += (targetX - camera.x)*0.2;
        		
        		var rateY:Number = mouseY / stage.stageHeight;
        		var targetY:Number = 5000 * (rateY - 0.5);
        		camera.y += (targetY - camera.y)*0.2;
        		
        }
    }
}