ThreeJS 1. 라이브러리 사용 준비

jiho·2019년 12월 19일
2

Threejs

목록 보기
2/10

Skelleton.html

<!DOCTYPE html> 
<html>
<head>    
  <title>Example 01.01 - Basic skeleton</title>   
  <meta charset="UTF-8" />    
  <script type="text/javascript" charset="UTF-8" src="../../libs/three/three.js"></script>    
  <script type="text/javascript" charset="UTF-8" src="../../libs/three/controls/TrackballControls.js"></script>   
  <script type="text/javascript" src="./js/01-01.js"></script>    
  <link rel="stylesheet" href="../../css/default.css"> </head>
<body>    
  <!-- Div which will hold the Output -->    
  <div id="webgl-output"></div>
    <!-- Javascript code that runs our Three.js examples -->    
  <script type="text/javascript">        
    (function () {            
    	// contains the code for the example            
    	init();        
    })();    
  </script> 
  </body>
</html>
  • we'll at least need to load the Three.js library, three.js
  • TrackballControls.js, which allows you to use your mouse to rotate and pan around the scenes.
  • In the element of this page, you can see a single
    element. When we write our Three.js code, we'll point to the output of the Three.js renderer to that element
  • The init() function is defined in the 01-01.js file and will set up the Three.js scene.

Three.js의 라이브러리는 https://github.com/mrdoob/three.js 에서 구할 수 있고
eBook의 library 구조와는 조금다르지만 내용은 같다.

https://github.com/mrdoob/three.js/tree/dev/build
배포용으로 사용하려면 위 경로로 들어가서 three.js 대신 three.min.js를 사용하면 될 것 같다.(용량은 4배 차이)

profile
Scratch, Under the hood, Initial version analysis

1개의 댓글

comment-user-thumbnail
2020년 5월 7일

threejs궁금한것이 있는데 질문 좀 드려도되나요?

답글 달기