user2663662
user2663662

Reputation: 61

How to install Three.js

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

Answers (5)

user16435384
user16435384

Reputation:

To install all the developer dependencies, try this command:


npm i --save-dev @types/three

Upvotes: 0

D.Deriso
D.Deriso

Reputation: 4397

npm install three --save-dev

See https://threejs.org/docs/#manual/en/introduction/Installation

Upvotes: -1

m4r35n357
m4r35n357

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

heltonitba
heltonitba

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

Darryl_Lehmann
Darryl_Lehmann

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

Related Questions