trsh

isActive() issue with repeat:-1

Recommended Posts

Hi, why doe's isActive() fail after timeline is repeated? And if it's expected behavior with repeat:-1, what's the workaround?

Share this post


Link to post
Share on other sites

Hello trsh, and Welcome to the GreenSock forum!

Thank you for both examples, very helpful .. please standby while we look into this!

 

:)

  • Like 2

Share this post


Link to post
Share on other sites

You're absolutely right. Sorry about that. It should be fixed in the next release which you can preview (uncompressed) at: https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/TweenMax-latest-beta.js

 

If you want to patch the current version, you could add this code to your project (after GSAP loads of course) which alters the prototype:

TweenLite.prototype.isActive = function() {
var tl = this._timeline, 
          startTime = this._startTime,
          rawTime;
  return (!tl || (!this._gc && !this._paused && tl.isActive() && (rawTime = tl.rawTime(true)) >= startTime && rawTime < startTime + this.totalDuration() / this._timeScale));
};
TimelineLite.prototype.rawTime = function(wrapRepeats) {
  return (wrapRepeats && (this._paused || (this._repeat && this.time() > 0 && this.totalProgress() < 1))) ? this._totalTime % (this._duration + this._repeatDelay) : this._paused ? this._totalTime : (this._timeline.rawTime(wrapRepeats) - this._startTime) * this._timeScale;
};

Thanks for reporting this. 

  • Like 4

Share this post


Link to post
Share on other sites

 

You're absolutely right. Sorry about that. It should be fixed in the next release which you can preview (uncompressed) at: https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/TweenMax-latest-beta.js

 

If you want to patch the current version, you could add this code to your project (after GSAP loads of course) which alters the prototype:

TweenLite.prototype.isActive = function() {
var tl = this._timeline, 
          startTime = this._startTime,
          rawTime;
  return (!tl || (!this._gc && !this._paused && tl.isActive() && (rawTime = tl.rawTime(true)) >= startTime && rawTime < startTime + this.totalDuration() / this._timeScale));
};
TimelineLite.prototype.rawTime = function(wrapRepeats) {
  return (wrapRepeats && (this._paused || (this._repeat && this.time() > 0 && this.totalProgress() < 1))) ? this._totalTime % (this._duration + this._repeatDelay) : this._paused ? this._totalTime : (this._timeline.rawTime(wrapRepeats) - this._startTime) * this._timeScale;
};

Thanks for reporting this. 

 

 

Great! Tnx :)

Share this post


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