I've edited the capx so that now it will fade visible and invisible using opacity each time you flip the switch. I didn't do the 50% opacity if the switch is halfway, but if you study the capx, you should be able to easily do it as well.
https://www.dropbox.com/s/xp2l3oggmgk1y2s/Lighting%20TestModified.capx
Thanks for your help, but this is not exactly what I'm looking for. I may not have described what I'm looking for good enough so I will try again. The switch works as a light dimmer. At the max position of the switch (the highest position) the square will be at 100 %. At the minimum position of the switch (the lowest position) the square will not show at all. So for every position between the max and the minimum, the square's opacity should be relevant to the position of the switch.
Example: If you pull the switch 50% of the way down and stop it there, the square should show 50% percent opacity. If you then push the switch 83% of the way up, the square should 81% opacity.
The switch acts as a gauge for the opacity of the square. Thanks again for the quick response maybe I can tweak your file to get the results im looking for.