Jump to content
Search Community

Bezier Animations: funky with css left/top as percentage?

beans test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hmm I don't know enough about bezier tweens to understand exactly what behaviour should be expected, but since you are creating a brand new tween each time it is going to produce slightly different results based on #box's current coordinates (try clicking the button during the tween and you will see it jump around as the bezier is recreated). Maybe someone else could chime in here.

 

If all you need is the tween to play identically each time you click the button though, try creating the tween once (keeping a reference to it), and playing it from the start each time: http://jsfiddle.net/4GeQe/10/

Link to comment
Share on other sites

Appreciate the reply.

 

A new tween each time should be fine - as its using left/top and is absolute positioned, only the start should be different (the end should be a top/left value that is absolute)

 

Unfortunately, there is still some funkyness with percentages.

 

Take this for example:

http://jsfiddle.net/4GeQe/12/

 

It only obeys the unit measurement, but not the percentage measurement. Until the end, when it snaps into position.

Link to comment
Share on other sites

Hi Beans,

 

Sorry to hear you are getting unexpected results. Yes, i would think too that the regardless of how the beginning of the tween will be different (depending on where the object is when the tween is re-created) the end position should be the same and the object should animate to that position smoothly.

 

Hold tight, we'll get you a better explanation...

 

-c

Link to comment
Share on other sites

I believe I found the issue - would you mind trying the attached version and letting me know if it works well for you? The issue would only show up when the current value matched exactly the end value of the bezier tween. But again, that should be resolved in the attached version.

 

Also note that this version can do a lot more, like animating 3D transforms (rotationX, rotationY, rotationZ, z, perspective, transformPerspective, etc.) as well as boxShadow, borderRadius, textShadow, and clip (in browsers that support those features). That's why the file size increased, but I think you'll find the improvements to be well worth the extra kb. Anyway, please let me know if these new files work well for you. This revised version is not yet posted for public consumption - you're getting a sneak peak at all these features :)

updated_2012-11-14.zip

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