Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Bynho

TweenMax.updateTo issue

Recommended Posts

Hi Guys,

 

I seem to have a problem with the tweenMax.updateTo method.

 

Given this sample code:

 

_tween = new TweenMax(myMc,2,{rotation:360,repeat:-1,onUpdate:onUpd, ease:Linear.easeNone});


  function onUpd():void{
  if(_stop){
   _tween.updateTo({repeat:1,rotation:_angleToStop, onComplete:onF},true);
  }
 }

 

 

I am expecting the _tween to update

1. its rotation value to the predetermined value in _angleToStop

2, repeat count to change from infinity (-1) to 1

3. for it to call the onComplete method once that 1 rotation is done, where it stops in the correct value;

 

What actually happens is the spinning starts to slow down as i would expect as it is reaching the target value however it then start animating again... Its like the repeat is not working..

Could anyone help me?

 

Seems weird.

Thanks,

Bynho

Link to post
Share on other sites

updateTo() is for updating the tweening values - if you want to alter the repeat, just set that directly, like this:

 

//v11
_tween.repeat = 1;

//v12
_tween.repeat(1);

Link to post
Share on other sites

updateTo() is for updating the tweening values - if you want to alter the repeat, just set that directly, like this:

 

//v11
_tween.repeat = 1;

//v12
_tween.repeat(1);

 

Thanks for the quick reply, however when I try that it seems to ignore it.

 

If i remove the updateTo then the repeat works, however I need the rotation to slowly ease out back to a certain angle.

 

here is the code, that is still not working...

 

_tween.repeat = 1;
_tween.updateTo({rotation:_angleToStop, onComplete:onF},true);

 

Thanks

Link to post
Share on other sites

It worked fine for me - I wonder if you're running into a problem because you're continuing to use the onUpdate that constantly runs the updateTo() over and over and over, thus essentially restarting the tween on every frame. Are you setting your _stop variable back to false after you run the updateTo()?

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×