Jump to content
GreenSock

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

Object after tween isnt precise

Recommended Posts

Hi,

 

I am trying to create an application where cards flip in 3D using TweenMax to change the rotationY properties of a movieClip. However, I am noticing that if I tween a card in scale + rotationY (to "flip it up") and then tween it back down (to "flip it down") - it doesn't land in the exact position as it was before I "flipped it up." The application I am building requires precision on this because my cards will be in a tightly aligned grid, this difference is noticeable and unwanted. I have attached a sample of the issue - click on the lighter blue card in the center of the grid and then again to flip it back. Notice the bottom and right gutters between that card and the others is overlapped now - like the card nudged 1px right and down after tweening.

 

If anyone has any thoughts? My gut tells me this is just the cost for using a plugin to tween (which by the way I LOVE these plugins) - but maybe there is some way to get more precision through TweenMax on the final placement of the MovieClip.

 

Also - I know I can place an onComplete call to a function that resizes/positions my movie clip after it tweens, but I am hoping to avoid that.

 

Many thanks in advance!

CardFlip.fla.zip

Link to comment
Share on other sites

It should be noted - I tried the onComplete function to scale it and position it and it did not change anything. I then tried removing the rotationY properties in the tween call and simply scaled the card and it worked as expected (no issues).

 

So I am assuming this has something to do with throwing the object into (pseudo) 3D with the rotationY tween change?

Link to comment
Share on other sites

On further investigation, it looks like it is an artifact of Flash and the (pseudo) 3D transforms? I changed my file to simply add a rotationY = 0; on click of the card and the same issue happens as the previous tweened example (see attached).

 

Sorry to add this post here since it seems it isn't related to the GreenSock tween engine, but if anyone has any general solutions/tricks in mind I would appreciate it.

 

Thanks.

CardFlip2.fla.zip

Link to comment
Share on other sites

Yeah, that's a really annoying thing that Flash does. The solution is equally weird - store the original Matrix (which has all the position/scale/rotation settings) and then re-apply it when you're ready so that it clears any 3D stuff. You could just set the transform.matrix3D to null, but that'd lose all the position/scale/rotation settings.

 

 

var original:Matrix = yourObject.transform.matrix;
...do stuff...
yourObject.transform.matrix = original;

 

In case it helps: http://blog.andrewvillegas.com/?p=12

Link to comment
Share on other sites

Ah, I was too late coming to the party. I had the same issue with some animations that I was doing, and the transform.matrix did the trick. I put it as a function triggered by the onComplete thingy in the Tween that it was effecting, and solved it straight away.

Link to comment
Share on other sites

Cool, thanks so much for the pointers. Too bad it has to be done this way, hope Adobe updates this at some point, its an annoying little bug.

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.
×