导入方式1 import * as THREE from "three";
//设置场景 const scene = new THREE.Scene();
// 初始化渲染器 const renderer = new THREE.WebGLRenderer(); //设置渲染器的大小 renderer.setSize(window.innerWidth, window.innerHeight); // 将webgl渲染的canvas内容添加到body document.body.appendChild(renderer.domElement); // 设置相机的参数 const camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 500 ); //角度 窗口宽高比 近端 远端 camera.position.set(0, 0, 100); //设置相机位置(x,y,z)
标签:Threejs,场景,const,渲染,THREE,window,renderer,new From: https://www.cnblogs.com/LIXI-/p/16952884.html