이번에도 기본 사용법 익히기 위주
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.x = 1;
camera.position.y = 3;
// z가 물체와 같은 위치라서 이대로는 아무것도 안보임
camera.position.z = 0;
// 카메라가 Mesh 의 위치를 쳐다보게됨
camera.lookAt(mesh.position);
## 설치
npm i stats.js
import Stats from 'stats.js';
// Stats
const stats = new Stats();
document.body.append(stats.domElement);
function draw(): void {
stats.update(); // 이부분 추가
const time = clock.getElapsedTime();
mesh.rotation.y = time;
renderer.render(scene, camera);
renderer.setAnimationLoop(draw);
}
## 설치
npm i dat.gui
// Dat GUI
const gui = new GUI();
// mesh position 의 y 를 -5부터 5까지 0.01씩 조절하겠다.
gui.add(mesh.position, 'y', -5, 5, 0.01);
// 이렇게 메서드 체이닝 방식으로 작성해도 동일 (각각 메서드 호출 시 Controller 가 리턴됨)
// gui.add(mesh.position, 'y').min(-5).max(5).step(0.01)