我的Three.js有什么问题吗?

时间:2015-09-14 03:15:36

标签: javascript 3d three.js raspberry-pi

我只是想知道我的代码是否错误。我在Raspberry Pi和Apache服务器上运行它,如果代码看起来不错,我会设置代码在Pi上的代码吗?

<!DOCTYPE html>
<html>
    <head>
        <title>Three.js</title>
        <style>
            body { margin: 0; }
            canvas { width: 100%; height: 100%; }
        </style>
    </head>
    <body>
        <script src="https://ajax.googleapis.com/ajax/libs/threejs/r69/three.min.js"></script>
        <script>
            var scene = new THREE.Scene();
            var camera = new THEE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 1000 );

            var renderer = new THREE.WebGLRenderer();
            renderer.setSize( window.innerWidth, window.innerHeight );
            document.body.appendChild( renderer.domElement );

            var Geo = new THREE.BoxGeometry( 1,1,1 );
            var Mat = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
            var cube = new THREE.Mesh( Geo, Mat );
            scene.add( cube );

            camera.position.z = 5;

            var render = function () {
                requestAnimationFrame( render );

                cube.rotation.x += 0.1;
                cube.rotation.y += 0.1;

                renderer.render(scene, camera);
            };

            render();
        </script>
    </body>
</html>

0 个答案:

没有答案