Author Topic: Different tween for forward and reverse Play direction  (Read 8546 times)

rockafnan

  • Guest
Different tween for forward and reverse Play direction
« on: February 13, 2013, 01:43:22 AM »
Hi, I'm new to NGUI. Is there any way to have different tween on a window for forward and reverse direction?
e.g. for forward I want my window to have scale tween but as a reverse I want it to fade out.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Different tween for forward and reverse Play direction
« Reply #1 on: February 13, 2013, 01:44:04 PM »
Set up different tweens, give them different group IDs, and activate the correct tween.

nice_C_nice

  • Guest
Re: Different tween for forward and reverse Play direction
« Reply #2 on: March 02, 2013, 05:33:40 AM »
New to Unity and NGUI. Awesome Job!

Can you please give a snippet on how to use tween group in code?
In other words, how do I get a tween with a certain group number?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Different tween for forward and reverse Play direction
« Reply #3 on: March 02, 2013, 11:11:36 AM »
The groups are mainly for automatic activation of tweens, seeing as you can be selective via code anyway. But if you wanted to check what group tweens belong to and only activate specific ones, you could do something like this:
  1. UITweener[] tweens = GetComponents<UITweener>();
  2. foreach (UITweener tw in tweens) { if (tw.tweenGroup == 123) tw.Play(true); }

nice_C_nice

  • Guest
Re: Different tween for forward and reverse Play direction
« Reply #4 on: March 03, 2013, 11:52:48 PM »
Ok thanks. That's exactly what I had already. I had two TweenColors on a GO and thought for sure there was a better way to just grab a specific one rather than littering the code with "foreach" everywhere. Especially since i only had two. Alas I'm still new to C# and Unity.

Appreciate you taking the time to respond.
Thank you.

rockafnan

  • Guest
Re: Different tween for forward and reverse Play direction
« Reply #5 on: March 05, 2013, 02:09:59 AM »
Thanks, Just what I'm looking for...  :D