Jump to content
Search Community

Zero duration tweens at start are skipped if timeline is repeated

Sahil test
Moderator Tag

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
Link to comment
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
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...