Jump to content
GreenSock

erikb

checking if in delay?

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

.isActive

let's me know if my tween is actively updating values (natch).

 

But is there a way to check if I am in a delay?  Please see my simple codepen for example.

See the Pen aqmLQN?editors=0010 by jedierikb (@jedierikb) on CodePen

Link to comment
Share on other sites

Well, if you just want to know if the playhead is BEFORE that tween starts (which would, of course, be true if it's in the "delay" part of the tween), it should be as simple as:

if (animation.timeline.time() < animation.startTime()) {
  //yep
}

 

If you literally want to know if the playhead is directly inside the delay (and not before it), that could also be done, like: 

if (animation.timeline.time() < animation.startTime() && animation.timeline.time() > animation.startTime() - animation.delay()) {
  //yep
}

 

Does that answer your question? 

 

  • Like 4
Link to comment
Share on other sites

Yes, thank you.  And i see how i can determine how far into the delay my tween is with these calls as well.

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.
×