Reputation: 61
Hello everyone I am new to JavaScript and my job requires me to design in 3d using JavaScript. I went through the website but it says to include three.js. How can I include three.js in the HTML? Is there a standard src that I can include to make my programs execute or is there another way for it ? Any help or recommendations would be gladly accepted.
Upvotes: 5
Views: 16486
Reputation:
To install all the developer dependencies, try this command:
npm i --save-dev @types/three
Upvotes: 0
Reputation: 4397
npm install three --save-dev
See https://threejs.org/docs/#manual/en/introduction/Installation
Upvotes: -1
Reputation: 111
Go to the download link at: https://github.com/mrdoob/three.js/archive/master.zip
Unzip, and copy any files you want from the build subdirectory to js/ or similar in your project.
Done.
Upvotes: 0
Reputation: 35
Or you can include the link directly from GitHub Project:
<script src="http://mrdoob.github.com/three.js/build/three.min.js"></script>
Upvotes: 0
Reputation: 2198
if I could offer a friendly suggestion. Three.js is fairly advanced for a first time Javascript programmer, you might want to try some basic tutorials on HTML5 with Javascript, move your way up to library includes and such, then try your hand at Three.js. Here's a couple basic tutorial's on ThreeJS
However, I digress, to include a library in Javascript you use:
<script src="relative_path/library_name.js"></script>
In your case, download the zip source, copy the build/three.min.js file to a folder relative to your html (like a "js" folder) and use:
<script src="js/three.min.js"></script>
Kind regards ~D
Upvotes: 9