Elm And Augmented Reality

hi there

I’m doing some experiments with Augmented Reality (“simple” stuff with “markers”). I’m wondering if there is anyone out there doing that in Elm?

I’ve had some moderate success with AR.js but I’m looking to build something complicated enough I’d like to use Elm, but AR.js does not appear to be written in such a way that it is compatible with Elm’s requirement to have full control of the DOM.

Thanks.

2 Likes

Hi, I haven’t done AR myself but I’ve been playing with other things like ThreeJS. I’ve found that using Web components / custom elements was the best solution for those libraries that need to manage their own DOM node. Cf https://paper.dropbox.com/doc/Custom-Elements-in-Elm--AnF5gEqhdf0AQ3v5bpWtksXIAg-1Dd7LMDwgJLNGHazDImSm

Thanks for that advice. Yeah, I was leaning toward the web component route, I even found a web component that looked promising, but as far as I can tell it doesn’t support AR Markers. It looks like it’s under active development though, so maybe if I just wait, this problem will get solved for me.

However, I’m doing some other work with Elm and webcomponents, and some of the advice is that document is new to me, and will be useful.

The most interesting part of web components for elm dev is the custom element part, i.e. make your own DOM node type as explained in Luke’s dropbox paper document. This means you can create your own element, define its attributes, events, etc. Then in elm, you just use it as any other node (cf Html.node, or better in this case Html.Keyed.node). For JS -> elm communication you can listen to your custom node events with Html.Events.on. And use html attributes for elm -> JS communication.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.