Skip to main content
1-Visitor
March 12, 2018
Question

Controlling Model Item Opacity Using Toggle Button

  • March 12, 2018
  • 1 reply
  • 2664 views

I want to decrease the opacity of a model item by half on clicking a toggle button. I am attching screenshots of my approach to doing it. 

I am unable to do it.

Kindly tell me where I am going wrong. 

1 reply

21-Topaz I
March 12, 2018

You would need to tie the 'pressed' event to the opacity of the model-item. You can use an application parameter and a simple javascript function to achieve this.

 

I ran a small test to confirm this would work. I created an app parameter called 'OpacityMI' and bound it to the model item opacity. in Home.JS I added this function:

 

$scope.changeOpacity = function(){
 
 $scope.app.params.OpacityMI = .5;
};

I then called this function on the 'Pressed' event for the toggle button and was able to see the opacity change. 

image.png