three.d.ts provides a type-safe and readable interface for three.js.
This porject is currently based on three.js r56. (You can also get earlier three.d.ts versions)
You can get three.d.ts in the following ways:
- DefinitelyTyped, The repository for type definitions
- tsd, A TypeScript definition package manager
- Download only single three.d.ts file directly
- Zipped whole of the project contains some examples.
HTML API reference is available. (Experimental, based r56)
-
Download three.js (latest three.js is recommended).
-
Download three.d.ts and place it at any directory.
-
Create your TypeScript source file and write your application. If you want to know how to use classes in three.d.ts, examples in three.js are helpful. Usege of three.d.ts classes is all the same except for type checking.
-
Launch a shell and compile your source code. Compile your source file with three.d.ts as follows:
tsc three.d.ts yourcode.ts
-
Create your html file to invoke the generated JavaScript source code. Don't forget to refer both of three.js and yourcode.js from your html source file.
-
Open the html file.
Enjoy three.js :)
- Prividing a lot more examples written in TypeScript.