Author Topic: New to NGUI. Please help  (Read 3002 times)

michwig

  • Guest
New to NGUI. Please help
« on: May 16, 2012, 08:51:47 PM »
I've been playing around with NGUI for a bit now and I'm trying to trigger an animation whenever the user clicks a button and am having difficulties figuring out how to do this. For instance I have a user click a button and I want to transform one of my other panels that I have created. I know that involves a transform tween somewhere. I am just unsure of how to set everything up and manipulate the script to do that. Any help would be greatly appreciated.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: New to NGUI. Please help
« Reply #1 on: May 16, 2012, 09:17:15 PM »
You can create an animation, or you can use a tween, whichever you prefer. Tweens are good for simple things like moving objects from A to B. Animations are perfect for everything that's more complicated than that -- bounce effects, complex movement, multi-object movement, etc.

If going the tween route, you need a tween on the target object -- for example TweenPosition. This tween needs to have the "From" and "To" parameters set. It also needs to start disabled (just disable the script).

You then attach UIButtonTween script to your button, and make it point to the TweenPosition object you added above. Hit Play, click on the button, watch what happens.