MCPcopy
hub / github.com/KilledByAPixel/LittleJS / pingPongContinuation

Function pingPongContinuation

plugins/tweenSystem.js:451–462  ·  view source on GitHub ↗
(tween)

Source from the content-addressed store, hash-verified

449
450// Continuation for pingPong: swaps start and end on the same tween each iteration.
451function 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

Callers 1

pingPongMethod · 0.85

Calls 1

interpMethod · 0.80

Tested by

no test coverage detected