AR.js-examples
AR.js-examples copied to clipboard
Problem trying to change an object when an event happens with the markers like in detection.html
Hi,
I`m trying to make an application with AR,js that is very similar to your detection app.
The only difference is that in your application, when a marker is not shown, or shown, you change the collor of the
{
init: function()
{
this.box = document.querySelector("#theBox");
},
tick: function (time, deltaTime)
{
// for convenience
let mv = markerVisible, r = "redMarker", y = "yellowMarker", b = "blueMarker";
if ( mv[r] && mv[y] && mv[b] )
this.box.setAttribute("color", "#654321");
else if ( mv[r] && mv[y] && !mv[b] )
this.box.setAttribute("color", "#FF8800");
else if ( mv[r] && !mv[y] && mv[b] )
this.box.setAttribute("color", "purple");
else if ( mv[r] && !mv[y] && !mv[b] )
this.box.setAttribute("color", "red");
else if ( !mv[r] && mv[y] && mv[b] )
this.box.setAttribute("color", "green");
else if ( !mv[r] && mv[y] && !mv[b] )
this.box.setAttribute("color", "yellow");
else if ( !mv[r] && !mv[y] && mv[b] )
this.box.setAttribute("color", "blue");
else // if ( !mv[r] && !mv[y] && !mv[b] )
this.box.setAttribute("color", "gray");
}
});
But what I need to do is to change that object, like from a box
Well, I hope I have been clear and not bothering, thanks very much for the assistance.