Jump to content
Search Community

Unexpected behaviour when moving group

jorma test
Moderator Tag

Recommended Posts

Please have a look at the CodePen. When I jump to a time in this CodePen after the animation has run once it jumps to a different location than expected. I expect it to jump to the 'ghost' location but it jumps to a different location. Am I doing something wrong? Thx!

See the Pen yLOaVMK by jormaturkenburg-the-typescripter (@jormaturkenburg-the-typescripter) on CodePen

Link to comment
Share on other sites

Hey jorma. This is the expected behavior because you're first pausing the timeline (which prevents updates) then you're switching the time but since there's no more updates it doesn't display that new time.

 

The easiest solution is to just pass in the time to the .pause() method:

tl.pause('label');

 

Link to comment
Share on other sites

Ah, you're right. I must not have waited for the first iteration to complete before clicking. My fault. This definitely seems like a bug but it's 

 

An even more minimal timeline that reproduces the issue:

let tl = gsap.timeline({repeat: -1});
tl.to('#group', {x: 200});
tl.to('#group', {x: -400});
tl.add('label');

If you remove either of the first two tweens or change one of their targets to something else it seems to work.

 

.pause(0).pause('label') and similar also fix the issue...

Link to comment
Share on other sites

Great catch! Yes, that's a bug. I believe it's fixed in the next release which you can preview at https://assets.codepen.io/16327/gsap-latest-beta.min.js

 

Here's a fork with the fix in place (and I made some of the code more concise, and sped things up so you don't have to wait so long for it to repeat): 

See the Pen 284cd0f3b918947dd6ceb9e6c4dce055?editors=0010 by GreenSock (@GreenSock) on CodePen

 

Better? 

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

A bug?! Hurray, I’m an official Greensock bug catcher. I shall celebrate in a fitting manner. 
 

And yes, that looks better. Although I kinda liked my old man slow version. 
 

Thanks again, for the quick and friendly response. 
👊🏻

  • Like 1
  • Haha 1
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...