| 449 | |
| 450 | // Continuation for pingPong: swaps start and end on the same tween each iteration. |
| 451 | function pingPongContinuation(tween) |
| 452 | { |
| 453 | if (tween.loopRemaining !== Infinity && tween.loopRemaining <= 1) return; |
| 454 | if (tween.loopRemaining !== Infinity) tween.loopRemaining -= 1; |
| 455 | const tmp = tween.start; |
| 456 | tween.start = tween.end; |
| 457 | tween.end = tmp; |
| 458 | tween.life = tween.duration; |
| 459 | tween.thenCallback = () => pingPongContinuation(tween); |
| 460 | tweenActive.push(tween); |
| 461 | tween.callback(tween.interp(tween.duration)); |
| 462 | } |
| 463 | |
| 464 | /** Engine plugin hook: advance every active tween by the appropriate delta. |
| 465 | * Called once per render frame by the engine (no arguments). May also be |