| 437 | // from `.loop()` keeps working — calling `.stop()` mid-loop now cancels |
| 438 | // the entire chain instead of just the current iteration. |
| 439 | function loopContinuation(tween) |
| 440 | { |
| 441 | if (tween.loopRemaining !== Infinity && tween.loopRemaining <= 1) return; |
| 442 | if (tween.loopRemaining !== Infinity) tween.loopRemaining -= 1; |
| 443 | tween.life = tween.duration; |
| 444 | tween.thenCallback = () => loopContinuation(tween); |
| 445 | tweenActive.push(tween); |
| 446 | // snap to start for the new iteration (matches Tween constructor behavior) |
| 447 | tween.callback(tween.interp(tween.duration)); |
| 448 | } |
| 449 | |
| 450 | // Continuation for pingPong: swaps start and end on the same tween each iteration. |
| 451 | function pingPongContinuation(tween) |