Author Topic: changing alpha from code  (Read 1607 times)

ssc.mikey

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 3
    • View Profile
changing alpha from code
« on: March 10, 2014, 08:29:22 AM »
Hi. I would like to see how can i access and change the alpha of sprite during the runtime from my code. As i change the alpha to 0.5f on click i need to change it back to 1 when some event is fired.
Thank you in advance  ;) ;) ;)

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: changing alpha from code
« Reply #1 on: March 10, 2014, 09:58:08 AM »
All widgets have a .alpha property that you can set between 0f, 1f.


ssc.mikey

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: changing alpha from code
« Reply #2 on: March 10, 2014, 10:28:31 AM »
nice. thank you it works. just wonder how would you access tweenalpha.toggle function as now it jumps straight to one and i would like it to be smooth tweening from .5f to 1.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: changing alpha from code
« Reply #3 on: March 11, 2014, 06:44:11 AM »
  1. TweenAlpha twa = TweenAlpha.Begin(myWidget, duration, targetAlpha);