Author Topic: Small bug with UITweener's Sample method...  (Read 3948 times)

pixelplacement

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Small bug with UITweener's Sample method...
« on: October 13, 2013, 12:12:35 AM »
Just a heads up that UITweener's Sample method does not work with the current version of NGUI (3.0.2) since it does not internally set the mFactor value to the factor you pass along.  If you add a line to set mFactor before this method completes it will correctly apply your requested factor to the tween:

Maybe around line 268 just add:

//Synchronize mFactor
mFactor = factor;

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Small bug with UITweener's Sample method...
« Reply #1 on: October 13, 2013, 10:18:02 AM »
It's not supposed to. It's supposed to just sample it, but it shouldn't change the 'mFactor'. Why are you sampling things manually? I can make the tweenFactor property have a setter if you need.

pixelplacement

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: Small bug with UITweener's Sample method...
« Reply #2 on: October 13, 2013, 12:04:54 PM »
We need to be able to play a tween in reverse at any time even if it wasn't previously played forward so we need to fast-forward to the end of the tween and then play it in reverse.  It seems the only way to make this happen is by getting the mFactor synced up to that Sample method call.  Is there another route to achieve this?  If not making that tweenFactor have a setter would be awesome for this purpose.

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Small bug with UITweener's Sample method...
« Reply #3 on: October 13, 2013, 09:13:11 PM »
UITweener.Play lets you play it in reverse.

pixelplacement

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: Small bug with UITweener's Sample method...
« Reply #4 on: October 14, 2013, 12:35:17 PM »
Correct, but if we want to play backwards starting at the end of the tween (the To value) we would need to first sample to the To value and then play in reverse and this is where being able to have Sample actually set to the provided factor is handy.