First Person 3D Navigation in Elm
Make sure you have the latest version of Chrome or Firefox and then click the following image to try out the live demo:
Without a specialized 3D framework, just the basic WebGL bindings, this took about 300 lines of Elm. I tried to keep the code super simple so it is easy to fork and build cooler stuff! This project is also architected to scale nicely as you add more entities.
We needed an additional ~95 lines of JS to use the experimental fullscreen and Pointer Lock APIs. This is an experiment in setting up ports in a general and reusable way. The goal is a general "Port Handler" pattern that lets you pipe signals out to JS to use some native API or have some side-effect. I hope we can iterate on this idea to make it even simpler for Elm code to interact with JS!
After installing the Elm Platform, run the following sequence of commands:
git clone https://github.com/evancz/first-person-elm.git cd first-person-elm elm-get install elm --make --only-js --bundle-runtime --src-dir=src Main.elm elm-reactor
And then open http://localhost:8000 to see it in action!