Jump to content
Search Community

ScaleX appears out of sequence

bamartelly 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

I am new to GSAP and am putting together a 2.5D rotating coin using GSAP scaleX and x.

 

The coin is meant to a) "rotate" in the tails side, then B) rotate out the tails side, then c) rotate in the heads side, then d) rotate out the heads side, and then the loop of the sequence begins the rotate in of the tails side again.

 

I have gotten the animation as far as c), but when I try to use scaleX to start d), something happens to the timeline and the "heads" side of the coin appears from the very start of the animation.

 

I have included a codepen here: https://codepen.io/bamartelly/pen/RgayML

 

If you un-comment lines 103 to 108 (pasted in below too) you can see the animation breaking when I try to start implementing step d).

      .fromTo(coin.heads, flipTime,{
        scaleX:1,
        x:0
      } , {
        scaleX:0,
        x:8
      }, "headEnd")

 

Here's the codepen with lines 103 to 108 uncommented, you can see how it all turns to custard: 

See the Pen GEqreZ by bamartelly (@bamartelly) on CodePen

 

 

Any help greatly appreciated. Thanks!

See the Pen RgayML by bamartelly (@bamartelly) on CodePen

Edited by bamartelly
clearer explanation of the problem
Link to comment
Share on other sites

Hello @bamartelly and sorry your having an issue. And Welcome to the GreenSock Forum!

 

This is not a GSAP bug. Since your using a fromTo() tween you have to keep in mind that all from() tweens render immediately. So to prevent this you must add immediateRender:false to your from tween. 

 

fromTo() : https://greensock.com/docs/#/HTML5/GSAP/TimelineMax/fromTo/

  • NOTE: by default, immediateRender is true in fromTo() tweens, meaning that they immediately render their starting state regardless of any delay that is specified. This is done for convenience because it is often the preferred behavior when setting things up on the screen to animate into place, but you can override this behavior by passingimmediateRender:false in the fromVars or toVars parameter so that it will wait to render the starting values until the tween actually begins.

You can see by adding that the animation starts with tales side. ;)

 

See the Pen vZKrmR by jonathan (@jonathan) on CodePen

 

Does this help? :)

 

  • Like 4
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...