Jump to content
GreenSock

ProMogr

Problem with animation after the 1st loop

Recommended Posts

Hello, 
I have a weird problem with a rotation effect but only after the 1st loop! Some effects (.to) only works the 1st time. Please see the codepen.
Any help would be appreciated.

See the Pen ePygWe by promogr (@promogr) on CodePen

Link to comment
Share on other sites

Hi and welcome to the GreenSock forums,

 

Thanks for the demo. Its very helpful but in the future please make some effort to reduce it to the bare amount of code.

Right now the duration is 30 seconds long. Fortunately we can speed it up with timeScale() but if you can get the problem to occur with 2 messages that's fine. We don't need to see all the messages.

 

When you have an animation that doesn't play the same on multiple iterations it is usually due to overlapping tweens causing an overwrite. You were using negative position parameters on the ball tweens which means a new ball tween was starting while another was playing.

Since the ball tweens are the issue you can set overwrite:"none" on them

 

See the Pen wYpdNV?editors=0010 by anon (@anon) on CodePen

 

To test if an overwrite is the problem, you can add this to your code:

 

  TweenLite.onOverwrite = function() {
    console.log("overwrite")
  }

 

More info on overwriting can be found here: https://greensock.com/docs/TweenLite/static.onOverwrite

 

Also, I noticed you have onComplete callback set on your timeline. Timelines that repeat infinitely (repeat:-1) will never complete.

  • Like 5
Link to comment
Share on other sites

Seconding what @Carl said! Tip: It might be helpful to use labels to your timeline to sync up your animations and avoid overwriting/overlapping timelines (https://greensock.com/docs/TimelineLite/addLabel()). Using labels makes it so you don't have to add a negative delay to start two+ tweens at the same time, and it will make your synced up tweens/delays much easier to read.

 

 

 

  • Like 5
Link to comment
Share on other sites

Wow! That was fast!
Thank you very much for your eye opening answer. :D

  • Like 2
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.
×