SOURCE

 //创建场景
    var scene = new THREE.Scene();
    //创建相机
    var camera = new THREE.PerspectiveCamera(45 , window.innerWidth/window.innerHeight, 1, 1000);
    // var camera = new THREE.OrthographicCamera(-10, 10, 10, -10, 1, 500);
    //创建渲染器
    var renderer = new THREE.WebGLRenderer();
    renderer.setClearColor('#000000');
    renderer.setSize(window.innerWidth,window.innerHeight);
    document.body.appendChild(renderer.domElement);
    //创建几何立方体
    var geometry = new THREE.CubeGeometry(2,2,2);
    //创建材质
    var material = new THREE.MeshBasicMaterial({color:0xff0000});
    //创建网格模型
    var cube = new THREE.Mesh(geometry,material);
    //将立方体加入场景中
    scene.add(cube);

    camera.position.z = 10;

    function render(){
        //加上动画渲染
        requestAnimationFrame(render);
        //旋转
        cube.rotation.x += 0.01;
        cube.rotation.y += 0.01;
        //渲染立方体
        renderer.render(scene,camera);
    }
    render();
console 命令行工具 X clear

                    
>
console