라이브러리를 이용한 애니메이션
애니메이션 라이브러리 사이트 : Green Sock
Green Sock NPM 설치 [깃허브 바로가기]
> npm install gsap
import gsap from "gsap"; const scene = new THREE.Scene(); const camera = new THREE.PerspectiveCamera( 75, // 시야각 (field of view) window.innerWidth / window.innerHeight, // 종횡비(aspect) 0.1, // near 1000 // far ); scene.add(camera); const geometry = new THREE.BoxGeometry(1, 1, 1); const material = new THREE.MeshStandardMaterial({ color: "red" }); const mesh = new THREE.Mesh(geometry, material); scene.add(mesh); function draw() { renderer.render(scene, camera); renderer.setAnimationLoop(draw); } // GASP 라이브러리 애니메이션 추가 gsap.to(mesh.position, { duration: 1, y: 2, z: 3 });
애니메이션 문서 : https://gsap.com/docs/v3/GSAP/gsap.to()
'Frontend > Three.js' 카테고리의 다른 글
threejs 개발 할 때 도움을 줄 수 있는 유틸리티 (AxesHelper, GridHelper) (0) | 2024.08.28 |
---|---|
안개(Fog) 만들기 (0) | 2024.08.28 |
애니메이션 성능 보정 (0) | 2024.08.28 |
애니메이션 기본 (0) | 2024.08.28 |
빛(조명) 설정하기 (0) | 2024.04.20 |