Jump to content
GreenSock

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

Zero duration tweens at start are skipped if timeline is repeated

Recommended Posts

Hi,

 

Just came across this odd behavior which didn't happen in gsap 2. If you click on buttons as follows, T1, T2, T1, T2 then you will notice that element's opacity just stays 0.1 and it also skips any calls at the start of timeline. The initial value does get recorded if I am resetting it somewhere in play head of timeline, uncomment line 38.

 

Only workaround that seem to work is setting everything in onStart, a bit inconvenient but is that intended change? Release notes don't suggest using onStart to set values for repeating tweens.

See the Pen PowYrEM?editors=0011 by Sahil89 (@Sahil89) on CodePen

  • Thanks 1

Share this post


Link to post
Share on other sites

@GreenSock now it doesn't skip zero duration tweens but still skips call method.

Share this post


Link to post
Share on other sites
7 hours ago, Sahil said:

@GreenSock now it doesn't skip zero duration tweens but still skips call method.

I was going to say that's expected behavior because suppressEvents is true by default on play(), so it doesn't trigger callbacks/events, so just call t2.play(0, false) and you'll get the behavior you wanted. But I can see an argument for the call() being triggered on the very next tick, as the playhead LEAVES that position. Very tricky indeed - the zero-duration stuff is always the most complex thing to deal with timing-wise because when the playhead lands exactly on top of it there are various edge cases to accommodate (like if suppressEvents is true, there must be another render on the next tick, we must keep track of the playhead direction, etc.). I think I've got it worked out in the latest beta: https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/gsap-latest-beta.min.js

 

Better? 

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×