Back to the Shapespark home page

[API] Change the opacity with a script

Hello everyone,

in the API, i see we can change a few texture options :

The returned Material object has the following texture properties that can be changed:

  • Material.baseColorTexture
  • Material.roughnessTexture
  • Material.metallicTexture
  • Material.bumpTexture

Is it possible to do the same with the texture’s opacity? I tried Material.opacity and Material.opacityTexture but without success …

I’d like to make something appear when i click on another node.

Thanks a lot !

Hi,

material.opacity = 1.0;

should work (opacity is configured in the range [0, 1]). If this doesn’t work for you, could you upload the scene and share a link to it?

1 Like

Hi @jan,

thanks for the answer, it works now ! I noticed i used the “onNodeTypeClicked” function twice in my script and i guess we can’t do that ! So i merged the 2 functions and now it works ! :slight_smile:

Thank you again for the quick answer !