Search code examples
jqueryaframewebvr

How do you set opacity of an AFrame entity using jQuery?


I am trying to control the opacity of a text entity on the canvas. So I need to know how to do it using jQuery. Here is what I am trying to do:

$("#textEntity").attr("material","opacity: 0;");

Which is not working. Please help.

Thank you.


Solution

  • The opacity property of a text entity (bmfont-text) needs to be included in the "bmfont-text" attribute itself. Example :

    textElem.setAttribute("bmfont-text","text: sampleText; color: #000; opacity: 1.0;");