Jump to content
Search Community

TweenLite called twice : doubling x,y values in tween

nothingGrinder test
Moderator Tag

Recommended Posts

Hello,

 

I am using tweenlite to animate my transitiions. I have a tween object that looks like:

 

 var myobj = {x:30, y:150}

 

My tween gets called on transition in and then on stage Resize its called again, shortly after the transition in.

On the first call from transition in the x,y values trace as 30, 150. But, shortly after when its called again in the stage Resize function the x,y values of the object trace as 60, 300.

The tween code I'm using looks like this:

 

TweenLite.to( TheClip, .5, myobj);

 

how can I prevent this from happening?

 

In fact, this has never happening to me in all my years using GreenSock tweening library.

 

Please Advise.

Link to comment
Share on other sites

I'm pretty sure this has nothing to do with TweenLite/Max. Please post an example FLA that demonstrates the issue. If you look at the logic inside TweenLite/Max, you'll see that there's nothing that could possibly alter the coordinates like that. Maybe there's something else going on in your code?

Link to comment
Share on other sites

Okay,

 

So I am using two object:

 

var inobj = {x:30, y:150};
var stopobj = {x:30, y:170};

 

and then I am calling those objects in sequential tweens like this:

 

TweenLite.to( TheClip, 0, inobj);
TweenLite.to( TheClip, .5, stopobj);

 

When I remove the first tween, the animation looks and is positioned properly. With the first 0 tween in there, the end x,y values are 60, 320. They are being added together instead of replacing each other... perhaps the objects are being combined... ?

 

It seems like there is something here related to the way the library is functioning... but will continue digging around my code. Please advise.

 

Aaron

Link to comment
Share on other sites

Did you define your values as Strings? TweenLite/Max have a feature that interprets String values as being relative instead of absolute.

 

ABSOLUTE: TweenLite.to(mc, 1, {x:30, y:170});

RELATIVE: TweenLite.to(mc, 1, {x:"30", y:"170"});

 

Again, this is a feature, not a bug - it can be very useful actually.

Link to comment
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.
×
×
  • Create New...