-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
With multiple tweens, calling stop on any of them from within their onComplete callback causes other tweens to never complete #337
Comments
same issue found here |
I would say so for now Laura. In my own experiments, I saw that this is fixed by using unique IDs for the tweens within the library (as in the hashset branch). Perhaps this will be merged to master at some point. Rather than doing this though we have just stopped using .stop in onComplete callbacks. |
It looks like this is the same as #264. |
Hey Mike I'm not 100% sure it is. I'm happy to wait and see if the hastset branch get released at some point, thanks matthewww for your comment. I've fixed the issue in our local version by just setting the _tween element to null rather than splicing it out, and then the _update function null checks and splices at that point. Thanks all |
I decided to finally merge the "hashset" branch. Please re-download master directly because npm and cdnjs aren't picking up the latest commits. |
Thanks mike! I can confirm it fixes the issue for me :) |
…e wasn't that fix(cause-loop): Reference tweenjs/tween.js#264, tweenjs/tween.js#337
Hi
There seems to be an issue regarding calling stop on a tween from inside its onComplete callback
Here is a simple example:
https://jsfiddle.net/mpq3hkhe/3/
I create 2 tweens and start them.
When tween 1 completes, it calls stop on itself. This causes tween 2 to never complete.
(You will notice I have also done an another example which works - simply by putting the call to stop in a timeout.)
I know calling stop on tween 1 is not necessary as it has stopped already, I've just done this to demonstrate the issue quickly.
A real life scenario would more like having a reset function which does loads of stuff including stopping the tween. This reset function can be called mid way through the tween or when the tween completes. Depending on when it is called, it should never have adverse effects on other tweens.
I would like to know whether you think I am wrong in my thinking above, and we must always be very careful not to call stop from the onComplete callback.
Or you agree that there seems to be an issue here, if so I can share with you the local fixes I have for it.
Thanks for your time
Laura
The text was updated successfully, but these errors were encountered: