-
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
Pausing a tween from a Group removes that tween from the Group's array. #664
Comments
This seems unintuitive indeed, so will mark as a bug. Do you have a sample? Here's a starting point: https://codepen.io/trusktr/pen/OJRQjZw |
Not sure if this small code was required, but here is the demonstration that the tween from a Group's array gets removed after pausing a tween:
|
Yeah, totally I see that. I meant, do you have an example of a problem this is causing? Even long ago before TWEEN was made into a Group, and before there was pause(), Tweens were added or removed on start/stop: Line 10 in cbc0df9
So we need to see an example of the problem. |
I found a code related to this issue. Lines 284 to 285 in e01bbdb
Lines 301 to 302 in e01bbdb
All tween instances hold a reference to a group. On pause, tween removes itself from a group and re-adds itself on resume. Lines 393 to 394 in e01bbdb
Tween.update() skips paused tween. Because of this, it is not necessary to remove and re-add tweens to a group. The downside of this behavior is that it can be confusing when users use Group to manage and manipulate their tween. The advantage of this behavior is that the update loop is faster if the mainGroup holds a large number of paused tween. |
Ah indeed, should be easy to implement! |
I'm not sure if that was intentional, but when we access the array of tweens from a Group using .getAll() and execute .pause() on one, that tweens gets removed from that Group's tween array. I find that weird as pausing a tween should not remove it. I understand if we did a .stop() on it that it would get terminated, but not .pause().
Also, it would be nice to have a .pauseAll() function to be used on a Group. Obviously, we can access the array of tweens, but like the issue I brought up, pausing each tween removes them completely.
The text was updated successfully, but these errors were encountered: