Skip to content

schwarzeszeux/three.d.ts

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

three.d.ts

TypeScript interface for three.js

three.d.ts provides a type-safe and readable interface for three.js.
This porject is currently based on three.js r54. (You can also get three.d.ts r53)

Download

only three.d.ts or zipped whole of the project contains some examples.

API Reference

HTML API reference is available. (Experimental)

http://kontan.github.com/dtsdoc/three.d.ts.html

Usage (for beginners of TypeScript)

  1. Download three.js (three.js r54 is recommended) and unzip it.

  2. Download three.d.ts and place it at any directory.

  3. Create your TypeScript source file.

  4. To reference three.d.ts from your typescript code, write the following special comment at the top of the your source file:

    /// <reference path="path/to/three.d.ts" />

The compiler will search type names and identifiers from the file. Even if you write a wrong path to the TypeScript ambient source file, the compiler will not complain about missing the file :-( The compiler will just says "The name 'THREE' does not exists in the current scope." Be careful about the path.

  1. Write your application. If you want to refer a API reference, watch official API reference (a little out of date) or read three.d.ts.
  2. Launch a shell and compile the your code.
  3. 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. The previous special comment line does not influence the generated JavaScript.
  4. Open the html file. If your application doesn't work, source maps is useful to debug.

Enjoy three.js!

Demo

http://kontan.github.com/three.d.ts

TODO

  • Prividing a lot more examples written in TypeScript.

About

TypeScript interface for three.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published