three.js on GitHub - Where the Magic Happens! 0.2


Everything officially related to the three.js project is kept in one huge repository on Github. It is maintained by the original creator of three.js, @mrdoob (AKA Ricardo Cabello), along with an army of open-source aficionados.

It’s a huge and active repo - the 7th most starred Javascript library on Github, and the 8th most forked. Its up there with superstars like React, jQuery, and Node.js.

There’s a lot to see here, and it may seem confusing at first. Luckily we only need to look inside a couple of folders for now, though. Go ahead and open the repo if you want to take a look now, or feel to skip ahead and come back later if you prefer.

Linking to Files in the Repo from Your App

You can directly reference files from the repo using the form in your app.

This links to the file build/three.js in the repo but serves it to you using a CDN meaning that it’s perfectly acceptable to link to the files this way, even from a web page that has high traffic.

Don’t link directly to the file using though, it won’t work!

The build/ Folder

Contained in this folder are just three files, each of which contains the core of three.js, which you’ll refer to by THREE in your apps. You only ever need to include one of these files.

The examples/ Folder

We’ll be exploring this folder in Section 11: Extras, since there are a lot of useful goodies contained here, such as:

You can view live versions of the examples here. You should definitely make sure that you are familiar with these and whenever you are working to understand a new feature of three.js, check the examples to see if there is one that covers it and go over the corresponding source code.

Everything in this folder is covered by the same MIT license as three.js, which means that you are free to use anything in your own projects, in any way that you like.

The src/ Folder

The uncompiled three.js source files are all contained here, in the src/ folder. While you are learning to use three.js you won’t need to look in here that often, but as you become more proficient you will start to need to know how the actual three.js code is implemented. To make things easier, every docs page has a direct link to the relevant file in the src/ folder.

Other Folders

There are a couple of other folders in addition to the ones mentioned above. We won’t be covering them further in this book, but you may find their contents useful: