3Dオブジェクトに動きを付ける

by yun forked from シンプルな3Dオブジェクト (diff: 13)
♥0 | Line 21 | Modified 2011-06-14 09:55:34 | MIT License
play

ActionScript3 source code

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

// forked from yun's シンプルな3Dオブジェクト
package {
    import flash.events.Event;
    import flash.events.WeakFunctionClosure;
    import org.papervision3d.materials.*;
    import org.papervision3d.objects.primitives.*;
    import org.papervision3d.view.*;
    
    public class Sample extends BasicView {
        private var sphere:Sphere;
        public function Sample():void {
            // マテリアルを作成
            var material:WireframeMaterial = new WireframeMaterial( 0xFF0000 );
            
            // 3Dオブジェクトを作成
            sphere = new Sphere( material, 300, 10, 10 );
            
            // 3Dシーンに追加して表示
            scene.addChild( sphere );
            
            // レンダリングを開始
            startRendering();
            
            // エンターフレームを設定
            addEventListener( Event.ENTER_FRAME, loop );
        }
        
        private function loop( e:Event ):void {
            // 球面をY軸方向に回転
            sphere.rotationY += 1;
            sphere.rotationX += 1;
        }
    }
}

Forked