threejs-kotlin icon indicating copy to clipboard operation
threejs-kotlin copied to clipboard

three.js bindings for Kotlin:question:.render()

threejs-kotlin

Recently I started learn Kotlin js and based on Nicolas article I've wanted to try out Kotlin transpiling ability.

This is a Three.js bindings for Kotlin using external modifiers and based on Three.js r84 with working examples.

amf loader

amf loader

Usage

git clone https://github.com/Pozo/threejs-kotlin
cd threejs-kotlin
./gradlew examples:run
xdg-open http://localhost:8088

Kotlin JS and javascript modules

If you would like to use any javascript library with Kotlin, you can try several ways. According to the Kotlin Language Documentation:

ts2kt

"To access third-party frameworks with a strongly-typed API, you can convert TypeScript definitions from the Definitely Typed type definitions repository to Kotlin using the ts2kt tool."

With ts2kt you can try out the following libraries:

external modifier

"To tell Kotlin that a certain declaration is written in pure JavaScript, you should mark it with external modifier. When the compiler sees such a declaration, it assumes that the implementation for the corresponding class, function or property is provided by the developer, and therefore does not try to generate any JavaScript code from the declaration. This means that you should omit bodies of external declarations."

There are a few existing solutions based on this method.

Goals
  • strongly-typed API

more details later, play with example and discover the code! :smiley_cat:

Licensing

Please see the file called LICENSE.

Links

Kotlin related
Three.js

Contact

Zoltan Polgar - [email protected]

Please do not hesitate to contact me if you have any further questions.