27

I am trying to learn the basics of THREE.js. I have read a couple of tutorial, and I would like to start experimenting. My problem is that I am not able to find any documentation

This is supposed to be an API browser, but I was not able to find the very basic objects, like PlaneGeometry or SphereGeometry. Is there any other place where to find an API?

LarsH
  • 25,732
  • 8
  • 77
  • 136
Andrea
  • 19,377
  • 21
  • 107
  • 177
  • 1
    The API changes A LOT anyway which I imagine is a reason why documentation is a problem, but I've always started from existing examples which are simple/easy to break down and moved on from there. – George Profenza Oct 26 '11 at 20:42
  • 7
    Just added some base description for all *Geometry - https://github.com/mrdoob/three.js/wiki/API-Reference – Mr.doob Oct 27 '11 at 18:48
  • this is ridiculous for even simple stuff you have to go on scavenger hunt and if you are lucky you will find something that can be reverse engineered. Only to discover that this maybe outdated and won't work. – Muhammad Umer Nov 22 '13 at 19:50

6 Answers6

17

Another place to browse the API is here. I think both this and the one you referenced were generated before the recent name change for geometry objects. You could ask staunsholm to regenerate the API docs that he posted. Another, more official-looking place is here, but it still has quite a few "to-do's" in it.

I feel the same way about the lack of up-to-date documentation for THREE.js. If you want to apply some influence toward prioritizing this, you could reopen this bugtracker issue and comment on it. Or you could take it upon yourself :-) to maintain a frequently-updated THREE.js API reference, generated with jsdoc. Alternatively, you can dig through the source code and examples to find answers to your questions, and then update the apparently official wiki pages with your discoveries.

Sorry this is not the ideal solution you were hoping for, but maybe it's the best available solution for now. The author of three.js seems to feel that the API needs to stabilize more before a documentation effort would be worthwhile for him.

LarsH
  • 25,732
  • 8
  • 77
  • 136
  • about 1st link, i am under impression that directionalLight has property `position` and method `normalize()`, either it's of its own or inherited from somewhere, but i can't find it. Can you help or tell what is going on. – Muhammad Umer Nov 22 '13 at 19:53
  • @MuhammadUmer: Regarding the 1st link, the note at the bottom of the page says the doc was generated Jan 02 2013. If you follow the 3rd link, you'll find DirectionalLight with a `position` property, and an inheritance diagram. I don't see any `normalize()` method. – LarsH Nov 22 '13 at 22:44
  • `directionalLight.position.set(1, 1, 1).normalize();` something like this – Muhammad Umer Nov 23 '13 at 02:13
  • 1
    @MuhammadUmer: In that case, it's not `directionalLight` that has a `normalize()` method, but rather `Vector3D` does. `position` is a `Vector3D`, as is the value returned by `position.set()`. – LarsH Nov 24 '13 at 02:03
7

Latest official API is currently here http://mrdoob.github.com/three.js/docs/

Codler
  • 9,393
  • 6
  • 45
  • 61
4

three.js doc is in the examples. http://mrdoob.github.com/three.js/

try them and look at the sources, they are quite clear. There is 112 of them and they are carefully maintained. It gives doc and test at the same time. There is no API documentation at the moment, and i dont think there will be in a near future.

It is more about. take an example close to what you want, and derive it.

Jerome Etienne
  • 387
  • 1
  • 3
  • 1
    Sadly the examples are quite complicated to start with. I would really appreciate to see, say, an example with a single rectangle with a texture on it. Moreover, the examples I opened lack comments, hence they are even less helpful. – Andrea Oct 27 '11 at 10:47
  • The examples and API should be quite self descriptive. Albeit there are indeed some examples that are a bit convoluted. Try to focus on the easy ones first :) – Mr.doob Oct 27 '11 at 18:52
  • 4
    In theory they are. But because of the lack of *really* simple examples, I cannot figure out the use of some parts of the API. For instance, in the question http://stackoverflow.com/questions/7919516/using-textures-in-three-js I tried to use a texture in the simplest possible way, and I thought I had everything right, but it turns out it does not work. It is hard for me to say what is different wrt to more complicated examples, where may other features are used. – Andrea Oct 28 '11 at 07:52
3

I have written a set of more than 60 introductory examples with detailed comments at

http://stemkoski.github.io/Three.js/

These examples are meant to illustrate many of the basic features of Three.js, one at a time, and as the examples progress some build upon each other, some increase in complexity, and some incorporate additional Javascript libraries.

Hope this helps!

Lee Stemkoski
  • 8,138
  • 2
  • 39
  • 58
3

Official API is here:

Documentation: http://mrdoob.github.com/three.js/docs/48/index.html

Full Index: http://mrdoob.github.com/three.js/docs/48/genindex.html

And is pretty detailed at present.

64k
  • 230
  • 3
  • 11
  • Thank you, all this documentation was not there when I first asked :-) – Andrea Feb 12 '12 at 14:04
  • @Andrea, the second one is not there anymore, and the first one has a lot of "todo"s in it. (Which is not to say that it isn't the best three.js documentation available.) – LarsH Apr 17 '12 at 03:55
  • 1
    P.S. I think the official URL is http://mrdoob.github.com/three.js/docs/latest/, which does currently redirect to the first URL given above, but may not always do so. – LarsH Apr 17 '12 at 04:45
  • 1
    Looks like it's all we have, but it isn't as good as it could... If I wasn't clueless about it I'd help. – Camilo Martin Jun 28 '12 at 05:42
  • 1
    Currently it's http://mrdoob.github.com/three.js/docs/ , which redirects to the latest version-specific API (50 today). It is still lacking, though, and even the source code is missing comments... – Damien Aug 28 '12 at 08:05
  • At the very moment even the latest docs are outdated. The easiest way to "browse" the signatures etc. is with proper JavaScript IDE. [Eclipse's free JSDT](http://www.eclipse.org/webtools/jsdt/) should be able to make it browseable and auto-complete, thanks to standard way of using prototype in Three.js source code. Also I've tried with WebStorm (warning! proprietary) and it seems to work. – Ciantic Mar 07 '13 at 14:16
2

There is algo a book published recently: WebGL: Up and Running, which is based on THREE.js, so you'll get complete understanding of how it works. I think it's a good place to start if you want to get overall knowledge of all THREE.js aspects and not just by scrutinizing separate examples.

Alex Under
  • 1,252
  • 1
  • 11
  • 23