Skip to main content
1-Visitor
March 5, 2020
Solved

Changing font color of 3d label

  • March 5, 2020
  • 1 reply
  • 2365 views

How to change font color of 3d label using javascript?

Best answer by lgherman

Hello @vivekse ,

 

The code should work if your experience has a 3D label widget that has the StudioID set to 3DLabel-1

 

An alternative is to create an application parameter (in my case, it is called labelColor) and set its value to the desired color. Figure 1Figure 1

Then, you will need to bind the application parameter with the font color property of your 3D label. In order to do that, you will have to click on the icon indicated by the yellow arrow and drag it onto your 3D label. The window shown bellow should appear. Here, select Font Color and click Bind.

Label2.PNG

You can change the value of your application parameter using javascript like this:

 

$scope.app.params.labelColor = #FF0000;

 

 

Kind regards,

Lorena

1 reply

14-Alexandrite
March 5, 2020

Hello vivekse,

 

You can change the font color of a 3D label by adding this to your Home.js file (where 3DLabel-1 is the StudioID of your 3D label and #00FF00 is its color (in this case, green):

 

angular.element(document).ready(function () { 
 $scope.view.wdg['3DLabel-1'].fontColor = "#00FF00";
});

 

 

 

Kind regards,

Lorena

14-Alexandrite
March 6, 2020

Hello @vivekse ,

 

If the answear was what you expected, please mark that post as a solution.

 

Kind regards,

Lorena